Computer Assited Medical Intervention Tool Kit  version 4.1
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | List of all members
SimulatorFactory Class Reference

A factory to create Simulator. More...

#include <SimulatorFactory.h>

Public Member Functions

SimulatorcreateSimulator (std::string id, MonitoringManager *monitoringManager)
 Creates a Simulator based on its string id or return null if there is no id in the map. More...
 
SimulatorcreateSimulator (std::string id, MonitoringManager *monitoringManager, const char *file)
 Creates a Simulator using a specific simulator file based on its string id or return null if there is no id in the map. More...
 
std::string getInteractiveSimulator (const unsigned int index)
 get a interactive simulator name by its index More...
 
std::string getNonInteractiveSimulator (const unsigned int index)
 get a non interactive simulator name by its index More...
 
int getNumberOfInteractiveSimulators ()
 give the number of interactive simulators registered More...
 
int getNumberOfNonInteractiveSimulators ()
 give the number of interactive simulators registered More...
 
bool isInteractive (std::string id)
 return true if the registered simulator id is interactive More...
 
bool isRegistered (std::string id)
 Returns true if id is in the map. More...
 
template<typename C >
bool registerClass (std::string id, bool isInteractive)
 Register a class into the map A registered class can be created using createMonitorDisplay() More...
 

Static Public Member Functions

static SimulatorFactorygetInstance ()
 return the unique instance of the factory More...
 

Private Types

typedef Simulator *(* CreateSimulatorFunctionPointer) (MonitoringManager *monitoringManager)
 
typedef Simulator *(* CreateSimulatorFunctionPointer2) (MonitoringManager *monitoringManager, const char *file)
 

Private Member Functions

 SimulatorFactory ()=default
 

Static Private Member Functions

template<typename C >
static SimulatorcreateTheSimulator (MonitoringManager *monitoringManager)
 map the simulator name with the 1 parameter constructor. More...
 
template<typename C >
static SimulatorcreateTheSimulator2 (MonitoringManager *monitoringManager, const char *file)
 map the simulator name with the 2 parameters constructor (using the given specific simulator file) More...
 

Private Attributes

std::vector< std::string > interactiveSimulators
 list of interactive simulators More...
 
std::map< std::string, bool > mapInteractive
 map between Simulator name as string to booleen, true if interactive More...
 
std::map< std::string, CreateSimulatorFunctionPointermapObjectCreator
 A map between Simulator name as string to functions. More...
 
std::map< std::string, CreateSimulatorFunctionPointer2mapObjectCreator2
 A map between Simulator name as string to functions (for the 2nd constructor that uses a simulator file) More...
 
std::vector< std::string > nonInteractiveSimulators
 list of non interactive simulators More...
 

Static Private Attributes

static SimulatorFactoryinstance = nullptr
 unique instance of the factory More...
 

Detailed Description

A factory to create Simulator.

Member Typedef Documentation

◆ CreateSimulatorFunctionPointer

typedef Simulator*(* SimulatorFactory::CreateSimulatorFunctionPointer) (MonitoringManager *monitoringManager)
private

◆ CreateSimulatorFunctionPointer2

typedef Simulator*(* SimulatorFactory::CreateSimulatorFunctionPointer2) (MonitoringManager *monitoringManager, const char *file)
private

Constructor & Destructor Documentation

◆ SimulatorFactory()

SimulatorFactory::SimulatorFactory ( )
privatedefault

Referenced by getInstance().

Member Function Documentation

◆ createSimulator() [1/2]

Simulator * SimulatorFactory::createSimulator ( std::string  id,
MonitoringManager monitoringManager 
)

Creates a Simulator based on its string id or return null if there is no id in the map.

References mapObjectCreator.

Referenced by MonitoringManager::buildPmlAndSimulatorfromPml(), and MonitoringManager::buildPmlAndSimulatorfromSimulator().

◆ createSimulator() [2/2]

Simulator * SimulatorFactory::createSimulator ( std::string  id,
MonitoringManager monitoringManager,
const char *  file 
)

Creates a Simulator using a specific simulator file based on its string id or return null if there is no id in the map.

References mapObjectCreator2.

◆ createTheSimulator()

template<typename C >
static Simulator* SimulatorFactory::createTheSimulator ( MonitoringManager monitoringManager)
inlinestaticprivate

map the simulator name with the 1 parameter constructor.

function whose pointers are inserted into the map

Parameters
Ctype of Simulator
Returns
an MonitorDisplay which type is C

◆ createTheSimulator2()

template<typename C >
static Simulator* SimulatorFactory::createTheSimulator2 ( MonitoringManager monitoringManager,
const char *  file 
)
inlinestaticprivate

map the simulator name with the 2 parameters constructor (using the given specific simulator file)

function whose pointers are inserted into the map

Parameters
Ctype of Simulator
filespecific simulator file
Returns
an MonitorDisplay which type is C

◆ getInstance()

SimulatorFactory * SimulatorFactory::getInstance ( )
static

◆ getInteractiveSimulator()

std::string SimulatorFactory::getInteractiveSimulator ( const unsigned int  index)

get a interactive simulator name by its index

References interactiveSimulators.

◆ getNonInteractiveSimulator()

std::string SimulatorFactory::getNonInteractiveSimulator ( const unsigned int  index)

get a non interactive simulator name by its index

References nonInteractiveSimulators.

◆ getNumberOfInteractiveSimulators()

int SimulatorFactory::getNumberOfInteractiveSimulators ( )

give the number of interactive simulators registered

References interactiveSimulators.

◆ getNumberOfNonInteractiveSimulators()

int SimulatorFactory::getNumberOfNonInteractiveSimulators ( )

give the number of interactive simulators registered

References nonInteractiveSimulators.

◆ isInteractive()

bool SimulatorFactory::isInteractive ( std::string  id)

return true if the registered simulator id is interactive

References mapInteractive.

Referenced by MonitoringManagerFactory::createManager().

◆ isRegistered()

bool SimulatorFactory::isRegistered ( std::string  id)

Returns true if id is in the map.

References mapObjectCreator.

Referenced by MonitoringManagerFactory::createManager().

◆ registerClass()

template<typename C >
bool SimulatorFactory::registerClass ( std::string  id,
bool  isInteractive 
)
inline

Register a class into the map A registered class can be created using createMonitorDisplay()

Parameters
Ca subclass of Simulator
idunique id to associate with the Class C

Member Data Documentation

◆ instance

SimulatorFactory * SimulatorFactory::instance = nullptr
staticprivate

unique instance of the factory

Referenced by getInstance().

◆ interactiveSimulators

std::vector<std::string> SimulatorFactory::interactiveSimulators
private

list of interactive simulators

Referenced by getInteractiveSimulator(), and getNumberOfInteractiveSimulators().

◆ mapInteractive

std::map<std::string, bool> SimulatorFactory::mapInteractive
private

map between Simulator name as string to booleen, true if interactive

Referenced by isInteractive().

◆ mapObjectCreator

std::map<std::string, CreateSimulatorFunctionPointer> SimulatorFactory::mapObjectCreator
private

A map between Simulator name as string to functions.

Referenced by createSimulator(), and isRegistered().

◆ mapObjectCreator2

std::map<std::string, CreateSimulatorFunctionPointer2> SimulatorFactory::mapObjectCreator2
private

A map between Simulator name as string to functions (for the 2nd constructor that uses a simulator file)

Referenced by createSimulator().

◆ nonInteractiveSimulators

std::vector<std::string> SimulatorFactory::nonInteractiveSimulators
private

list of non interactive simulators

Referenced by getNonInteractiveSimulator(), and getNumberOfNonInteractiveSimulators().


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