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

abstract base class for most classes. More...

#include <CORE_Object.h>

Inheritance diagram for CORE_Object:
Inheritance graph
[legend]

Classes

class  Delete
 class Free introduced for deleting a smart pointer More...
 

Public Member Functions

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...
 
virtual tMemSize getMemorySize () const
 return the memory size of the class and the memory size of all its attributes/associations More...
 
virtual tMemSize getContentsMemorySize () const
 return nthe memory size of the included associations 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...
 
virtual tString toString () const
 return the string representation of the object node More...
 

Static Public Member Functions

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_Object ()
 build an instance of the object More...
 
virtual ~CORE_Object ()
 destroy the instance of object std
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::weak_ptr< CORE_ObjectmThis
 

Friends

class CORE_ClassFactory
 
class Delete
 
std::ostream & operator<< (std::ostream &out, const CORE_Object &obj)
 print the class object More...
 

Detailed Description

abstract base class for most classes.

CORE_Object is the base class for most objects in the CORE toolkit

Constructor & Destructor Documentation

◆ CORE_Object()

CORE_Object::CORE_Object ( )
protected

build an instance of the object

Referenced by CORE_Test::testArray(), and CORE_Test::testMemorySize().

Here is the caller graph for this function:

◆ ~CORE_Object()

CORE_Object::~CORE_Object ( )
protectedvirtual

destroy the instance of object std

Member Function Documentation

◆ DisableMemoryStack()

static void CORE_Object::DisableMemoryStack ( )
inlinestatic

disable the memory stack

Referenced by EnableMemoryStack().

Here is the caller graph for this function:

◆ EnableMemoryStack() [1/2]

static void CORE_Object::EnableMemoryStack ( )
inlinestatic

enable the memory stack

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

Here is the caller graph for this function:

◆ EnableMemoryStack() [2/2]

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

enable the memory stack

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

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

Here is the call graph for this function:

◆ getClassName()

tString CORE_Object::getClassName ( ) const
inline

return the name of the class

Returns
the string name of the class

Referenced by 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
inline

return a const shared pointer for this

Returns
the shared pointer as a type T

References mThis.

◆ getContentsMemorySize()

virtual tMemSize CORE_Object::getContentsMemorySize ( ) const
inlinevirtual

return nthe memory size of the included associations

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 in CORE_VectorList< T, I >, CORE_VectorList< tString, CORE_StringsList >, CORE_ValArray< T, I >, CORE_ValArray< T, CORE_StdValArray< T > >, CORE_Run, CORE_PtrArray< T, I >, CORE_PtrArray< T, CORE_StdPtrArray< T > >, CORE_Field< T, K, D, S, I >, CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >, CORE_Field< T, K, D, CORE_StdValArray< T >, CORE_StdValField< T, K, D > >, CORE_ClassFactory, SMS_STDUniformFunction, SMS_STDNormalFunction, SMS_BoostUniformFunction, SMS_BoostNormalFunction, SM_ZeemanOperator, SM_XDMF, SM_VTK, SM_System, SM_Output, SM_Operator, SM_Network, SM_DemagnetizedOperator, SM_Beam, CORE_StringsList, and CORE_Out.

Referenced by CORE_Out::getContentsMemorySize(), SM_Beam::getContentsMemorySize(), SM_Network::getContentsMemorySize(), SM_Operator::getContentsMemorySize(), SM_Output::getContentsMemorySize(), SM_System::getContentsMemorySize(), SM_VTK::getContentsMemorySize(), SMS_BoostNormalFunction::getContentsMemorySize(), SMS_BoostUniformFunction::getContentsMemorySize(), SMS_STDNormalFunction::getContentsMemorySize(), SMS_STDUniformFunction::getContentsMemorySize(), CORE_ClassFactory::getContentsMemorySize(), CORE_PtrArray< T, I >::getContentsMemorySize(), CORE_ValArray< T, I >::getContentsMemorySize(), CORE_VectorList< T, I >::getContentsMemorySize(), getMemorySize(), SM_ConstantNoiseRateFunction::getMemorySize(), SM_InverseNoiseRateFunction::getMemorySize(), SM_LandauLifschitzFunction::getMemorySize(), SM_NoiseRateFunction::getMemorySize(), SM_Object::getMemorySize(), SM_StochasticFunction::getMemorySize(), SM_TemplatedNoiseRateFunction< DerivedClass >::getMemorySize(), SM_TimeStepper::getMemorySize(), SMS_BoostRandomFunction::getMemorySize(), CORE_Array< T, I >::getMemorySize(), CORE_Chrono::getMemorySize(), CORE_Collection< T, I >::getMemorySize(), CORE_IO::getMemorySize(), CORE_List< T, K, I >::getMemorySize(), CORE_OptionsReader::getMemorySize(), CORE_OutputFile::getMemorySize(), and CORE_Test::getMemorySize().

