C++ main module for stochmagnet Package  1.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
CORE_ClassFactory Class Reference

this class describes a class factory to generate classes More...

#include <CORE_ClassFactory.h>

Inheritance diagram for CORE_ClassFactory:
Inheritance graph
[legend]
Collaboration diagram for CORE_ClassFactory:
Collaboration graph
[legend]

Public Member Functions

virtual tMemSize getMemorySize () const override
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual tMemSize getContentsMemorySize () const override
 return the memory size in byte More...
 
void addClassFactory (CORE_UniquePointer< CORE_ClassFactory > child)
 add to class factory More...
 
void clearClassFactories ()
 clear the class factories list More...
 
virtual CORE_UniquePointer< CORE_ObjectNewInstance (const tString &name, const std::map< tString, tString > &arguments) const
 create an unique instance of a class as a general CORE_Object More...
 
CORE_UniquePointer< CORE_ObjectNewInstance (const tString &name) const
 create an unique instance of a class as a general CORE_Object More...
 
template<class T >
CORE_UniquePointer< T > NewUniqueInstance (const tString &name, const std::map< tString, tString > &arguments) const
 create an unique instance of a class T More...
 
template<class T >
CORE_UniquePointer< T > NewUniqueInstance (const tString &name) const
 create an unique instance of a class T with no arguments More...
 
template<class T >
CORE_SharedPointer< T > NewSharedInstance (const tString &name, const std::map< tString, tString > &arguments) const
 create a shared instance of a class More...
 
template<class T >
CORE_SharedPointer< T > NewSharedInstance (const tString &name) const
 create a shared instance of a class with no argument More...
 
template<class T >
CORE_SharedPointer< T > NewSharedInstance () const
 create a shared instance of a class with same type as T with no argument More...
 
template<class T >
CORE_SharedPointer< T > NewSharedInstance (const std::map< tString, tString > &arguments) const
 create a shared instance of a class with same type as T More...
 
virtual tString toString () const override
 get the string representation of the class More...
 
template<class T >
std::shared_ptr< T > getSharedPointer ()
 return the shared pointer for this More...
 
template<class T >
std::shared_ptr< const T > getConstSharedPointer () const
 return a const shared pointer for this More...
 
template<class T >
tBoolean isInstanceOf () const
 test if the clas T is an instance of this class More...
 
tString getClassName () const
 return the name of the class More...
 
tString getPointerString () const
 retrun the pointer of the class as a string More...
 
tString getIdentityString () const
 retrun the string identification of the class More...
 

Static Public Member Functions

static CORE_UniquePointer< CORE_ClassFactoryNew ()
 build a new instance of default class factory More...
 
template<class T >
static CORE_SharedPointer< T > NewSharedInstance (CORE_UniquePointer< T > &up)
 create a shared instance of an unique pointer More...
 
template<class T >
static CORE_SharedPointer< T > NewSharedInstance (CORE_UniquePointer< T > &&up)
 create a shared instance of an unique pointer as a lvalue More...
 
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack More...
 
static void DisableMemoryStack ()
 disable the memory stack More...
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled More...
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Protected Member Functions

 CORE_ClassFactory ()
 build a CORE_ClassFactory More...
 
virtual ~CORE_ClassFactory (void)
 destroy a CORE_ClassFactory More...
 

Private Member Functions

template<class T >
std::shared_ptr< T > setThis (std::unique_ptr< T, CORE_Object::Delete > &up)
 set the shared pointer from an unique pointer More...
 

Private Attributes

std::vector< CORE_UniquePointer< CORE_ClassFactory > > mFactoryClasses
 
std::weak_ptr< CORE_ObjectmThis
 

Detailed Description

this class describes a class factory to generate classes

Constructor & Destructor Documentation

◆ CORE_ClassFactory()

CORE_ClassFactory::CORE_ClassFactory ( )
protected

build a CORE_ClassFactory

Referenced by New().

Here is the caller graph for this function:

◆ ~CORE_ClassFactory()

CORE_ClassFactory::~CORE_ClassFactory ( void  )
protectedvirtual

destroy a CORE_ClassFactory

Member Function Documentation

◆ addClassFactory()

void CORE_ClassFactory::addClassFactory ( CORE_UniquePointer< CORE_ClassFactory child)
inline

add to class factory

Parameters
[in]childthe class factory to add

References mFactoryClasses.

Referenced by SM_Run::createClassFactories().

Here is the caller graph for this function:

◆ clearClassFactories()

void CORE_ClassFactory::clearClassFactories ( )
inline

clear the class factories list

References mFactoryClasses.

◆ DisableMemoryStack()

static void CORE_Object::DisableMemoryStack ( )
inlinestaticinherited

disable the memory stack

Referenced by CORE_Object::EnableMemoryStack().

Here is the caller graph for this function:

◆ EnableMemoryStack() [1/2]

static void CORE_Object::EnableMemoryStack ( )
inlinestaticinherited

enable the memory stack

Referenced by CORE_Object::EnableMemoryStack(), and CORE_Run::SetDebugOptions().

Here is the caller graph for this function:

◆ EnableMemoryStack() [2/2]

static tBoolean CORE_Object::EnableMemoryStack ( const tBoolean isMemoryChecked)
inlinestaticinherited

enable the memory stack

Parameters
[in]isMemoryChecked: true to verify memory allocation of CORE_Object classes
Returns
true if the memroy is checked

References CORE_Object::DisableMemoryStack(), CORE_Object::EnableMemoryStack(), and CORE_Object::IsMemoryStackEnabled().

Here is the call graph for this function:

◆ getClassName()

tString CORE_Object::getClassName ( ) const
inlineinherited

return the name of the class

Returns
the string name of the class

Referenced by CORE_Object::getIdentityString(), and CORE_Test::testTypes().

Here is the caller graph for this function:

◆ getConstSharedPointer()

template<class T >
std::shared_ptr<const T> CORE_Object::getConstSharedPointer ( ) const
inlineinherited

return a const shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ getContentsMemorySize()

virtual tMemSize CORE_ClassFactory::getContentsMemorySize ( ) const
inlineoverridevirtual

return the memory size in byte

Returns
the memory size of the storage in bytes 1 Kb = 1024 bytes 1 Mb = 1024 Kb 1 Gb = 1024 Mb 1 Tb = 1024 Gb 1 Hb = 1024 Tb

Reimplemented from CORE_Object.

References CORE_Object::getContentsMemorySize(), mFactoryClasses, and tMemSize.

Referenced by SM_ClassFactory::getMemorySize(), and getMemorySize().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getIdentityString()

tString CORE_Object::getIdentityString ( ) const
inlineinherited

retrun the string identification of the class

Returns
the string identity of the class

References CORE_Object::getClassName(), and core_functions::pointerToString().

Referenced by CORE_Test::testArray(), CORE_Test::testField(), CORE_Test::testTypes(), CORE_Object::toString(), toString(), and CORE_Field< T, K, D, S, I >::toString().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getMemorySize()

virtual tMemSize CORE_ClassFactory::getMemorySize ( ) const
inlineoverridevirtual

return the memory size of the class and the memory size of all its attributes/associations

Returns
the memory size of the class and the memory size of its attributes/associations in bytes 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Object.

Reimplemented in SM_ClassFactory.

References getContentsMemorySize().

Here is the call graph for this function:

◆ getPointerString()

tString CORE_Object::getPointerString ( ) const
inlineinherited

retrun the pointer of the class as a string

Returns
the pointer of the calss as a string

References core_functions::pointerToString().

Here is the call graph for this function:

◆ GetRegisteredClassesNumber()

static tIndex CORE_Object::GetRegisteredClassesNumber ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

◆ getSharedPointer()

template<class T >
std::shared_ptr<T> CORE_Object::getSharedPointer ( )
inlineinherited

return the shared pointer for this

Returns
the shared pointer as a type T

References CORE_Object::mThis.

◆ isInstanceOf()

template<class T >
tBoolean CORE_Object::isInstanceOf ( ) const
inlineinherited

test if the clas T is an instance of this class

Returns
true if the object is an instance of T

Referenced by SM_Beam::templatedSimulate().

Here is the caller graph for this function:

◆ IsMemoryStackEnabled()

static tBoolean CORE_Object::IsMemoryStackEnabled ( )
inlinestaticinherited

return trur if the memory stack is enabled

Referenced by CORE_Object::EnableMemoryStack(), and main().

Here is the caller graph for this function:

◆ MemoryStackToString()

static tString CORE_Object::MemoryStackToString ( )
inlinestaticinherited

get the memory stack in string

Returns
the string representation of the memory stack

Referenced by main().

Here is the caller graph for this function:

◆ New()

static CORE_UniquePointer<CORE_ClassFactory> CORE_ClassFactory::New ( )
inlinestatic

build a new instance of default class factory

Returns
an unique pointer of CORE_ClassFactory

References CORE_ClassFactory().

Here is the call graph for this function:

◆ NewInstance() [1/2]

CORE_UniquePointer<CORE_Object> CORE_ClassFactory::NewInstance ( const tString name) const
inline

create an unique instance of a class as a general CORE_Object

Parameters
[in]namename of the class to create
Returns
an unique pointer to the class with name return null if the name is not recognized

References NewInstance().

Here is the call graph for this function:

◆ NewInstance() [2/2]

CORE_UniquePointer< CORE_Object > CORE_ClassFactory::NewInstance ( const tString name,
const std::map< tString, tString > &  arguments 
) const
virtual

create an unique instance of a class as a general CORE_Object

Parameters
[in]namename of the class to create
[in]arguments: arguments of the class (name,value)
Returns
an unique pointer to the class with name return null if the name is not recognized

Reimplemented in SM_ClassFactory.

References mFactoryClasses, CORE_StdPtrArray< T >::New(), and tIndex.

Referenced by NewInstance(), SM_ClassFactory::NewInstance(), NewSharedInstance(), and NewUniqueInstance().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NewSharedInstance() [1/6]

template<class T >
CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( ) const
inline

create a shared instance of a class with same type as T with no argument

Returns
a shared pointer to the class with name return null if the name is not recognized

◆ NewSharedInstance() [2/6]

template<class T >
CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( const std::map< tString, tString > &  arguments) const
inline

create a shared instance of a class with same type as T

Parameters
[in]arguments: arguments
Returns
a shared pointer to the class with same type as T return null if the name is not recognized

References NewInstance().

Here is the call graph for this function:

◆ NewSharedInstance() [3/6]

template<class T >
CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( const tString name) const
inline

create a shared instance of a class with no argument

Parameters
[in]namename of the class to create
Returns
a shared pointer to the class with name return null shared pointer if the name is not recognized

References NewInstance().

Here is the call graph for this function:

◆ NewSharedInstance() [4/6]

template<class T >
CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( const tString name,
const std::map< tString, tString > &  arguments 
) const
inline

create a shared instance of a class

Parameters
[in]namename of the class to create
[in]arguments: arguments of the class (name,value)
Returns
a shared pointer to the class with name return null shared pointer if the name is not recognized

References NewInstance().

Here is the call graph for this function:

◆ NewSharedInstance() [5/6]

template<class T >
static CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( CORE_UniquePointer< T > &&  up)
inlinestatic

create a shared instance of an unique pointer as a lvalue

Parameters
[in]upunique pointer
Returns
a shared pointer to the class of the unique pointer

◆ NewSharedInstance() [6/6]

template<class T >
static CORE_SharedPointer<T> CORE_ClassFactory::NewSharedInstance ( CORE_UniquePointer< T > &  up)
inlinestatic

create a shared instance of an unique pointer

Parameters
[in]upunique pointer
Returns
a shared pointer to the class of the unique pointer

◆ NewUniqueInstance() [1/2]

template<class T >
CORE_UniquePointer<T> CORE_ClassFactory::NewUniqueInstance ( const tString name) const
inline

create an unique instance of a class T with no arguments

Parameters
[in]namename of the class to create
Returns
an unique pointer to the class with name return null if the name is not recognized

References NewInstance().

Here is the call graph for this function:

◆ NewUniqueInstance() [2/2]

template<class T >
CORE_UniquePointer<T> CORE_ClassFactory::NewUniqueInstance ( const tString name,
const std::map< tString, tString > &  arguments 
) const
inline

create an unique instance of a class T

Parameters
[in]namename of the class to create
[in]arguments: arguments of the class (name,value)
Returns
an unique pointer to the class with name return null if the name is not recognized

References NewInstance().

Referenced by SM_Test::grid3DParticlesTestCase(), SM_Test::linedParticlesTestCase(), SM_Run::loadBeamFromOptions(), SM_Run::loadOperatorsFromOptions(), and SM_Test::testOperators().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setThis()

template<class T >
std::shared_ptr<T> CORE_Object::setThis ( std::unique_ptr< T, CORE_Object::Delete > &  up)
inlineprivateinherited

set the shared pointer from an unique pointer

Parameters
[in,out]upunique pointer of the class at input, points to null pointer at output
Returns
the shared pointer of the class

Method only calledby the friend class CORE_ClassFactory::NewSharedInstance()

References CORE_Object::mThis.

◆ toString()

virtual tString CORE_ClassFactory::toString ( ) const
inlineoverridevirtual

get the string representation of the class

Returns
the string representation of the class

Reimplemented from CORE_Object.

References CORE_Object::getIdentityString(), and mFactoryClasses.

Here is the call graph for this function:

Member Data Documentation

◆ mFactoryClasses

std::vector<CORE_UniquePointer<CORE_ClassFactory> > CORE_ClassFactory::mFactoryClasses
private

◆ mThis

std::weak_ptr<CORE_Object> CORE_Object::mThis
privateinherited

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