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

this class describes the file system IO by default write on standart output More...

#include <CORE_IO.h>

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

Public Member Functions

 CORE_IO ()
 build a CORE_IO More...
 
virtual ~CORE_IO (void)
 destroy a CORE_IO More...
 
virtual tMemSize getMemorySize () const override
 return the memory size 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...
 
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 IsFile (const tString &f)
 return true if the file is a regular file More...
 
static tBoolean IsPath (const tString &p)
 return true if the path designed by p is a path More...
 
static tBoolean Exists (const tString &f)
 return true if the file or the path exists More...
 
static tBoolean CreatePath (const tString &path)
 create a path More...
 
static tBoolean Rename (const tString &file, const tString &newFile)
 
static tBoolean RemovePath (const tString &path, const tBoolean &force)
 remove a path More...
 
static tBoolean RemovePath (const tString &path)
 remove an empty path More...
 
static tBoolean RemoveFile (const tString &file)
 remove a file More...
 
static void RemoveAllFiles (const tString &path)
 remove all files within a path More...
 
static void RemoveAllFiles (const tString &path, const tString &exts)
 remove all files with extension within the path More...
 
static tString GetSystemPath (const tString &posix_path)
 get the system path corresponding to posix path More...
 
static void GetPaths (const tString &path, std::vector< tString > &paths)
 get all the paths within the directory More...
 
static tString GetPathName (const tString &aPath)
 get all the paths within the directory More...
 
static void GetFiles (const tString &path, std::vector< tString > &files)
 get all the files within the directory More...
 
static void GetFiles (const tString &path, const tString &exts, std::vector< tString > &files)
 get all the files within the directory with extension of the form .ext More...
 
static tBoolean CopyFiles (const tString &sourcePath, const tString &exts, const tString &destPath, const tBoolean &overwrite)
 copy all the files with extension within the directory to destination path More...
 
static tBoolean CopyFiles (const tString &sourcePath, const tString &destPath, const tBoolean &overwrite)
 copy all the files within the directory to destination path More...
 
static tBoolean CopyFile (const tString &source, const tString &dest, const tBoolean &overwrite)
 copy file More...
 
static tBoolean CopyFile (const tString &source, const tString &dest)
 copy file More...
 
static tBoolean CopyPath (const tString &sourcePath, const tString &destPath)
 copy path More...
 
static void GetContent (const tString &path, std::vector< tString > &content)
 get all the content files or paths within the directory More...
 
static tString GetCurrentPath ()
 get the current path More...
 
static tString GetAbsolutePath (const tString &path)
 get the absolute path of the path More...
 
static tString GetBaseName (const tString &file)
 get base name of the file More...
 
static tString GetExtension (const tString &file)
 get extension of the file More...
 
static tString GetPath (const tString &file)
 get path containing the file More...
 
static tString GetFileName (const tString &file)
 get path containing the file 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...
 

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
 

Detailed Description

this class describes the file system IO by default write on standart output

Constructor & Destructor Documentation

◆ CORE_IO()

CORE_IO::CORE_IO ( )
inline

build a CORE_IO

◆ ~CORE_IO()

virtual CORE_IO::~CORE_IO ( void  )
inlinevirtual

destroy a CORE_IO

Member Function Documentation

◆ CopyFile() [1/2]

static tBoolean CORE_IO::CopyFile ( const tString source,
const tString dest 
)
inlinestatic

copy file

Parameters
[in]sourcesource file
[in]destdestfile
[in]overwrite: true to erase old file
Returns
true if thecopy has succeeds

References CopyFile().

Here is the call graph for this function:

◆ CopyFile() [2/2]

static tBoolean CORE_IO::CopyFile ( const tString source,
const tString dest,
const tBoolean overwrite 
)
inlinestatic

copy file

Parameters
[in]sourcesource file
[in]destdestfile
[in]overwrite: true to erase old file
Returns
true if thecopy has succeeds

Referenced by CopyFile().

Here is the caller graph for this function:

◆ CopyFiles() [1/2]

static tBoolean CORE_IO::CopyFiles ( const tString sourcePath,
const tString destPath,
const tBoolean overwrite 
)
inlinestatic

copy all the files within the directory to destination path

Parameters
[in]sourcePathpath to get the files with extension ext
[in]destPathdestinaton path
[in]overwrite: true to erase old file
Returns
true if the paths exists

◆ CopyFiles() [2/2]

static tBoolean CORE_IO::CopyFiles ( const tString sourcePath,
const tString exts,
const tString destPath,
const tBoolean overwrite 
)
inlinestatic

copy all the files with extension within the directory to destination path

Parameters
[in]sourcePathpath to get the files with extension ext
[in]exts:xtensions of the file to search for example ".mov .avi "
[in]destPathdestinaton path
[in]overwrite: true to erase old file
Returns
true if the paths exist

References GetExtension(), core_functions::toLower(), and tString.

Here is the call graph for this function:

◆ CopyPath()

static tBoolean CORE_IO::CopyPath ( const tString sourcePath,
const tString destPath 
)
inlinestatic

copy path

Parameters
[in]sourcePathpath to get the files with extension ext
[in]destPathdestinaton path
Returns
true if the paths exists

◆ CreatePath()

static tBoolean CORE_IO::CreatePath ( const tString path)
inlinestatic

create a path

Parameters
[in]pathcreate the path
Returns
true if the path has been created correctly

Referenced by CORE_Test::testIO().

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:

◆ Exists()

static tBoolean CORE_IO::Exists ( const tString f)
inlinestatic

return true if the file or the path exists

Parameters
[in]ffile or path to verify the existence
Returns
true if the file/path exists

Referenced by Rename().

Here is the caller graph for this function:

◆ GetAbsolutePath()

static tString CORE_IO::GetAbsolutePath ( const tString path)
inlinestatic

get the absolute path of the path

Parameters
[in]pathpath to get the absolute path
Returns
the absolute path of the path

Referenced by CORE_OptionsReader::ReadPath().

Here is the caller graph for this function:

◆ GetBaseName()

static tString CORE_IO::GetBaseName ( const tString file)
inlinestatic

get base name of the file

Parameters
[in]file: name of the file
Returns
the base name of the file

Referenced by CORE_Test::testIO().

Here is the caller 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.

◆ GetContent()

static void CORE_IO::GetContent ( const tString path,
std::vector< tString > &  content 
)
inlinestatic

get all the content files or paths within the directory

Parameters
[in]pathpath to get the content
[out]content: all the content of the path files of paths

◆ getContentsMemorySize()

virtual tMemSize CORE_Object::getContentsMemorySize ( ) const
inlinevirtualinherited

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(), CORE_Object::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(), 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:

◆ GetCurrentPath()

static tString CORE_IO::GetCurrentPath ( )
inlinestatic

get the current path

Returns
the current path

◆ GetExtension()

static tString CORE_IO::GetExtension ( const tString file)
inlinestatic

get extension of the file

Parameters
[in]file: name of the file
Returns
the extention of the file of the form .ext

Referenced by CopyFiles(), GetFiles(), and CORE_Test::testIO().

Here is the caller graph for this function:

◆ GetFileName()

static tString CORE_IO::GetFileName ( const tString file)
inlinestatic

get path containing the file

Parameters
[in]file: name of the file
Returns
the path containing the file

◆ GetFiles() [1/2]

static void CORE_IO::GetFiles ( const tString path,
const tString exts,
std::vector< tString > &  files 
)
inlinestatic

get all the files within the directory with extension of the form .ext

Parameters
[in]pathpath to get the content
[in]extsextensions of the file to search for example ".mov .avi "
[out]files: all the files within the path

References GetExtension(), core_functions::toLower(), and tString.

Here is the call graph for this function:

◆ GetFiles() [2/2]

static void CORE_IO::GetFiles ( const tString path,
std::vector< tString > &  files 
)
inlinestatic

get all the files within the directory

Parameters
[in]pathpath to get the content
[out]files: all the files within the path

Referenced by RemoveAllFiles(), and CORE_Test::testIO().

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_IO::getMemorySize ( ) const
inlineoverridevirtual

return the memory size of the class

Returns
the memory size of the class in bytes 1 octet = 1 byte 1 Ko = 1024 bytes 1 Mo = 1024 Ko 1 Go = 1024 Mo

Reimplemented from CORE_Object.

Reimplemented in CORE_OutputFile.

References CORE_Object::getContentsMemorySize().

Here is the call graph for this function:

◆ GetPath()

static tString CORE_IO::GetPath ( const tString file)
inlinestatic

get path containing the file

Parameters
[in]file: name of the file
Returns
the path containing the file

Referenced by CORE_Test::testIO().

Here is the caller graph for this function:

◆ GetPathName()

static tString CORE_IO::GetPathName ( const tString aPath)
inlinestatic

get all the paths within the directory

Parameters
[in]aPathabsolute path to get the content
Returns
the name of the aPath

◆ GetPaths()

static void CORE_IO::GetPaths ( const tString path,
std::vector< tString > &  paths 
)
inlinestatic

get all the paths within the directory

Parameters
[in]pathpath to get the content
[out]pathsall the paths within the path

Referenced by CORE_Test::testIO().

Here is the caller 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.

◆ GetSystemPath()

static tString CORE_IO::GetSystemPath ( const tString posix_path)
inlinestatic

get the system path corresponding to posix path

Returns
ystem path corresponding to posix path '/'->'\' for windows unchange for linux/mac

◆ IsFile()

static tBoolean CORE_IO::IsFile ( const tString f)
inlinestatic

return true if the file is a regular file

Parameters
[in]ffile to test
Returns
true if the file is regular

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

◆ IsPath()

static tBoolean CORE_IO::IsPath ( const tString p)
inlinestatic

return true if the path designed by p is a path

Parameters
[in]ppath to test
Returns
true if the path is regular

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

◆ RemoveAllFiles() [1/2]

static void CORE_IO::RemoveAllFiles ( const tString path)
inlinestatic

remove all files within a path

Parameters
[in]pathpath in which the fils has to be remove remove
Returns
true if the file has been removed correctly

References GetFiles().

Here is the call graph for this function:

◆ RemoveAllFiles() [2/2]

static void CORE_IO::RemoveAllFiles ( const tString path,
const tString exts 
)
inlinestatic

remove all files with extension within the path

Parameters
[in]pathpath in which the fils has to be remove remove
[in]extsextension of files to remove
Returns
true if the file has been removed correctly

References GetFiles().

Here is the call graph for this function:

◆ RemoveFile()

static tBoolean CORE_IO::RemoveFile ( const tString file)
inlinestatic

remove a file

Parameters
[in]filefile to remove
Returns
true if the file has been removed correctly

◆ RemovePath() [1/2]

static tBoolean CORE_IO::RemovePath ( const tString path)
inlinestatic

remove an empty path

Parameters
[in]pathpath to remove
Returns
true if the path has been removed correctly

References RemovePath().

Here is the call graph for this function:

◆ RemovePath() [2/2]

static tBoolean CORE_IO::RemovePath ( const tString path,
const tBoolean force 
)
inlinestatic

remove a path

Parameters
[in]pathpath to remove
[in]forcetrue to remove the path even if not empty
Returns
true if the path has been removed correctly

Referenced by RemovePath(), and CORE_Test::testIO().

Here is the caller graph for this function:

◆ Rename()

static tBoolean CORE_IO::Rename ( const tString file,
const tString newFile 
)
inlinestatic

_breif mov ethe path or file to another path or file

Parameters
[in]filefile to rename
[in]newFile: new full name

References Exists().

Here is the call 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

Member Data Documentation

◆ mThis

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

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