Skip to content
Snippets Groups Projects
Commit 98dac179 authored by vargheseg's avatar vargheseg
Browse files

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
No related tags found
No related merge requests found
......@@ -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;
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment