Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kilian Weishaupt
dune-common
Commits
5335b6c8
Commit
5335b6c8
authored
10 years ago
by
Christian Engwer
Browse files
Options
Downloads
Patches
Plain Diff
[parametertree] adhere to the naming scheme for member variables
parent
5414ab11
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/parametertree.cc
+18
-18
18 additions, 18 deletions
dune/common/parametertree.cc
dune/common/parametertree.hh
+5
-4
5 additions, 4 deletions
dune/common/parametertree.hh
with
23 additions
and
22 deletions
dune/common/parametertree.cc
+
18
−
18
View file @
5335b6c8
...
...
@@ -25,15 +25,15 @@ ParameterTree::ParameterTree()
void
ParameterTree
::
report
(
std
::
ostream
&
stream
,
const
std
::
string
&
prefix
)
const
{
typedef
std
::
map
<
std
::
string
,
std
::
string
>::
const_iterator
ValueIt
;
ValueIt
vit
=
values
.
begin
();
ValueIt
vend
=
values
.
end
();
ValueIt
vit
=
values
_
.
begin
();
ValueIt
vend
=
values
_
.
end
();
for
(;
vit
!=
vend
;
++
vit
)
stream
<<
vit
->
first
<<
" =
\"
"
<<
vit
->
second
<<
"
\"
"
<<
std
::
endl
;
typedef
std
::
map
<
std
::
string
,
ParameterTree
>::
const_iterator
SubIt
;
SubIt
sit
=
subs
.
begin
();
SubIt
send
=
subs
.
end
();
SubIt
sit
=
subs
_
.
begin
();
SubIt
send
=
subs
_
.
end
();
for
(;
sit
!=
send
;
++
sit
)
{
stream
<<
"[ "
<<
prefix
+
sit
->
first
<<
" ]"
<<
std
::
endl
;
...
...
@@ -48,14 +48,14 @@ bool ParameterTree::hasKey(const std::string& key) const
if
(
dot
!=
std
::
string
::
npos
)
{
std
::
string
prefix
=
key
.
substr
(
0
,
dot
);
if
(
subs
.
count
(
prefix
)
==
0
)
if
(
subs
_
.
count
(
prefix
)
==
0
)
return
false
;
const
ParameterTree
&
s
=
sub
(
prefix
);
return
s
.
hasKey
(
key
.
substr
(
dot
+
1
));
}
else
return
(
values
.
count
(
key
)
!=
0
);
return
(
values
_
.
count
(
key
)
!=
0
);
}
bool
ParameterTree
::
hasSub
(
const
std
::
string
&
key
)
const
...
...
@@ -65,14 +65,14 @@ bool ParameterTree::hasSub(const std::string& key) const
if
(
dot
!=
std
::
string
::
npos
)
{
std
::
string
prefix
=
key
.
substr
(
0
,
dot
);
if
(
subs
.
count
(
prefix
)
==
0
)
if
(
subs
_
.
count
(
prefix
)
==
0
)
return
false
;
const
ParameterTree
&
s
=
sub
(
prefix
);
return
s
.
hasSub
(
key
.
substr
(
dot
+
1
));
}
else
return
(
subs
.
count
(
key
)
!=
0
);
return
(
subs
_
.
count
(
key
)
!=
0
);
}
ParameterTree
&
ParameterTree
::
sub
(
const
std
::
string
&
key
)
...
...
@@ -86,9 +86,9 @@ ParameterTree& ParameterTree::sub(const std::string& key)
}
else
{
if
(
subs
.
count
(
key
)
==
0
)
subKeys
.
push_back
(
key
.
substr
(
0
,
dot
));
return
subs
[
key
];
if
(
subs
_
.
count
(
key
)
==
0
)
subKeys
_
.
push_back
(
key
.
substr
(
0
,
dot
));
return
subs
_
[
key
];
}
}
...
...
@@ -117,8 +117,8 @@ std::string& ParameterTree::operator[] (const std::string& key)
{
if
(
not
(
hasSub
(
key
.
substr
(
0
,
dot
))))
{
subs
[
key
.
substr
(
0
,
dot
)];
subKeys
.
push_back
(
key
.
substr
(
0
,
dot
));
subs
_
[
key
.
substr
(
0
,
dot
)];
subKeys
_
.
push_back
(
key
.
substr
(
0
,
dot
));
}
ParameterTree
&
s
=
sub
(
key
.
substr
(
0
,
dot
));
return
s
[
key
.
substr
(
dot
+
1
)];
...
...
@@ -126,8 +126,8 @@ std::string& ParameterTree::operator[] (const std::string& key)
else
{
if
(
not
(
hasKey
(
key
)))
valueKeys
.
push_back
(
key
);
return
values
[
key
];
valueKeys
_
.
push_back
(
key
);
return
values
_
[
key
];
}
}
...
...
@@ -144,7 +144,7 @@ const std::string& ParameterTree::operator[] (const std::string& key) const
{
if
(
not
(
hasKey
(
key
)))
DUNE_THROW
(
Dune
::
RangeError
,
"Key '"
<<
key
<<
"' not found in ParameterTree"
);
return
values
.
find
(
key
)
->
second
;
return
values
_
.
find
(
key
)
->
second
;
}
}
...
...
@@ -200,10 +200,10 @@ std::vector<std::string> ParameterTree::split(const std::string & s) {
const
ParameterTree
::
KeyVector
&
ParameterTree
::
getValueKeys
()
const
{
return
valueKeys
;
return
valueKeys
_
;
}
const
ParameterTree
::
KeyVector
&
ParameterTree
::
getSubKeys
()
const
{
return
subKeys
;
return
subKeys
_
;
}
This diff is collapsed.
Click to expand it.
dune/common/parametertree.hh
+
5
−
4
View file @
5335b6c8
...
...
@@ -202,11 +202,12 @@ namespace Dune {
const
KeyVector
&
getSubKeys
()
const
;
protected
:
KeyVector
valueKeys
;
KeyVector
subKeys
;
KeyVector
valueKeys_
;
KeyVector
subKeys_
;
std
::
map
<
std
::
string
,
std
::
string
>
values_
;
std
::
map
<
std
::
string
,
ParameterTree
>
subs_
;
std
::
map
<
std
::
string
,
std
::
string
>
values
;
std
::
map
<
std
::
string
,
ParameterTree
>
subs
;
static
std
::
string
ltrim
(
const
std
::
string
&
s
);
static
std
::
string
rtrim
(
const
std
::
string
&
s
);
static
std
::
vector
<
std
::
string
>
split
(
const
std
::
string
&
s
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment