Medial Code Documentation
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions
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>

Public Member Functions

void AddAlias (const std::string &key_name, const std::string &alias)
 Add alias to the key_name.
 
EntryType & __REGISTER__ (const std::string &name)
 Internal function to register a name function under name.
 
EntryType & __REGISTER_OR_GET__ (const std::string &name)
 Internal function to either register or get registered entry.
 

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

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

◆ __REGISTER__()

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

◆ __REGISTER_OR_GET__()

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

◆ AddAlias()

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.

◆ Find()

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

◆ Get()

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

◆ List()

template<typename EntryType >
static const std::vector< const EntryType * > & dmlc::Registry< EntryType >::List ( )
inlinestatic
Returns
list of entries in the registry(excluding alias)

◆ ListAllNames()

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: