Atoms Crowd  7.0.0
Atoms::BehaviourModules Class Reference

Behaviour module factory. More...

#include <BehaviourModules.h>

Public Types

enum  ModuleType { kNone = -1 , kNative = 0 , kScript = 1 }
 
typedef BehaviourModule *(* creatorFn) (const std::string &parameter)
 

Public Member Functions

AtomsPtr< BehaviourModulecreateBehaviourModule (const std::string &name)
 Creates a behaviour module. More...
 
BehaviourModulecreateBehaviourModuleRawPtr (const std::string &name)
 Creates a behaviour module. More...
 
bool registerBehaviourModule (const std::string &moduleName, creatorFn func, unsigned int moduleType=kNative, bool replace=false, const std::string category="")
 Registers a behaviour module in the factory. More...
 
bool deregisterBehaviourModule (const std::string &name)
 Deregisters a Behaviour module type from the factory. More...
 
std::vector< std::string > getRegisteredBehaviourModules ()
 Gets all registered behaviour modules. More...
 
const std::string getBehaviourModuleCategory (const std::string &moduleName)
 Gets a registered behaviour category. More...
 
bool isRegistered (const std::string &name)
 Check if a behaviour module is registered. More...
 
void clear ()
 Clear factory.
 
short moduleType (const std::string &name)
 Gets the module type.
 

Static Public Member Functions

static BehaviourModulesinstance ()
 Singleton access.
 

Detailed Description

Behaviour module factory.

Factory used to create Behaviour modules.

Member Function Documentation

◆ createBehaviourModule()

AtomsPtr<BehaviourModule> Atoms::BehaviourModules::createBehaviourModule ( const std::string &  name)

Creates a behaviour module.

Parameters
namebehaviour module type name
Returns
Smart pointer to the behaviour module created

◆ createBehaviourModuleRawPtr()

BehaviourModule* Atoms::BehaviourModules::createBehaviourModuleRawPtr ( const std::string &  name)

Creates a behaviour module.

Parameters
namebehaviour module type name
Returns
Raw pointer to the behaviour module created

◆ deregisterBehaviourModule()

bool Atoms::BehaviourModules::deregisterBehaviourModule ( const std::string &  name)

Deregisters a Behaviour module type from the factory.

Parameters
nameBehaviour module name
Returns
True if the module is removed from the map

◆ getBehaviourModuleCategory()

const std::string Atoms::BehaviourModules::getBehaviourModuleCategory ( const std::string &  moduleName)

Gets a registered behaviour category.

Returns
String representing the module category, the string will be empty if this module has no category

◆ getRegisteredBehaviourModules()

std::vector<std::string> Atoms::BehaviourModules::getRegisteredBehaviourModules ( )

Gets all registered behaviour modules.

Returns
List of all behaviour module registered

◆ isRegistered()

bool Atoms::BehaviourModules::isRegistered ( const std::string &  name)

Check if a behaviour module is registered.

Parameters
nameBehaviour module name
Returns
Return true if the behaviour module is already registered

◆ registerBehaviourModule()

bool Atoms::BehaviourModules::registerBehaviourModule ( const std::string &  moduleName,
creatorFn  func,
unsigned int  moduleType = kNative,
bool  replace = false,
const std::string  category = "" 
)

Registers a behaviour module in the factory.

Parameters
nameBehavioir module name
funccreator function
replaceReplace module if it already exists
Returns
True if the module is added to the map

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