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

this class describes the output stream by default write on standart output More...

#include <CORE_Out.h>

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

Public Member Functions

 CORE_Out ()
 build a CORE_Out More...
 
virtual ~CORE_Out (void)
 destroy a CORE_Out More...
 
virtual tMemSize getMemorySize () const override
 return the memory size in byte More...
 
virtual tMemSize getContentsMemorySize () const
 return nthe memory size of the included associations More...
 
void update ()
 update the state of the output More...
 
void release ()
 release the pointers More...
 
void reset ()
 reset the state of the class More...
 
void setOutput (const tUSInt &mode)
 set outputType of the binary form v=2*f+s More...
 
void setOutput (const tString &mode)
 set outputType of the binary form v='FS' More...
 
tBoolean isOutput (const tUCInt &mode) const
 return true if the output is of the mode More...
 
void setOutputFile (const tString &fileName, const tFlag &mode)
 set output file More...
 
void setOutputFile (const tString &fileName)
 set output file More...
 
const tStringgetOutputFileName () const
 get the output file name More...
 
void backup ()
 backup the state before change More...
 
void restore ()
 restore the state after change More...
 
void println (const tString &msg)
 print the message More...
 
void print (const tString &msg)
 print the message More...
 
void printError (const tString &msg)
 print the message on error output 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...
 
virtual tString toString () const
 return the string representation of the object node More...
 

Static Public Member Functions

static CORE_UniquePointer< CORE_OutNew ()
 build a new instance of default output More...
 
static void PrintProgressBar (const tString &message, const tInt &percent, tInt &oldPercent)
 
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...
 

Static Public Attributes

static const tUCInt NO_OUTPUT =0
 
static const tUCInt SCREEN_OUTPUT =1
 
static const tUCInt FILE_OUTPUT =2
 
static const tUCInt ALL_OUTPUT =3
 
static const tFlag APPEND =1
 
static const tFlag CREATE =0
 

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

tString mOutputFileName
 
tString mOutputFileName_back
 
std::ofstream * mOutputFileStream
 
tUCInt mOutput
 
tUCInt mOutputFileMode
 
tFlag mOutput_back
 
tFlag mOutputFileMode_back
 
std::weak_ptr< CORE_ObjectmThis
 

Friends

template<typename T >
CORE_Outoperator<< (CORE_Out &out, const T &obj)
 print Operators More...
 

Detailed Description

this class describes the output stream by default write on standart output

After any change of the output call update();

Constructor & Destructor Documentation

◆ CORE_Out()

CORE_Out::CORE_Out ( )
inline

build a CORE_Out

References mOutputFileStream, and reset().

Referenced by New().

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

◆ ~CORE_Out()

virtual CORE_Out::~CORE_Out ( void  )
inlinevirtual

destroy a CORE_Out

References release().

Here is the call graph for this function:

Member Function Documentation

◆ backup()

void CORE_Out::backup ( )
inline

backup the state before change

References mOutput, mOutput_back, mOutputFileMode, mOutputFileMode_back, mOutputFileName, and mOutputFileName_back.

Referenced by reset().

Here is the caller graph for this function:

◆ 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_Out::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 from CORE_Object.

References CORE_Object::getContentsMemorySize(), mOutputFileName, and mOutputFileName_back.

Referenced by 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(), 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_Out::getMemorySize ( ) 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 getContentsMemorySize().

Here is the call graph for this function:

◆ getOutputFileName()

const tString& CORE_Out::getOutputFileName ( ) const
inline

get the output file name

Returns
the output file name

References mOutputFileName.

◆ 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:

◆ isOutput()

tBoolean CORE_Out::isOutput ( const tUCInt mode) const
inline

return true if the output is of the mode

Parameters
[in]modeoutput mode

References mOutput.

Referenced by update().

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_Out> CORE_Out::New ( )
inlinestatic

build a new instance of default output

Returns
an unique pointer of CORE_Out

References CORE_Out().

Here is the call graph for this function:

◆ print()

void CORE_Out::print ( const tString msg)
inline

print the message

Parameters
[in]msgmessage to print on output

Referenced by SM_Run::run().

Here is the caller graph for this function:

◆ printError()

void CORE_Out::printError ( const tString msg)
inline

print the message on error output

Parameters
[in]msgmessage to print on errot output

Referenced by CORE_Exception::CORE_Exception(), SM_Beam::discretize(), SM_Test::elementaryTests(), and SM_Test::primaryTests().

Here is the caller graph for this function:

◆ println()

void CORE_Out::println ( const tString msg)
inline

print the message

Parameters
[in]msgmessage to print on output

Referenced by CORE_Run::SetDebugOptions().

Here is the caller graph for this function:

◆ PrintProgressBar()

static void CORE_Out::PrintProgressBar ( const tString message,
const tInt percent,
tInt oldPercent 
)
inlinestatic

◆ release()

void CORE_Out::release ( )
inline

release the pointers

References mOutputFileStream.

Referenced by update(), and ~CORE_Out().

Here is the caller graph for this function:

◆ reset()

void CORE_Out::reset ( )
inline

reset the state of the class

References backup(), CREATE, mOutput, mOutputFileMode, mOutputFileName, SCREEN_OUTPUT, and update().

Referenced by CORE_Out().

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

◆ restore()

void CORE_Out::restore ( )
inline

restore the state after change

References mOutput, mOutput_back, mOutputFileMode, mOutputFileMode_back, mOutputFileName, mOutputFileName_back, and update().

Here is the call graph for this function:

◆ setOutput() [1/2]

void CORE_Out::setOutput ( const tString mode)
inline

set outputType of the binary form v='FS'

Parameters
[in]modethe output mode
  • S: 1 for screen output , 0 otherwise
  • F: 1 for file output , 0 otherwise

examples:

  • no output 00
  • all output 11
  • only screen 01
  • only file 10

References setOutput(), and tUCInt.

Here is the call graph for this function:

◆ setOutput() [2/2]

void CORE_Out::setOutput ( const tUSInt mode)
inline

set outputType of the binary form v=2*f+s

Parameters
[in]modethe output mode
  • s: 1 for screen output , 0 otherwise
  • f: 1 for file output , 0 otherwise

examples:

  • no output 0
  • all output 3
  • only screen 1
  • only file 2

References mOutput.

Referenced by setOutput(), and CORE_Run::SetOutputOptions().

Here is the caller graph for this function:

◆ setOutputFile() [1/2]

void CORE_Out::setOutputFile ( const tString fileName)
inline

set output file

References CREATE, and setOutputFile().

Here is the call graph for this function:

◆ setOutputFile() [2/2]

void CORE_Out::setOutputFile ( const tString fileName,
const tFlag mode 
)
inline

set output file

Parameters
[in]fileName: name of the output file
[in]modemode of writting the output file

References mOutputFileMode, and mOutputFileName.

Referenced by setOutputFile(), and CORE_Run::SetOutputOptions().

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_Object::toString ( ) const
inlinevirtualinherited

◆ update()

void CORE_Out::update ( )
inline

update the state of the output

References APPEND, FILE_OUTPUT, isOutput(), mOutputFileMode, mOutputFileName, mOutputFileStream, and release().

Referenced by reset(), restore(), and CORE_Run::SetOutputOptions().

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

Friends And Related Function Documentation

◆ operator<<

template<typename T >
CORE_Out& operator<< ( CORE_Out out,
const T &  obj 
)
friend

print Operators

Parameters
[in,out]outoutput stream
[in]objto print
Returns
the output stream

Member Data Documentation

◆ ALL_OUTPUT

const tUCInt CORE_Out::ALL_OUTPUT =3
static

◆ APPEND

const tFlag CORE_Out::APPEND =1
static

◆ CREATE

const tFlag CORE_Out::CREATE =0
static

◆ FILE_OUTPUT

const tUCInt CORE_Out::FILE_OUTPUT =2
static

◆ mOutput

tUCInt CORE_Out::mOutput
private

◆ mOutput_back

tFlag CORE_Out::mOutput_back
private

Referenced by backup(), and restore().

◆ mOutputFileMode

tUCInt CORE_Out::mOutputFileMode
private

◆ mOutputFileMode_back

tFlag CORE_Out::mOutputFileMode_back
private

Referenced by backup(), and restore().

◆ mOutputFileName

tString CORE_Out::mOutputFileName
private

◆ mOutputFileName_back

tString CORE_Out::mOutputFileName_back
private

◆ mOutputFileStream

std::ofstream* CORE_Out::mOutputFileStream
private

Referenced by CORE_Out(), release(), and update().

◆ mThis

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

◆ NO_OUTPUT

const tUCInt CORE_Out::NO_OUTPUT =0
static

◆ SCREEN_OUTPUT

const tUCInt CORE_Out::SCREEN_OUTPUT =1
static

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