Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
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
np
nptool
Commits
c409cda1
Commit
c409cda1
authored
9 months ago
by
Adrien Matta
Browse files
Options
Downloads
Patches
Plain Diff
* Adding functionnality to aliases
- now can support a list of vector
parent
2f7bdd3f
No related branches found
No related tags found
1 merge request
!27
Draft: [Epic] Preparation of the environement for the new GaseousDetectorScorers...
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
NPLib/Core/NPInputParser.cxx
+20
-1
20 additions, 1 deletion
NPLib/Core/NPInputParser.cxx
NPLib/Core/NPInputParser.h
+2
-1
2 additions, 1 deletion
NPLib/Core/NPInputParser.h
with
22 additions
and
2 deletions
NPLib/Core/NPInputParser.cxx
+
20
−
1
View file @
c409cda1
...
...
@@ -221,7 +221,23 @@ TVector3 NPL::InputBlock::GetTVector3(std::string Token, std::string default_uni
return
TVector3
(
x
,
y
,
z
);
}
////////////////////////////////////////////////////////////////////////////////
std
::
vector
<
std
::
string
>
NPL
::
InputBlock
::
GetVectorString
(
std
::
string
Token
)
{
std
::
vector
<
std
::
string
>
NPL
::
InputBlock
::
GetVectorList
(
std
::
string
Token
,
std
::
string
separator
)
{
auto
line
=
GetValue
(
Token
);
std
::
vector
<
std
::
string
>
val
;
while
(
line
.
find
(
"("
)
!=
std
::
string
::
npos
)
{
auto
start
=
line
.
find_first_of
(
"("
);
auto
stop
=
line
.
find_first_of
(
")"
);
auto
b
=
line
.
begin
();
auto
v
=
line
.
substr
(
start
,
stop
-
start
+
1
);
v
.
replace
(
v
.
find
(
"("
),
1
,
""
);
v
.
replace
(
v
.
find
(
")"
),
1
,
""
);
val
.
push_back
(
v
);
line
.
erase
(
b
+
start
,
b
+
stop
+
1
);
}
return
val
;
}
////////////////////////////////////////////////////////////////////////////////
std
::
vector
<
std
::
string
>
NPL
::
InputBlock
::
GetVectorString
(
std
::
string
Token
,
std
::
string
separator
)
{
int
verbose
=
1
;
// NPOptionManager::getInstance()->GetVerboseLevel();
std
::
stringstream
iss
(
GetValue
(
Token
));
...
...
@@ -397,6 +413,9 @@ void NPL::InputParser::TreatAliases() {
name
+=
alias
[
i
]
->
GetMainValue
();
std
::
string
action
=
alias
[
i
]
->
GetString
(
"Action"
);
std
::
vector
<
std
::
string
>
value
=
alias
[
i
]
->
GetVectorString
(
"Value"
);
if
(
value
[
0
].
find
(
"("
)
!=
std
::
string
::
npos
)
value
=
alias
[
i
]
->
GetVectorList
(
"Value"
);
if
(
action
==
"Replace"
&&
value
.
size
()
!=
1
)
NPL
::
SendErrorAndExit
(
"NPL::InputParser"
,
"Inplace alias can only take one value"
);
...
...
This diff is collapsed.
Click to expand it.
NPLib/Core/NPInputParser.h
+
2
−
1
View file @
c409cda1
...
...
@@ -80,7 +80,8 @@ namespace NPL {
TVector3
GetTVector3
(
std
::
string
Token
,
std
::
string
default_unit
);
std
::
vector
<
double
>
GetVectorDouble
(
std
::
string
Token
,
std
::
string
default_unit
);
std
::
vector
<
int
>
GetVectorInt
(
std
::
string
Token
);
std
::
vector
<
std
::
string
>
GetVectorString
(
std
::
string
Token
);
std
::
vector
<
std
::
string
>
GetVectorString
(
std
::
string
Token
,
std
::
string
separator
=
" "
);
std
::
vector
<
std
::
string
>
GetVectorList
(
std
::
string
Token
,
std
::
string
separator
=
" "
);
std
::
vector
<
NPL
::
InputBlock
*>
GetSubBlock
(
std
::
string
Token
);
std
::
vector
<
std
::
string
>
GetLines
()
{
return
m_Lines
;
};
...
...
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