ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
|
simple class to hold configuration options More...
#include <Misc.h>
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 > | |
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_ |
etiss::Configuration::Configuration | ( | std::string | args | ) |
Definition at line 230 of file Misc.cpp.
References get_metrics::args, and etiss::parseCommands().
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.
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().
std::map< std::string, std::string > & etiss::Configuration::config | ( | ) |
bool etiss::Configuration::debug | ( | ) |
bool etiss::Configuration::get | ( | const std::string & | key, |
bool | default_, | ||
bool * | default_used | ||
) |
bool etiss::Configuration::get | ( | const std::string & | key, |
bool | default_, | ||
bool * | default_used | ||
) |
Definition at line 282 of file Misc.cpp.
References etiss::log(), and etiss::VERBOSE.
int etiss::Configuration::get | ( | const std::string & | key, |
int | default_, | ||
bool * | default_used | ||
) |
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.
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.
|
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().
uint64_t etiss::Configuration::get | ( | const std::string & | key, |
uint64_t | default_, | ||
bool * | default_used | ||
) |
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.
unsigned etiss::Configuration::get | ( | const std::string & | key, |
unsigned | default_, | ||
bool * | default_used | ||
) |
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.
std::map< std::string, std::tuple< std::string, std::string, std::string > > etiss::Configuration::getAnnounced | ( | ) | const |
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().
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_.
void etiss::Configuration::makeFinal | ( | const std::string & | key | ) |
|
inline |
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().
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"
Definition at line 444 of file Misc.cpp.
References get_metrics::args, etiss::log(), etiss::VERBOSE, and etiss::WARNING.
|
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
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().
|
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().
|
private |
Definition at line 482 of file Misc.h.
Referenced by operator=().
|
private |
Definition at line 478 of file Misc.h.
Referenced by listFullConfiguration(), operator=(), and set().
|
private |
Definition at line 479 of file Misc.h.
Referenced by operator=(), and set().
|
private |
Definition at line 480 of file Misc.h.
Referenced by operator=(), and set().
|
mutableprivate |
Definition at line 481 of file Misc.h.
Referenced by operator=(), and set().