Here is the caller graph for this function:

◆ getIdentityString()

tString CORE_Object::getIdentityString ( ) const
inline

retrun the string identification of the class

Returns
the string identity of the class

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

Referenced by CORE_Test::testArray(), CORE_Test::testField(), CORE_Test::testTypes(), toString(), CORE_ClassFactory::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_Object::getMemorySize ( ) const
inlinevirtual

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 The mamory size is :
  • the added size of the base classes which contains:
    • the primary attributes size depends on the order: (first delare the smallest attributes size
    • all virtual functions costs <pointer-size> (4 32xor 8 64x) bytes by virtual function
    • virtual inherihtance will increase of (4 or 8) bytes
  • we add the size of the contains values of the attributes : for example the size of a string is the length of the string 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented in CORE_VectorList< T, I >, CORE_VectorList< tString, CORE_StringsList >, CORE_ValArray< T, I >, CORE_ValArray< T, CORE_StdValArray< T > >, CORE_Test, CORE_StringsList, CORE_StdValField< T, K, D >, CORE_StdValArray< T >, CORE_StdPtrField< T, K, D >, CORE_StdPtrField< T, K, 3 >, CORE_StdPtrArray< T >, CORE_Run, CORE_PtrArray< T, I >, CORE_PtrArray< T, CORE_StdPtrArray< T > >, CORE_OutputFile, CORE_Out, CORE_OptionsReader, CORE_List< T, K, I >, CORE_List< T, tIndex, I >, CORE_IO, CORE_Field< T, K, D, S, I >, CORE_Field< T, K, D, CORE_StdPtrArray< T >, CORE_StdPtrField< T, K, D > >, CORE_Field< T, K, D, CORE_StdValArray< T >, CORE_StdValField< T, K, D > >, CORE_Collection< T, I >, CORE_ClassFactory, CORE_Chrono, CORE_Array< T, I >, SMS_STDUniformFunction, SMS_STDNormalFunction, SMS_BoostUniformFunction, SMS_BoostRandomFunction, SMS_BoostNormalFunction, SM_ZeemanOperator, SM_XDMF, SM_VTK, SM_TimeStepper, SM_TemplatedSystem< SystemImpl >, SM_TemplatedSystem< SM_ItoSystem >, SM_TemplatedSystem< SM_StratonovichSystem >, SM_TemplatedSystem< SM_StratonovichNormalizedSystem >, SM_TemplatedOperator< I >, SM_TemplatedOperator< SM_DemagnetizedOperator >, SM_TemplatedOperator< SM_HeissenbergOperator >, SM_TemplatedOperator< SM_ZeemanOperator >, SM_TemplatedNoiseRateFunction< DerivedClass >, SM_TemplatedNoiseRateFunction< SM_ConstantNoiseRateFunction >, SM_TemplatedNoiseRateFunction< SM_InverseNoiseRateFunction >, SM_System, SM_StratonovichSystem, SM_StratonovichNormalizedSystem, SM_StochasticFunction, SM_Run, SM_PermanentZeemanOperator, SM_Output, SM_Operator, SM_Object, SM_NoiseRateFunction, SM_Network, SM_LandauLifschitzFunction, SM_ItoSystem, SM_InverseNoiseRateFunction, SM_HeissenbergOperator, SM_Field< T, K >, SM_Field< tReal, tDimension >, SM_DemagnetizedOperator, SM_ConstantZeemanOperator, SM_ConstantNoiseRateFunction, SM_ClassFactory, and SM_Beam.

References getContentsMemorySize().

Here is the call graph for this function:

◆ getPointerString()

tString CORE_Object::getPointerString ( ) const
inline

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 ( )
inlinestatic

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 ( )
inline

return the shared pointer for this

Returns
the shared pointer as a type T

References mThis.

◆ isInstanceOf()

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

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 ( )
inlinestatic

return trur if the memory stack is enabled

Referenced by EnableMemoryStack(), and main().

Here is the caller graph for this function:

◆ MemoryStackToString()

static tString CORE_Object::MemoryStackToString ( )
inlinestatic

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:

◆ setThis()

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

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 mThis.

◆ toString()

virtual tString CORE_Object::toString ( ) const
inlinevirtual

Friends And Related Function Documentation

◆ CORE_ClassFactory

friend class CORE_ClassFactory
friend

◆ Delete

friend class Delete
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const CORE_Object obj 
)
friend

print the class object

Parameters
[in,out]out: output into printing
[in]objobject to print
Returns
the output

Member Data Documentation

◆ mThis

std::weak_ptr<CORE_Object> CORE_Object::mThis
private

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