Skip to content
Snippets Groups Projects
Commit 9cae2888 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

allow exact name specification for container type

parent 936e89a7
No related branches found
No related tags found
No related merge requests found
...@@ -39,22 +39,27 @@ class ContainerRegistry { ...@@ -39,22 +39,27 @@ class ContainerRegistry {
static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups; static ext::map < std::string, ext::vector < ext::pair < std::string, std::shared_ptr < Entry > > > > containerGroups;
return containerGroups; return containerGroups;
}; };
public: public:
template < class ParamTypes > template < class ParamTypes >
static void registerSet ( ) { static void registerSet ( std::string param ) {
std::string container = "Set"; std::string container = "Set";
   
std::string paramName = ext::to_string < typename std::decay < ParamTypes >::type > ( );
auto & group = getEntries ( ) [ container ]; auto & group = getEntries ( ) [ container ];
for ( const ext::pair < std::string, std::shared_ptr < Entry > > & entry : group ) 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." ); throw exception::CommonException ( "Callback for " + container + " already registered." );
   
std::shared_ptr < Entry > entryValue = std::make_shared < SetEntryImpl < ParamTypes > > ( ); 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 bool hasAbstraction ( const std::string & container );
   
static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & container, const std::string & paramType ); static std::shared_ptr < abstraction::OperationAbstraction > getAbstraction ( const std::string & container, const std::string & paramType );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment