C++ mpi module for stochmagnet_main Package
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CORE_OptionsList Class Reference

This class is an list of options. More...

#include <CORE_OptionsList.h>

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

Public Member Functions

 CORE_OptionsList (void)
 create
 
virtual ~CORE_OptionsList (void)
 destroy
 
virtual tMemSize getMemorySize () const override
 return the memory size of the class More...
 
virtual tMemSize getContentsMemorySize () const override
 return the memory size of the included associations More...
 
std::map< tString, tString >::iterator begin ()
 begin iterator
 
std::map< tString, tString >::iterator end ()
 end iterator
 
std::map< tString, tString >::const_iterator cbegin () const
 begin iterator
 
std::map< tString, tString >::const_iterator cend () const
 end iterator
 
void setIsOptionsNameCaseSensitive (const tBoolean &isOptNameCS)
 set if the option name is in lower case More...
 
const tBoolean & isOptionsNameCaseSensitive () const
 set if the option name is in lower case More...
 
void clear ()
 clear the options list
 
CORE_OptionsListoperator= (const CORE_OptionsList &options)
 copy the options value More...
 
void setManOption (const tString &category, const tString &optName, const tString &man)
 set man option More...
 
void setOptionValue (const tString &optName, const tBoolean &value)
 set option More...
 
tString & operator[] (const tString &optName)
 string accessor for options list More...
 
template<typename T >
void setOptionValue (const tString &optName, const T &value)
 set option More...
 
template<typename T >
void setOptionValue (const tString &optName, const std::initializer_list< T > &values)
 set option More...
 
template<typename T >
void setOptionValue (const tString &optName, const std::valarray< T > &values)
 set option More...
 
template<typename T >
void setOptionValue (const tString &optName, const std::vector< T > &values)
 set option More...
 
template<typename T , tIndex N>
void setOptionValue (const tString &optName, const std::array< T, N > &values)
 set option More...
 
tString operator[] (const tString &optName) const
 return the value of the option with name More...
 
tBoolean removeOption (const tString &optName)
 remove option More...
 
tBoolean getOptionValue (const tString &optName, tString &optValue) const
 get the option value More...
 
