A template class that allows one to register classes by keys. More...
#include <registry.h>
Public Types | |
typedef std::function< std::unique_ptr< ObjectType >Args ...)> | Creator |
Public Member Functions | |
void | Register (const SrcType &key, Creator creator) |
void | Register (const SrcType &key, Creator creator, const string &help_msg) |
bool | Has (const SrcType &key) |
unique_ptr< ObjectType > | Create (const SrcType &key, Args ... args) |
vector< SrcType > | Keys () |
Returns the keys currently registered as a vector. | |
const CaffeMap< SrcType, string > & | HelpMessage () const |
const char * | HelpMessage (const SrcType &key) const |
A template class that allows one to register classes by keys.
The keys are usually a string specifying the name, but can be anything that can be used in a std::map.
You should most likely not use the Registry class explicitly, but use the helper macros below to declare specific registries as well as registering objects.
Definition at line 31 of file registry.h.