mxnet
Public Member Functions | Static Public Member Functions | List of all members
dmlc::Registry< EntryType > Class Template Reference

Registry class. Registry can be used to register global singletons. The most commonly use case are factory functions. More...

#include <registry.h>

Collaboration diagram for dmlc::Registry< EntryType >:
Collaboration graph

Public Member Functions

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 Public Member Functions

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 RegistryGet ()
 get a singleton of the Registry. This function can be defined by DMLC_REGISTRY_ENABLE. More...
 

Detailed Description

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
EntryTypeType of Registry entries, EntryType need to name a name field.

Member Function Documentation

template<typename EntryType >
EntryType& dmlc::Registry< EntryType >::__REGISTER__ ( const std::string &  name)
inline

Internal function to register a name function under name.

Parameters
namename of the function
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
namename of the function
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_nameThe original entry key
aliasThe alias key.
template<typename EntryType >
static const EntryType* dmlc::Registry< EntryType >::Find ( const std::string &  name)
inlinestatic

Find the entry with corresponding name.

Parameters
namename of the function
Returns
the corresponding function, can be NULL
template<typename EntryType >
static Registry* dmlc::Registry< EntryType >::Get ( )
static

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: