diff --git a/alib2common/src/abstraction/ContainerRegistry.hpp b/alib2common/src/abstraction/ContainerRegistry.hpp index 74c286a14716003679105feb249b8d9d469df044..9a2d3b7a54176481debaf8172be352a205bd5738 100644 --- a/alib2common/src/abstraction/ContainerRegistry.hpp +++ b/alib2common/src/abstraction/ContainerRegistry.hpp @@ -39,22 +39,27 @@ class ContainerRegistry { static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups; return containerGroups; }; + public: template < class ParamTypes > - static void registerSet ( ) { + static void registerSet ( std::string param ) { std::string container = "Set"; - std::string paramName = ext::to_string < typename std::decay < ParamTypes >::type > ( ); - auto & group = getEntries ( ) [ container ]; for ( const ext::pair < std::string, std::shared_ptr < Entry > > & entry : group ) - if ( entry.first == paramName ) + if ( entry.first == param ) throw exception::CommonException ( "Callback for " + container + " already registered." ); std::shared_ptr < Entry > entryValue = std::make_shared < SetEntryImpl < ParamTypes > > ( ); - group.push_back ( ext::make_pair ( paramName, entryValue ) ); + group.push_back ( ext::make_pair ( param, entryValue ) ); + } + + template < class ParamTypes > + static void registerSet ( ) { + std::string param = ext::to_string < typename std::decay < ParamTypes >::type > ( ); + registerSet < ParamTypes > ( param ); } - + static bool hasAbstraction ( const std::string & container ); static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & container, const std::string & paramType );