Apache SINGA
A distributed deep learning platform .
 All Classes Namespaces Files Functions Variables Typedefs Enumerator 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, std::function< T *(void)> func)
 Register functions to create user defined classes. More...
 
T * Create (const std::string id)
 create a layer instance by providing its type 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)

create a layer instance by providing its type

Parameters
typethe identifier of the layer to be created
template<typename T >
void Factory< T >::Register ( const std::string  id,
std::function< T *(void)>  func 
)

Register functions to create user defined classes.

This function is called by the REGISTER_FACTORY macro.

Parameters
ididentifier of the creating function/class
create_functiona function that creates a layer instance

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