34 #include <Base/Common/BaseFactory.hh>
47 Base(
const string& name)
49 inline std::string GetTag()
const {
return Name_; }
50 void Who() { cout <<
"I am "<<Name_<<endl; }
60 static Base *Allocator() {
return dynamic_cast<Base *
>(
new A); }
70 static Base *Allocator() {
return dynamic_cast<Base *
>(
new B); }
80 static Base *Allocator() {
return dynamic_cast<Base *
>(
new C); }
93 #ifdef BIAS_BUILD_SHARED_LIBS
119 cerr <<
"could not generate class with name \"d\""<<endl;
void AddType(AllocatorFunctionPointer allocFunc)
This function is only meaningfull, when static libraries are used.
static BaseFactory< BaseClassType, TagType > * GetInstance()
BaseClassType * Generate(const TagType &tag)
function for generic class generation from
void Add2Directories(const std::string &directories)
This function only makes sense when shared libraries are used: Initialize the factory with ':' (linux...
simple factory class designed for usage as a singleton