ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Public Member Functions | Private Member Functions | List of all members
etiss::Initializer Class Reference

Wrapper for the initialize and shutdown of the ETISS environment. More...

#include <ETISS.h>

Public Member Functions

void loadIniPlugins (std::shared_ptr< etiss::CPUCore > cpu)
 loads the plugins given with the previous loaded .ini files More...
 
void loadIniJIT (std::shared_ptr< etiss::CPUCore > cpu)
 sets the JIT given with the previous loaded .ini files More...
 
template<typename argvT , typename... lisT>
 Initializer (int argc, argvT **argv, lisT... args_append)
 Constructor that initializes ETISS. More...
 
 Initializer (std::list< std::string > *files, int argc, const char *argv[])
 
template<typename... listT>
 Initializer (listT... args)
 Constructor that initializes ETISS. More...
 
template<typename argvT , typename... lisT>
 Initializer (std::list< std::string > *files, int argc, argvT **argv, lisT... args_append)
 Constructor that initializes ETISS. More...
 
template<typename... listT>
 Initializer (std::list< std::string > *files, listT... args)
 Constructor that initializes ETISS. More...
 
 ~Initializer ()
 Destructor that shutdowns ETISS. More...
 

Private Member Functions

template<typename T , typename... lisT>
void toList (std::vector< std::string > &vec, T t, lisT... args)
 Add argument list to a string vector. More...
 
void toList (std::vector< std::string > &vec)
 Break condition for empty argument list. More...
 
void loadIni (std::list< std::string > *files)
 creates a simpleIni object which holds the data of the given .ini file. More...
 
template<typename T , typename... lisT>
void static_assertFirstParamNotArithmetic (T t, lisT... args)
 Make sure that the first variadic parameter at compiletime is no number. More...
 
void static_assertFirstParamNotArithmetic ()
 version of static_assertFirstParamNotArithmetic for the case that no parameter is given. More...
 

Detailed Description

Wrapper for the initialize and shutdown of the ETISS environment.

At creation of an Initializer object ETISS is initialized. On destruction of an Initializer object ETISS shutdown. There should only be one instance of Initializer at any point of time.

Create an instance at the beginning of main to ensure proper initialization and cleanup.

int main(int argc,char ** argv){
etiss::Initializer etiss_initializer(argc,argv);
// program/simulation
} // The etiss::Initializer instance will be destroyed here and performs cleanup operations
Wrapper for the initialize and shutdown of the ETISS environment.
Definition: ETISS.h:253
int main(int argc, const char *argv[])
Definition: main.cpp:48
Note
It is recommended to use this class instead of etiss::initialize() / etiss::shutdown().

Definition at line 252 of file ETISS.h.

Constructor & Destructor Documentation

◆ Initializer() [1/5]

template<typename argvT , typename... lisT>
etiss::Initializer::Initializer ( int  argc,
argvT **  argv,
lisT...  args_append 
)
inline

Constructor that initializes ETISS.

This Constructor is useful if the arguments provided to the main function should be forwarded to etiss::initialize(). Additional arguments can simply be added at the end of the argument list. If an argument is not a string it will be converted to a string with the help of etiss::toString().

Parameters
argcThe number of arguments in the C-string array.
argvPointer to a C-string array.
args_appendAdditional arguments for etiss::initialize.

Definition at line 332 of file ETISS.h.

References get_metrics::args, etiss::initialize(), static_assert, and toList().

Here is the call graph for this function:

◆ Initializer() [2/5]

etiss::Initializer::Initializer ( std::list< std::string > *  files,
int  argc,
const char *  argv[] 
)
inline

Definition at line 347 of file ETISS.h.

References get_metrics::args, etiss::initialize(), and loadIni().

Here is the call graph for this function:

◆ Initializer() [3/5]

template<typename... listT>
etiss::Initializer::Initializer ( listT...  args)
inline

Constructor that initializes ETISS.

If an argument is not a string it will be converted to a string with the help of etiss::toString(). E.g.

initializer("-foption1","-fno-option2","-osomevallue",123,"etc.");
Parameters
argsList of arguments for etiss::initialize.

Definition at line 372 of file ETISS.h.

References get_metrics::args, etiss::initialize(), static_assertFirstParamNotArithmetic(), and toList().

Here is the call graph for this function:

◆ Initializer() [4/5]

template<typename argvT , typename... lisT>
etiss::Initializer::Initializer ( std::list< std::string > *  files,
int  argc,
argvT **  argv,
lisT...  args_append 
)
inline

