Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ApplicationCore
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
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
ChimeraTK Mirror
ApplicationCore
Commits
98dac179
Commit
98dac179
authored
5 years ago
by
vargheseg
Browse files
Options
Downloads
Patches
Plain Diff
MapOfVar, MapOfArray use unordered map. Previously were std::map; made
the swicth because order is not important for these.
parent
8c20fe7a
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
Modules/include/ConfigReader.h
+3
-2
3 additions, 2 deletions
Modules/include/ConfigReader.h
Modules/src/ConfigReader.cc
+6
-6
6 additions, 6 deletions
Modules/src/ConfigReader.cc
with
9 additions
and
8 deletions
Modules/include/ConfigReader.h
+
3
−
2
View file @
98dac179
...
...
@@ -2,6 +2,7 @@
#define CHIMERATK_APPLICATION_CORE_CONFIG_READER_H
#include
<map>
#include
<unordered_map>
#include
<ChimeraTK/SupportedUserTypes.h>
...
...
@@ -99,7 +100,7 @@ namespace ChimeraTK {
/** Define type for map of std::string to Var, so we can put it into the
* TemplateUserTypeMap */
template
<
typename
T
>
using
MapOfVar
=
std
::
map
<
std
::
string
,
Var
<
T
>>
;
using
MapOfVar
=
std
::
unordered_
map
<
std
::
string
,
Var
<
T
>>
;
/** Type-depending map of vectors of variables */
ChimeraTK
::
TemplateUserTypeMap
<
MapOfVar
>
variableMap
;
...
...
@@ -107,7 +108,7 @@ namespace ChimeraTK {
/** Define type for map of std::string to Array, so we can put it into the
* TemplateUserTypeMap */
template
<
typename
T
>
using
MapOfArray
=
std
::
map
<
std
::
string
,
Array
<
T
>>
;
using
MapOfArray
=
std
::
unordered_
map
<
std
::
string
,
Array
<
T
>>
;
/** Type-depending map of vectors of arrays */
ChimeraTK
::
TemplateUserTypeMap
<
MapOfArray
>
arrayMap
;
...
...
This diff is collapsed.
Click to expand it.
Modules/src/ConfigReader.cc
+
6
−
6
View file @
98dac179
...
...
@@ -150,7 +150,7 @@ struct FunctorFill {
auto
varOwner
=
_moduleList
->
lookup
(
moduleName
);
// place the variable onto the vector
std
::
map
<
std
::
string
,
ConfigReader
::
Var
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
variableMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Var
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
variableMap
.
table
);
theMap
.
emplace
(
std
::
make_pair
(
name
,
ConfigReader
::
Var
<
T
>
(
varOwner
,
varName
,
convertedValue
)));
}
...
...
@@ -164,7 +164,7 @@ struct FunctorFill {
auto
varOwner
=
_moduleList
->
lookup
(
moduleName
);
// place the variable onto the vector
std
::
map
<
std
::
string
,
ConfigReader
::
Var
<
std
::
string
>>&
theMap
=
boost
::
fusion
::
at_key
<
std
::
string
>
(
variableMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Var
<
std
::
string
>>&
theMap
=
boost
::
fusion
::
at_key
<
std
::
string
>
(
variableMap
.
table
);
theMap
.
emplace
(
std
::
make_pair
(
name
,
ConfigReader
::
Var
<
std
::
string
>
(
varOwner
,
varName
,
value
)));
}
...
...
@@ -208,7 +208,7 @@ struct FunctorFill {
auto
arrayOwner
=
_moduleList
->
lookup
(
moduleName
);
// place the variable onto the vector
std
::
map
<
std
::
string
,
ConfigReader
::
Array
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
arrayMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Array
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
arrayMap
.
table
);
theMap
.
emplace
(
std
::
make_pair
(
name
,
ConfigReader
::
Array
<
T
>
(
arrayOwner
,
arrayName
,
Tvalues
)));
}
...
...
@@ -238,7 +238,7 @@ struct FunctorFill {
auto
arrayOwner
=
_moduleList
->
lookup
(
moduleName
);
// place the variable onto the vector
std
::
map
<
std
::
string
,
ConfigReader
::
Array
<
std
::
string
>>&
theMap
=
boost
::
fusion
::
at_key
<
std
::
string
>
(
arrayMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Array
<
std
::
string
>>&
theMap
=
boost
::
fusion
::
at_key
<
std
::
string
>
(
arrayMap
.
table
);
theMap
.
emplace
(
std
::
make_pair
(
name
,
ConfigReader
::
Array
<
std
::
string
>
(
arrayOwner
,
arrayName
,
Tvalues
)));
}
...
...
@@ -301,7 +301,7 @@ struct FunctorFill {
void
operator
()(
PAIR
&
)
const
{
// get user type and vector
typedef
typename
PAIR
::
first_type
T
;
std
::
map
<
std
::
string
,
ConfigReader
::
Var
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
_owner
->
variableMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Var
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
_owner
->
variableMap
.
table
);
// iterate vector and set values
for
(
auto
&
pair
:
theMap
)
{
...
...
@@ -324,7 +324,7 @@ struct FunctorFill {
void
operator
()(
PAIR
&
)
const
{
// get user type and vector
typedef
typename
PAIR
::
first_type
T
;
std
::
map
<
std
::
string
,
ConfigReader
::
Array
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
_owner
->
arrayMap
.
table
);
std
::
unordered_
map
<
std
::
string
,
ConfigReader
::
Array
<
T
>>&
theMap
=
boost
::
fusion
::
at_key
<
T
>
(
_owner
->
arrayMap
.
table
);
// iterate vector and set values
for
(
auto
&
pair
:
theMap
)
{
...
...
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