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

simple class to hold configuration options More...

#include <Misc.h>

Collaboration diagram for etiss::Configuration:
Collaboration graph
[legend]

Public Member Functions

 Configuration ()
 
 Configuration (std::string args)
 
 Configuration (const std::list< std::string > &args)
 
std::map< std::string, std::string > & config ()
 access to the configuration key value map More...
 
template<typename T >
get (const std::string &key, T default_, bool *default_used=0)
 template function to read the value of a configuration key. More...
 
bool debug ()
 Get the value of the key "debug". More...
 
template<typename T >
bool set (const std::string &key, T value)
 template function to set the value of a configuration key. More...
 
bool isSet (std::string val)
 return true if the value of an configuration key has been set More...
 
void remove (const std::string &key)
 removes a key value mapping More...
 
std::list< std::string > set (const std::list< std::string > &args)
 parses a list of parameters to apply to this config. More...
 
std::map< std::string, std::string > listFullConfiguration ()
 get a copy of the configuration as a map More...
 
void makeFinal (const std::string &key)
 makes an option final (option can no longer be changed) More...
 
void announce (std::string key, std::string type=std::string(), std::string values=std::string(), std::string description=std::string())
 add a possible option to a list. More...
 
std::map< std::string, std::tuple< std::string, std::string, std::string > > getAnnounced () const
 get a map copy with announced options More...
 
void operator= (Configuration &&other)
 
template<>
bool get (const std::string &key, bool default_, bool *default_used)
 
template<>
int get (const std::string &key, int default_, bool *default_used)
 
template<>
unsigned get (const std::string &key, unsigned default_, bool *default_used)
 
template<>
uint64_t get (const std::string &key, uint64_t default_, bool *default_used)
 
template<>
std::string get (const std::string &key, std::string default_, bool *default_used)
 
template<>
bool get (const std::string &key, bool default_, bool *default_used)
 
template<>
int get (const std::string &key, int default_, bool *default_used)
 
template<>
unsigned get (const std::string &key, unsigned default_, bool *default_used)
 
template<>
uint64_t get (const std::string &key, uint64_t default_, bool *default_used)
 

Static Public Member Functions

static std::pair< std::string, std::string > set_cmd_line_boost (const std::string &s)
 

Private Attributes

std::map< std::string, std::string > cfg_
 
std::set< std::string > final_
 
std::map< std::string, std::function< std::string(std::string)> > helpers_
 
std::mutex mu_
 
std::map< std::string, std::tuple< std::string, std::string, std::string > > announced_
 

Detailed Description

simple class to hold configuration options

Definition at line 332 of file Misc.h.

Constructor & Destructor Documentation

◆ Configuration() [1/3]

etiss::Configuration::Configuration ( )

Definition at line 229 of file Misc.cpp.

◆ Configuration() [2/3]

etiss::Configuration::Configuration ( std::string  args)

Definition at line 230 of file Misc.cpp.

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

Here is the call graph for this function:

◆ Configuration() [3/3]

etiss::Configuration::Configuration ( const std::list< std::string > &  args)

Definition at line 238 of file Misc.cpp.

References get_metrics::args, and etiss_cfg_inConstructor.

Member Function Documentation

◆ announce()

void etiss::Configuration::announce ( std::string  key,
std::string  type = std::string(),
std::string  values = std::string(),
std::string  description = std::string() 
)

add a possible option to a list.

this is just for documentation purposes and has no effect on the configuration itself

Definition at line 548 of file Misc.cpp.

References get_metrics::type.

Referenced by etiss::ConfigAnnouncer::ConfigAnnouncer().

Here is the caller graph for this function:

◆ config()

std::map< std::string, std::string > & etiss::Configuration::config ( )

access to the configuration key value map

Definition at line 246 of file Misc.cpp.

◆ debug()

bool etiss::Configuration::debug ( )

Get the value of the key "debug".

Returns
The boolean value that is stored for the key "debug".

Definition at line 369 of file Misc.cpp.

◆ get() [1/10]

template<>
bool etiss::Configuration::get ( const std::string &  key,
bool  default_,
bool default_used 
)

◆ get() [2/10]

template<>
bool etiss::Configuration::get ( const std::string &  key,
bool  default_,
bool default_used 
)
Todo:
add compile flag to switch between c++11 and c++0x implementation

Definition at line 282 of file Misc.cpp.