Constructor that initializes ETISS.

This Constructor is useful if the arguments provided to the main function should be forwarded to etiss::initialize(). Additional arguments can simply be added at the end of the argument list. If an argument is not a string it will be converted to a string with the help of etiss::toString().

Parameters
argcThe number of arguments in the C-string array.
argvPointer to a C-string array.
filenameFile to open an ini file.
args_appendAdditional arguments for etiss::initialize.

Definition at line 400 of file ETISS.h.

References get_metrics::args, etiss::initialize(), loadIni(), static_assert, and toList().

Here is the call graph for this function:

◆ Initializer() [5/5]

template<typename... listT>
etiss::Initializer::Initializer ( std::list< std::string > *  files,
listT...  args 
)
inline

Constructor that initializes ETISS.

If an argument is not a string it will be converted to a string with the help of etiss::toString(). E.g.

initializer("-foption1","-fno-option2","-osomevallue",123,"etc.");
Parameters
filenameFile to open an ini file.
argsList of arguments for etiss::initialize.

Definition at line 432 of file ETISS.h.

References get_metrics::args, etiss::initialize(), loadIni(), static_assertFirstParamNotArithmetic(), and toList().

Here is the call graph for this function:

◆ ~Initializer()

etiss::Initializer::~Initializer ( )

Destructor that shutdowns ETISS.

The destructor calls etiss::shutdown().

Definition at line 984 of file ETISS.cpp.

References po_simpleIni, and etiss::shutdown().

Here is the call graph for this function:

Member Function Documentation

◆ loadIni()

void etiss::Initializer::loadIni ( std::list< std::string > *  files)
private

creates a simpleIni object which holds the data of the given .ini file.

Definition at line 399 of file ETISS.cpp.

References etiss_loadIni(), NULL, and po_simpleIni.

Referenced by Initializer().

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

◆ loadIniJIT()

void etiss::Initializer::loadIniJIT ( std::shared_ptr< etiss::CPUCore cpu)

sets the JIT given with the previous loaded .ini files

Parameters
Neededto add the JIT to the CPU

Definition at line 665 of file ETISS.cpp.

References etiss::cfg(), etiss::getDefaultJIT(), etiss::getJIT(), etiss::INFO, etiss::log(), and etiss::WARNING.

Referenced by main().

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

◆ loadIniPlugins()

void etiss::Initializer::loadIniPlugins ( std::shared_ptr< etiss::CPUCore cpu)

loads the plugins given with the previous loaded .ini files

Parameters
Neededto add the plugins to the CPU

Definition at line 556 of file ETISS.cpp.

References etiss::cfg(), etiss::getPlugin(), etiss::INFO, etiss::log(), options, pluginOptions, po_simpleIni, vm, and etiss::WARNING.

Referenced by main().

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

◆ static_assertFirstParamNotArithmetic() [1/2]

void etiss::Initializer::static_assertFirstParamNotArithmetic ( )
inlineprivate

version of static_assertFirstParamNotArithmetic for the case that no parameter is given.

Definition at line 304 of file ETISS.h.

Referenced by Initializer().

Here is the caller graph for this function:

◆ static_assertFirstParamNotArithmetic() [2/2]

template<typename T , typename... lisT>
void etiss::Initializer::static_assertFirstParamNotArithmetic ( t,
lisT...  args 
)
inlineprivate

Make sure that the first variadic parameter at compiletime is no number.

The original goal was: The Initializer versions that take argc and argv wanted const char as type for argv. In some projects, the Initializer constructor was called with char instead of const char. This led to problems as another construtor with completely variadic parameters was choosen instead, which failed to parse argc and argv. This function was used to make sure these versions of Initializer are not instantiated with argc as the first argument.

Definition at line 295 of file ETISS.h.

References static_assert.

◆ toList() [1/2]

void etiss::Initializer::toList ( std::vector< std::string > &  vec)
inlineprivate

Break condition for empty argument list.

Definition at line 277 of file ETISS.h.

◆ toList() [2/2]

template<typename T , typename... lisT>
void etiss::Initializer::toList ( std::vector< std::string > &  vec,
t,
lisT...  args 
)
inlineprivate

Add argument list to a string vector.

Recursively converts function arguments to a string with etiss::toString() and adds them to a string vector.

Parameters
vecThe string vector where the arguments should be appended.
tThe argument that is add next.
argsThe arguments added in the next recursion.

Definition at line 268 of file ETISS.h.

References get_metrics::args, and etiss::toString().

Referenced by Initializer().

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

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