Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
DP3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ResearchAndDevelopment
DP3
Commits
186043e6
Commit
186043e6
authored
2 years ago
by
Maik Nijhuis
Browse files
Options
Downloads
Patches
Plain Diff
Remove unused and untested ParameterRecord::getRecursive
parent
7d3b2163
No related branches found
No related tags found
1 merge request
!802
Remove unused and untested ParameterRecord::getRecursive
Pipeline
#38674
passed
2 years ago
Stage: versioning
Stage: prepare
Stage: build
Stage: linting
Stage: test
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/ParameterRecord.cc
+3
-31
3 additions, 31 deletions
common/ParameterRecord.cc
common/ParameterRecord.h
+5
-14
5 additions, 14 deletions
common/ParameterRecord.h
with
8 additions
and
45 deletions
common/ParameterRecord.cc
+
3
−
31
View file @
186043e6
...
...
@@ -5,53 +5,25 @@
#include
"ParameterRecord.h"
#include
<cstdio>
#include
<ostream>
#include
<string>
namespace
dp3
{
namespace
common
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ParameterRecord
&
p
rec
)
{
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ParameterRecord
&
rec
ord
)
{
bool
first
=
true
;
os
<<
'{'
;
for
(
ParameterRecord
::
const_iterator
iter
=
prec
.
begin
();
iter
!=
prec
.
end
();
++
iter
)
{
for
(
const
std
::
pair
<
std
::
string
,
ParameterValue
>&
entry
:
record
)
{
if
(
first
)
{
first
=
false
;
}
else
{
os
<<
", "
;
}
os
<<
'\''
<<
iter
->
first
<<
"': "
<<
iter
->
second
;
os
<<
'\''
<<
entry
.
first
<<
"': "
<<
entry
.
second
;
}
os
<<
'}'
;
return
os
;
}
bool
ParameterRecord
::
getRecursive
(
const
std
::
string
&
key
,
ParameterValue
&
value
)
const
{
const_iterator
iter
=
find
(
key
);
if
(
iter
!=
end
())
{
value
=
iter
->
second
;
return
true
;
}
// Try to find the key in possible ParmRecords.
// Strip the last part from the key.
std
::
string
::
size_type
pos
=
key
.
rfind
(
'.'
);
while
(
pos
!=
std
::
string
::
npos
)
{
const_iterator
iter
=
find
(
key
.
substr
(
0
,
pos
));
if
(
iter
!=
end
())
{
ParameterValue
pv
(
iter
->
second
);
if
(
pv
.
isRecord
()
&&
pv
.
getRecord
().
getRecursive
(
key
.
substr
(
pos
+
1
),
value
))
{
return
true
;
}
}
if
(
pos
==
0
)
return
false
;
pos
=
key
.
rfind
(
'.'
,
pos
-
1
);
}
return
false
;
}
}
// namespace common
}
// namespace dp3
This diff is collapsed.
Click to expand it.
common/ParameterRecord.h
+
5
−
14
View file @
186043e6
// ParameterRecord.h: A record of parameter values
//
// Copyright (C) 202
0
ASTRON (Netherlands Institute for Radio Astronomy)
// Copyright (C) 202
2
ASTRON (Netherlands Institute for Radio Astronomy)
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef
LOFAR
_COMMON_PARAMETERRECORD_H
#define
LOFAR
_COMMON_PARAMETERRECORD_H
#ifndef
DP3
_COMMON_PARAMETERRECORD_H
_
#define
DP3
_COMMON_PARAMETERRECORD_H
_
#include
"ParameterSet.h"
namespace
dp3
{
namespace
common
{
/// \brief A record of parameter values
/// \brief A record of parameter values.
/// The only difference with a ParameterSet is the output operator.
class
ParameterRecord
:
public
ParameterSet
{
public:
/// Define the iterators for this class.
typedef
ParameterSet
::
iterator
iterator
;
typedef
ParameterSet
::
const_iterator
const_iterator
;
/// Default constructor creates empty record.
ParameterRecord
()
{}
/// Try to get a value from the record or from a nested record.
bool
getRecursive
(
const
std
::
string
&
key
,
ParameterValue
&
value
)
const
;
/// Put to ostream.
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
ParameterRecord
&
);
};
...
...
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