Registry class. Registry can be used to register global singletons. The most commonly use case are factory functions.
More...
#include <registry.h>
|
void | AddAlias (const std::string &key_name, const std::string &alias) |
| Add alias to the key_name. More...
|
|
EntryType & | __REGISTER__ (const std::string &name) |
| Internal function to register a name function under name. More...
|
|
EntryType & | __REGISTER_OR_GET__ (const std::string &name) |
| Internal function to either register or get registered entry. More...
|
|
|
static const std::vector< const EntryType * > & | List () |
|
static std::vector< std::string > | ListAllNames () |
|
static const EntryType * | Find (const std::string &name) |
| Find the entry with corresponding name. More...
|
|
static Registry * | Get () |
| get a singleton of the Registry. This function can be defined by DMLC_REGISTRY_ENABLE. More...
|
|
template<typename EntryType>
class dmlc::Registry< EntryType >
Registry class. Registry can be used to register global singletons. The most commonly use case are factory functions.
- Template Parameters
-
EntryType | Type of Registry entries, EntryType need to name a name field. |
template<typename EntryType >
EntryType& dmlc::Registry< EntryType >::__REGISTER__ |
( |
const std::string & |
name | ) |
|
|
inline |
Internal function to register a name function under name.
- Parameters
-
- Returns
- ref to the registered entry, used to set properties
template<typename EntryType >
EntryType& dmlc::Registry< EntryType >::__REGISTER_OR_GET__ |
( |
const std::string & |
name | ) |
|
|
inline |
Internal function to either register or get registered entry.
- Parameters
-
- Returns
- ref to the registered entry, used to set properties
template<typename EntryType >
void dmlc::Registry< EntryType >::AddAlias |
( |
const std::string & |
key_name, |
|
|
const std::string & |
alias |
|
) |
| |
|
inline |
Add alias to the key_name.
- Parameters
-
key_name | The original entry key |
alias | The alias key. |
template<typename EntryType >
static const EntryType* dmlc::Registry< EntryType >::Find |
( |
const std::string & |
name | ) |
|
|
inlinestatic |
Find the entry with corresponding name.
- Parameters
-
- Returns
- the corresponding function, can be NULL
template<typename EntryType >
get a singleton of the Registry. This function can be defined by DMLC_REGISTRY_ENABLE.
- Returns
- get a singleton
template<typename EntryType >
static const std::vector<const EntryType*>& dmlc::Registry< EntryType >::List |
( |
| ) |
|
|
inlinestatic |
- Returns
- list of entries in the registry(excluding alias)
template<typename EntryType >
static std::vector<std::string> dmlc::Registry< EntryType >::ListAllNames |
( |
| ) |
|
|
inlinestatic |
- Returns
- list all names registered in the registry, including alias
The documentation for this class was generated from the following file:
- /work/mxnet/3rdparty/dmlc-core/include/dmlc/registry.h