souffle  2.0.2-371-g6315b36
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Member Functions
souffle::ProgramFactory Class Referenceabstract

Abstract program factory class. More...

#include <SouffleInterface.h>

Collaboration diagram for souffle::ProgramFactory:
Collaboration graph

Public Member Functions

virtual ~ProgramFactory ()=default
 Destructor. More...
 

Static Public Member Functions

static SouffleProgramnewInstance (const std::string &name)
 Create an instance by finding the name of the program factory, return nullptr if the instance not found. More...
 

Protected Member Functions

virtual SouffleProgramnewInstance ()=0
 Create new instance (abstract). More...
 
 ProgramFactory (std::string name)
 Constructor. More...
 

Static Protected Member Functions

static ProgramFactoryfind (const std::string &factoryName)
 Find a factory by its name, return the fatory if found, return nullptr if the factory not found. More...
 
static void registerFactory (ProgramFactory *factory)
 Create and insert a factory into the factoryReg map. More...
 

Protected Attributes

ProgramFactorylink = nullptr
 Singly linked-list to store all program factories Note that STL data-structures are not possible due to "static initialization order fiasco (problem)". More...
 
std::string name
 The name of factory. More...
 

Static Private Member Functions

static std::map< std::string, ProgramFactory * > & getFactoryRegistry ()
 Helper method for creating a factory map, which map key is the name of the program factory, map value is the pointer of the ProgramFactory. More...
 

Detailed Description

Abstract program factory class.

Definition at line 1006 of file SouffleInterface.h.

Constructor & Destructor Documentation

◆ ProgramFactory()

souffle::ProgramFactory::ProgramFactory ( std::string  name)
inlineprotected

Constructor.

Constructor adds factory to static singly-linked list for registration.

Definition at line 1032 of file SouffleInterface.h.

1035  : Improve documentation of use and interaction between inline and static, here and for

◆ ~ProgramFactory()

virtual souffle::ProgramFactory::~ProgramFactory ( )
virtualdefault

Destructor.

Destructor of ProgramFactory.

Member Function Documentation

◆ find()

static ProgramFactory* souffle::ProgramFactory::find ( const std::string &  factoryName)
inlinestaticprotected

Find a factory by its name, return the fatory if found, return nullptr if the factory not found.

Parameters
factoryNameThe factory name (const std::string)
Returns
The pointer of the target program factory, or null pointer if the program factory not found (ProgramFactory*)

Definition at line 1071 of file SouffleInterface.h.

1076  :
1077  /**

References name, and newInstance().

Here is the call graph for this function:

◆ getFactoryRegistry()

static std::map<std::string, ProgramFactory*>& souffle::ProgramFactory::getFactoryRegistry ( )
inlinestaticprivate

Helper method for creating a factory map, which map key is the name of the program factory, map value is the pointer of the ProgramFactory.

TODO (NubKel) : Improve documentation of use and interaction between inline and static, here and for the whole class.

Returns
The factory registration map (std::map)

Definition at line 1046 of file SouffleInterface.h.

1051  {

References name.

Referenced by registerFactory().

◆ newInstance() [1/2]

virtual SouffleProgram* souffle::ProgramFactory::newInstance ( )
protectedpure virtual

Create new instance (abstract).

Referenced by find(), and newInstance().

◆ newInstance() [2/2]

static SouffleProgram* souffle::ProgramFactory::newInstance ( const std::string &  name)
inlinestatic

Create an instance by finding the name of the program factory, return nullptr if the instance not found.

Parameters
nameInstance name (const std::string)
Returns
The new instance(SouffleProgram*), or null pointer if the instance not found

Definition at line 1097 of file SouffleInterface.h.

◆ registerFactory()

static void souffle::ProgramFactory::registerFactory ( ProgramFactory factory)
inlinestaticprotected

Create and insert a factory into the factoryReg map.

Parameters
factoryPointer of the program factory (ProgramFactory*)

Definition at line 1057 of file SouffleInterface.h.

References getFactoryRegistry().

Here is the call graph for this function:

Field Documentation

◆ link

ProgramFactory* souffle::ProgramFactory::link = nullptr
protected

Singly linked-list to store all program factories Note that STL data-structures are not possible due to "static initialization order fiasco (problem)".

(The problem of the order static objects get initialized, causing effect such as program access static variables before they initialized.) The static container needs to be a primitive type such as pointer set to NULL. Link to next factory.

Definition at line 1018 of file SouffleInterface.h.

◆ name

std::string souffle::ProgramFactory::name
protected

The name of factory.

Definition at line 1023 of file SouffleInterface.h.

Referenced by find(), and getFactoryRegistry().


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