References etiss::log(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ get() [3/10]

template<>
int etiss::Configuration::get ( const std::string &  key,
int  default_,
bool default_used 
)

◆ get() [4/10]

template<>
int etiss::Configuration::get ( const std::string &  key,
int  default_,
bool default_used 
)

Definition at line 313 of file Misc.cpp.

References etiss::log(), etiss::toString(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ get() [5/10]

template<>
std::string etiss::Configuration::get ( const std::string &  key,
std::string  default_,
bool default_used 
)

Definition at line 255 of file Misc.cpp.

References etiss::cfg(), get(), etiss::log(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ get() [6/10]

template<typename T >
T etiss::Configuration::get ( const std::string &  key,
default_,
bool default_used = 0 
)
inline

template function to read the value of a configuration key.

use specialization to provide std::string value conversion

Definition at line 349 of file Misc.h.

References etiss::ERROR, and etiss::log().

Referenced by etiss_initialize(), etiss_loadIniConfigs(), etiss_semihost_enabled(), etiss::CPUCore::execute(), get(), etiss::CPUArch::getIncludePath(), RV32IMACFDArch::initInstrSet(), RV64IMACFDArch::initInstrSet(), etiss::jitExtHeaderPaths(), etiss::jitExtHeaders(), etiss::jitExtLibPaths(), etiss::jitExtLibraries(), etiss::SimpleMemSystem::load_elf(), etiss::SimpleMemSystem::load_segments(), main(), etiss::preloadLibraries(), and etiss::Translation::translateBlock().

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

◆ get() [7/10]

template<>
uint64_t etiss::Configuration::get ( const std::string &  key,
uint64_t  default_,
bool default_used 
)

◆ get() [8/10]

template<>
uint64_t etiss::Configuration::get ( const std::string &  key,
uint64_t  default_,
bool default_used 
)

Definition at line 349 of file Misc.cpp.

References etiss::log(), etiss::toString(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ get() [9/10]

template<>
unsigned etiss::Configuration::get ( const std::string &  key,
unsigned  default_,
bool default_used 
)

◆ get() [10/10]

template<>
unsigned etiss::Configuration::get ( const std::string &  key,
unsigned  default_,
bool default_used 
)

Definition at line 331 of file Misc.cpp.

References etiss::log(), etiss::toString(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ getAnnounced()

std::map< std::string, std::tuple< std::string, std::string, std::string > > etiss::Configuration::getAnnounced ( ) const

get a map copy with announced options

Definition at line 554 of file Misc.cpp.

◆ isSet()

bool etiss::Configuration::isSet ( std::string  val)

return true if the value of an configuration key has been set

Definition at line 382 of file Misc.cpp.

Referenced by etiss::CPUCore::execute(), etiss::SimpleMemSystem::load_segments(), and set_cmd_line_boost().

Here is the caller graph for this function:

◆ listFullConfiguration()

std::map< std::string, std::string > etiss::Configuration::listFullConfiguration ( )

get a copy of the configuration as a map

Definition at line 522 of file Misc.cpp.

References etiss::cfg(), and cfg_.

Here is the call graph for this function:

◆ makeFinal()

void etiss::Configuration::makeFinal ( const std::string &  key)

makes an option final (option can no longer be changed)

Definition at line 542 of file Misc.cpp.

◆ operator=()

void etiss::Configuration::operator= ( Configuration &&  other)
inline

Definition at line 467 of file Misc.h.

References announced_, cfg_, final_, helpers_, and mu_.

◆ remove()

void etiss::Configuration::remove ( const std::string &  key)

removes a key value mapping

Definition at line 374 of file Misc.cpp.

Referenced by set_cmd_line_boost().

Here is the caller graph for this function:

◆ set() [1/2]

std::list< std::string > etiss::Configuration::set ( const std::list< std::string > &  args)

parses a list of parameters to apply to this config.

currently supported any boolean options in the style of -fOPTION (OPTION = true) and -fno-OPTION (OPTION = false) and string values in the form "-oOPTION value"

Returns
a list of input elements that have not been used in this function due to an unrecognized format

Definition at line 444 of file Misc.cpp.

References get_metrics::args, etiss::log(), etiss::VERBOSE, and etiss::WARNING.

Here is the call graph for this function:

◆ set() [2/2]

template<typename T >
bool etiss::Configuration::set ( const std::string &  key,
value 
)
inline

template function to set the value of a configuration key.

use specialization to provide to std::string conversion where a stringstream failes to convert the value

Returns
false if key is final

Definition at line 372 of file Misc.h.

References etiss::cfg(), cfg_, final_, helpers_, etiss::INFO, etiss::log(), mu_, and set().

Referenced by etiss_initialize(), etiss_loadIniConfigs(), RV32IMACFDArch::initInstrSet(), RV64IMACFDArch::initInstrSet(), etiss::SimpleMemSystem::load_elf(), main(), set(), and set_cmd_line_boost().

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

◆ set_cmd_line_boost()

std::pair< std::string, std::string > etiss::Configuration::set_cmd_line_boost ( const std::string &  s)
static

Definition at line 388 of file Misc.cpp.

References etiss::cfg(), isSet(), etiss::log(), remove(), s, set(), etiss::VERBOSE, and etiss::WARNING.

Referenced by etiss_initialize().

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

Member Data Documentation

◆ announced_

std::map<std::string, std::tuple<std::string, std::string, std::string> > etiss::Configuration::announced_
private

Definition at line 482 of file Misc.h.

Referenced by operator=().

◆ cfg_

std::map<std::string, std::string> etiss::Configuration::cfg_
private

Definition at line 478 of file Misc.h.

Referenced by listFullConfiguration(), operator=(), and set().

◆ final_

std::set<std::string> etiss::Configuration::final_
private

Definition at line 479 of file Misc.h.

Referenced by operator=(), and set().

◆ helpers_

std::map<std::string, std::function<std::string(std::string)> > etiss::Configuration::helpers_
private

Definition at line 480 of file Misc.h.

Referenced by operator=(), and set().

◆ mu_

std::mutex etiss::Configuration::mu_
mutableprivate

Definition at line 481 of file Misc.h.

Referenced by operator=(), and set().


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