template<typename T >
 requires (functions_type::isRealType< T >) inline tBoolean getOptionValue(const tString &optName
 get the option value More...
 
 if (ok)
 
template<typename T >
 requires (functions_type::isIntegerType< T >) inline tBoolean getOptionValue(const tString &optName
 get the option value More...
 
 if (ok)
 
tBoolean getOptionValue (const tString &optName, tBoolean &optValue) const
 get the option value More...
 
template<class T >
tBoolean getOptionValue (const tString &optName, std::vector< T > &optValues) const
 get the option value More...
 
template<class T , tIndex N>
tBoolean getOptionValue (const tString &optName, std::array< T, N > &optValues) const
 get the option value More...
 
template<typename T >
 requires ((functions_type::isIntegerType< T >) &&!(functions_type::isBooleanType< T >)) inline static tBoolean ReadOption(int nArgs
 read the only the option with optionName in command line More...
 
 if (ReadOption(nArgs, argv, isCaseSensitive, optionName, strValue))
 
template<typename T >
 requires (functions_type::isRealType< T >) inline static tBoolean ReadOption(int nArgs
 read the only the option with optionName in command line More...
 
 if (ReadOption(nArgs, argv, isCaseSensitive, optionName, strValue))
 
template<typename T >
 requires (functions_type::isBooleanType< T >) inline static tBoolean ReadOption(int nArgs
 read the only the option with optionName in command line More...
 
 if (ReadOption(nArgs, argv, isCaseSensitive, optionName, strValue))
 
tBoolean loadFromFile (const tString &fileName)
 read the options from a file More...
 
void loadFromCommandLine (int argc, char *argv[])
 read all the options from the command line . The options are of the form '–option_name=option_value" or within the default option file 'input' when no command line More...
 
tBoolean saveToFile (const tString &fileName) const
 save the options to the file by theme More...
 
tBoolean saveToFile () const
 save the options to the file by theme in outputPath/outputPrefix.opt
 
virtual tString toString () const override
 turn the class to string More...
 
- Public Member Functions inherited from CORE_Object
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< SelfClassNew ()
 create a new unique instance of the class this More...
 
static tBoolean ReadOption (int nArgs, char *argv[], const tBoolean &isCaseSensitive, const tString &optionName, tString &optionValue)
 read the only the option with optionName in command line More...
 
- Static Public Member Functions inherited from CORE_Object
static tBoolean EnableMemoryStack (const tBoolean &isMemoryChecked)
 enable the memory stack More...
 
static void EnableMemoryStack ()
 enable the memory stack
 
static void DisableMemoryStack ()
 disable the memory stack
 
static tBoolean IsMemoryStackEnabled ()
 return trur if the memory stack is enabled
 
static tString MemoryStackToString ()
 get the memory stack in string More...
 
static tIndex GetRegisteredClassesNumber ()
 get the memory stack in string More...
 

Public Attributes

T &optValue const
 
tBoolean ok =getOptionValue(optName,strValue)
 
return ok
 
char * argv []
 
char const tBoolean & isCaseSensitive
 
char const tBoolean const tString & optionName
 
char const tBoolean const tString T & optionValue
 
return false
 

Additional Inherited Members

- Protected Member Functions inherited from CORE_Object
 CORE_Object ()
 build an instance of the object
 
virtual ~CORE_Object ()
 destroy the instance of object std

 

Detailed Description

This class is an list of options.

Author
Stephane Despreaux
Version
2.0

Member Function Documentation

◆ getContentsMemorySize()

virtual tMemSize CORE_OptionsList::getContentsMemorySize ( ) const
inlineoverridevirtual

return the 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.

◆ getMemorySize()

virtual tMemSize CORE_OptionsList::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.

◆ getOptionValue() [1/4]

template<class T , tIndex N>
tBoolean CORE_OptionsList::getOptionValue ( const tString &  optName,
std::array< T, N > &  optValues 
) const
inline

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuesvalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ getOptionValue() [2/4]

template<class T >
tBoolean CORE_OptionsList::getOptionValue ( const tString &  optName,
std::vector< T > &  optValues 
) const
inline

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuesvalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ getOptionValue() [3/4]

tBoolean CORE_OptionsList::getOptionValue ( const tString &  optName,
tBoolean &  optValue 
) const
inline

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuevalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ getOptionValue() [4/4]

tBoolean CORE_OptionsList::getOptionValue ( const tString &  optName,
tString &  optValue 
) const
inline

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuevalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ isOptionsNameCaseSensitive()

const tBoolean& CORE_OptionsList::isOptionsNameCaseSensitive ( ) const
inline

set if the option name is in lower case

Returns
true if the options name is case sensitive

◆ loadFromCommandLine()

void CORE_OptionsList::loadFromCommandLine ( int  argc,
char *  argv[] 
)

read all the options from the command line . The options are of the form '–option_name=option_value" or within the default option file 'input' when no command line

Parameters
[in]argcnumber of parameter of the command line
[in]argv: value of the parameters

◆ loadFromFile()

tBoolean CORE_OptionsList::loadFromFile ( const tString &  fileName)

read the options from a file

Parameters
[in]fileNamefile name of the options
Returns
false if the options reading failed

◆ New()

static CORE_UniquePointer<SelfClass> CORE_OptionsList::New ( )
inlinestatic

create a new unique instance of the class this

Returns
a new unique instance of the class this

◆ operator=()

CORE_OptionsList& CORE_OptionsList::operator= ( const CORE_OptionsList options)
inline

copy the options value

Parameters
[in]options

◆ operator[]() [1/2]

tString& CORE_OptionsList::operator[] ( const tString &  optName)
inline

string accessor for options list

Parameters
[in]optName

◆ operator[]() [2/2]

tString CORE_OptionsList::operator[] ( const tString &  optName) const
inline

return the value of the option with name

Parameters
[in]optName: name of the option

◆ ReadOption()

tBoolean CORE_OptionsList::ReadOption ( int  nArgs,
char *  argv[],
const tBoolean &  isCaseSensitive,
const tString &  optionName,
tString &  optionValue 
)
static

read the only the option with optionName in command line

Parameters
[in]nArgsnumber of parameters of the command line
[in]argv: value of the parameters
[in]isCaseSensitive: true if the case is sensitive
[in]optionNamevalue of the option
[out]optionValue: value of the option
Returns
false if the option does not exists

◆ removeOption()

tBoolean CORE_OptionsList::removeOption ( const tString &  optName)
inline

remove option

Parameters
[in]optNameoption name
Returns
true if the option was in the list

◆ requires() [1/5]

template<typename T >
CORE_OptionsList::requires ( (functions_type::isIntegerType< T >) &&!(functions_type::isBooleanType< T >)  )

read the only the option with optionName in command line

Parameters
[in]nArgsnumber of parameters of the command line
[in]argv: value of the parameters
[in]isCaseSensitive: true if the case is sensitive
[in]optionNamevalue of the option
[out]optionValue: value of the option
Returns
false if the option does not exists

◆ requires() [2/5]

template<typename T >
CORE_OptionsList::requires ( functions_type::isBooleanType< T >  )

read the only the option with optionName in command line

Parameters
[in]nArgsnumber of parameters of the command line
[in]argv: value of the parameters
[in]isCaseSensitive: true if the case is sensitive
[in]optionNamevalue of the option
[out]optionValue: value of the option
Returns
false if the option does not exists

◆ requires() [3/5]

template<typename T >
CORE_OptionsList::requires ( functions_type::isIntegerType< T >  ) const &

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuevalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ requires() [4/5]

template<typename T >
CORE_OptionsList::requires ( functions_type::isRealType< T >  )

read the only the option with optionName in command line

Parameters
[in]nArgsnumber of parameters of the command line
[in]argv: value of the parameters
[in]isCaseSensitive: true if the case is sensitive
[in]optionNamevalue of the option
[out]optionValue: value of the option
Returns
false if the option does not exists

◆ requires() [5/5]

template<typename T >
CORE_OptionsList::requires ( functions_type::isRealType< T >  ) const &

get the option value

Parameters
[in]optNamename of the option
[in,out]optValuevalue of the option. Unchanged if the option does not exists
Returns
true if the option with optName exists

◆ saveToFile()

tBoolean CORE_OptionsList::saveToFile ( const tString &  fileName) const

save the options to the file by theme

Parameters
[in]fileNamethe options file to save

◆ setIsOptionsNameCaseSensitive()

void CORE_OptionsList::setIsOptionsNameCaseSensitive ( const tBoolean &  isOptNameCS)
inline

set if the option name is in lower case

Parameters
[in]isOptNameCStrue to set option name case sensitive

◆ setManOption()

void CORE_OptionsList::setManOption ( const tString &  category,
const tString &  optName,
const tString &  man 
)
inline

set man option

Parameters
[in]category: category of the option
[in]optName: name of the option
[in]man: man of the option

◆ setOptionValue() [1/6]

template<typename T , tIndex N>
void CORE_OptionsList::setOptionValue ( const tString &  optName,
const std::array< T, N > &  values 
)
inline

set option

Parameters
[in]optName: name of the option
[in]values: values of the option

◆ setOptionValue() [2/6]

template<typename T >
void CORE_OptionsList::setOptionValue ( const tString &  optName,
const std::initializer_list< T > &  values 
)
inline

set option

Parameters
[in]optName: name of the option
[in]values: values of the option

◆ setOptionValue() [3/6]

template<typename T >
void CORE_OptionsList::setOptionValue ( const tString &  optName,
const std::valarray< T > &  values 
)
inline

set option

Parameters
[in]optName: name of the option
[in]values: values of the option

◆ setOptionValue() [4/6]

template<typename T >
void CORE_OptionsList::setOptionValue ( const tString &  optName,
const std::vector< T > &  values 
)
inline

set option

Parameters
[in]optName: name of the option
[in]values: values of the option

◆ setOptionValue() [5/6]

template<typename T >
void CORE_OptionsList::setOptionValue ( const tString &  optName,
const T &  value 
)
inline

set option

Parameters
[in]optName: name of the option
[in]value: value of the option

◆ setOptionValue() [6/6]

void CORE_OptionsList::setOptionValue ( const tString &  optName,
const tBoolean &  value 
)
inline

set option

Parameters
[in]optName: name of the option
[in]value: value of the option

◆ toString()

tString CORE_OptionsList::toString ( ) const
overridevirtual

turn the class to string

Returns
the class representation

Reimplemented from CORE_Object.

Member Data Documentation

◆ const

T &optValue CORE_OptionsList::const
Initial value:
{
tString strValue

◆ optionValue

char const tBoolean const tString T & CORE_OptionsList::optionValue
Initial value:
{
tString strValue=""

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