Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ScalFMM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
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
solverstack
ScalFMM
Commits
f40a183f
Commit
f40a183f
authored
10 years ago
by
BRAMAS Berenger
Browse files
Options
Downloads
Patches
Plain Diff
ensure that if a parameter is set and the value is asked it is in the correct format
parent
9e588af4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Src/Utils/FParameters.hpp
+7
-0
7 additions, 0 deletions
Src/Utils/FParameters.hpp
with
7 additions
and
0 deletions
Src/Utils/FParameters.hpp
+
7
−
0
View file @
f40a183f
...
...
@@ -24,6 +24,8 @@
#include
<vector>
#include
"FAssert.hpp"
/** This file proposes some methods
* to work with user input parameters.
*/
...
...
@@ -44,6 +46,7 @@ namespace FParameters{
std
::
istringstream
iss
(
str
,
std
::
istringstream
::
in
);
VariableType
value
;
iss
>>
value
;
FAssertLF
(
iss
.
eof
());
if
(
/*iss.tellg()*/
iss
.
eof
()
)
return
value
;
return
defaultValue
;
}
...
...
@@ -103,6 +106,7 @@ namespace FParameters{
template
<
class
VariableType
>
inline
const
VariableType
getValue
(
const
int
argc
,
const
char
*
const
*
const
argv
,
const
char
*
const
inName
,
const
VariableType
&
defaultValue
=
VariableType
(),
const
bool
caseSensible
=
false
){
const
int
position
=
findParameter
(
argc
,
argv
,
inName
,
caseSensible
);
FAssertLF
(
position
==
NotFound
||
position
!=
argc
-
1
);
if
(
position
==
NotFound
||
position
==
argc
-
1
){
return
defaultValue
;
}
...
...
@@ -113,6 +117,7 @@ namespace FParameters{
*/
inline
const
char
*
getStr
(
const
int
argc
,
const
char
*
const
*
const
argv
,
const
char
*
const
inName
,
const
char
*
const
inDefault
,
const
bool
caseSensible
=
false
){
const
int
position
=
findParameter
(
argc
,
argv
,
inName
,
caseSensible
);
FAssertLF
(
position
==
NotFound
||
position
!=
argc
-
1
);
if
(
position
==
NotFound
||
position
==
argc
-
1
){
return
inDefault
;
}
...
...
@@ -154,6 +159,7 @@ namespace FParameters{
inline
const
VariableType
getValue
(
const
int
argc
,
const
char
*
const
*
const
argv
,
const
std
::
vector
<
const
char
*>&
inNames
,
const
VariableType
&
defaultValue
=
VariableType
(),
const
bool
caseSensible
=
false
){
for
(
const
char
*
name
:
inNames
){
const
int
position
=
findParameter
(
argc
,
argv
,
name
,
caseSensible
);
FAssertLF
(
position
==
NotFound
||
position
!=
argc
-
1
);
if
(
position
!=
NotFound
&&
position
!=
argc
-
1
){
return
StrToOther
(
argv
[
position
+
1
],
defaultValue
);
}
...
...
@@ -166,6 +172,7 @@ namespace FParameters{
inline
const
char
*
getStr
(
const
int
argc
,
const
char
*
const
*
const
argv
,
const
std
::
vector
<
const
char
*>&
inNames
,
const
char
*
const
inDefault
,
const
bool
caseSensible
=
false
){
for
(
const
char
*
name
:
inNames
){
const
int
position
=
findParameter
(
argc
,
argv
,
name
,
caseSensible
);
FAssertLF
(
position
==
NotFound
||
position
!=
argc
-
1
);
if
(
position
!=
NotFound
&&
position
!=
argc
-
1
){
return
argv
[
position
+
1
];
}
...
...
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