Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Macros
Public Member Functions | List of all members
Factory< T > Class Template Reference

Factory template to generate class (or a sub-class) object based on id. More...

#include <factory.h>

Public Member Functions

void Register (const std::string &id, const std::function< T *(void)> &func)
 Register functions to create user defined classes. More...
 
void Register (int id, const std::function< T *(void)> &func)
 Register functions to create user defined classes. More...
 
T * Create (const std::string &id)
 create an instance by providing its id More...
 
T * Create (int id)
 create an instance by providing its id More...
 

Detailed Description

template<typename T>
class Factory< T >

Factory template to generate class (or a sub-class) object based on id.

  1. register class creation function that generates a class object based on id.
  2. call Create() func to call the creation function and return a pointer to the base calss.

Member Function Documentation

template<typename T >
T* Factory< T >::Create ( const std::string &  id)
inline

create an instance by providing its id

Parameters
id
template<typename T >
T* Factory< T >::Create ( int  id)
inline

create an instance by providing its id

Parameters
id
template<typename T >
void Factory< T >::Register ( const std::string &  id,
const std::function< T *(void)> &  func 
)
inline

Register functions to create user defined classes.

This function is called by the REGISTER_FACTORY macro.

Parameters
idIdentifier of the creating function/class
funca function that creates a layer instance
template<typename T >
void Factory< T >::Register ( int  id,
const std::function< T *(void)> &  func 
)
inline

Register functions to create user defined classes.

This function is called by the REGISTER_FACTORY macro.

Parameters
idIdentifier of the creating function/class
funca function that creates a layer instance

The documentation for this class was generated from the following file: