Kigs Framework
Doc version 0.8
Open source multi purpose Rapid Application Development framework
|
#include <InstanceFactory.h>
Classes | |
class | ModuleAssociation |
Utility class to store "createInstance" method for each class of a module. More... | |
Public Member Functions | |
InstanceFactory (KigsCore *core) | |
constructor More... | |
CoreModifiable * | GetInstance (const std::string &instancename, const KigsID &classname, std::vector< CoreModifiableAttribute * > *args=nullptr) |
create an instance with the given name of the given class type More... | |
void | RegisterClass (createMethod method, const KigsID &className, const std::string &moduleName) |
register a new class in the instance factory More... | |
bool | GetModuleIDFromClassName (const KigsID &className, KigsID &ModuleID) |
create an instance of the given class type with the given instance name More... | |
const kigs::unordered_map< KigsID, ModuleAssociation > & | GetModuleList () |
get the registered module list | |
Protected Attributes | |
KigsCore * | mCore |
pointer on core module singleton | |
kigs::unordered_map< KigsID, ModuleAssociation > | mModuleList |
map of registered modules | |
register and instanciate classes
InstanceFactory::InstanceFactory | ( | KigsCore * | core | ) |
constructor
core | : instance of Core |
CoreModifiable * InstanceFactory::GetInstance | ( | const std::string & | instancename, |
const KigsID & | classname, | ||
std::vector< CoreModifiableAttribute * > * | args = nullptr |
||
) |
create an instance with the given name of the given class type
create an instance of the given class type with the given instance name
instancename | : name of the new instance |
classname | : class of the new instance |
for each module try to find the class type
if class type is found then return a new instance
no corresponding class was found, return 0
bool InstanceFactory::GetModuleIDFromClassName | ( | const KigsID & | className, |
KigsID & | ModuleID | ||
) |
create an instance of the given class type with the given instance name
for each module try to find the class type
no corresponding class was found, return false and empty string
void InstanceFactory::RegisterClass | ( | createMethod | method, |
const KigsID & | className, | ||
const std::string & | moduleName | ||
) |
register a new class in the instance factory
register a new class to instance factory
method | : create method of the class |
className | : class to register |
moduleName | : name of the module which contain the class |