Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Corryvreckan
Corryvreckan
Commits
57010d5f
Commit
57010d5f
authored
Apr 20, 2018
by
Simon Spannagel
Browse files
Configuration: allow default value in getMatrix call
parent
4dc8e546
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/core/config/Configuration.hpp
View file @
57010d5f
...
...
@@ -102,6 +102,14 @@ namespace corryvreckan {
*/
template
<
typename
T
>
Matrix
<
T
>
getMatrix
(
const
std
::
string
&
key
)
const
;
/**
* @brief Get values for a key containing a 2D matrix
* @param key Key to get values of
* @param def Default value matrix to use if key is not defined
* @return Matrix of values from the requested template parameter
*/
template
<
typename
T
>
Matrix
<
T
>
getMatrix
(
const
std
::
string
&
key
,
const
Matrix
<
T
>
def
)
const
;
/**
* @brief Get literal value of a key as string
* @param key Key to get values of
...
...
src/core/config/Configuration.tpp
View file @
57010d5f
...
...
@@ -115,6 +115,17 @@ namespace corryvreckan {
}
}
/**
* @throws InvalidKeyError If the conversion to the requested type did not succeed
* @throws InvalidKeyError If an overflow happened while converting the key
*/
template
<
typename
T
>
Matrix
<
T
>
Configuration
::
getMatrix
(
const
std
::
string
&
key
,
const
Matrix
<
T
>
def
)
const
{
if
(
has
(
key
))
{
return
getMatrix
<
T
>
(
key
);
}
return
def
;
}
template
<
typename
T
>
void
Configuration
::
set
(
const
std
::
string
&
key
,
const
T
&
val
)
{
config_
[
key
]
=
corryvreckan
::
to_string
(
val
);
}
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment