ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
Functions
etiss::fault::xml Namespace Reference

Functions

static bool getAttribute (const pugi::xml_node &node, const std::string &attr_name, std::string &dst, Diagnostics &diag)
 Parser/writer structure: More...
 
static bool setAttribute (pugi::xml_node &node, const std::string &attr_name, const std::string &src, Diagnostics &diag)
 
static bool getAttribute (const pugi::xml_node &node, const std::string &attr_name, int32_t &dst, Diagnostics &diag)
 
static bool setAttribute (pugi::xml_node &node, const std::string &attr_name, const int32_t &src, Diagnostics &diag)
 
template<>
bool parse< std::vector< etiss::fault::Fault > > (pugi::xml_node node, std::vector< etiss::fault::Fault > &dst, Diagnostics &diag)
 
template<>
bool write< std::vector< etiss::fault::Fault > > (pugi::xml_node node, const std::vector< etiss::fault::Fault > &src, Diagnostics &diag)
 

Function Documentation

◆ getAttribute() [1/2]

static bool etiss::fault::xml::getAttribute ( const pugi::xml_node node,
const std::string &  attr_name,
int32_t dst,
Diagnostics &  diag 
)
static

TODO propper conversion

Definition at line 135 of file Fault.cpp.

References getAttribute().

Here is the call graph for this function:

◆ getAttribute() [2/2]

static bool etiss::fault::xml::getAttribute ( const pugi::xml_node node,
const std::string &  attr_name,
std::string &  dst,
Diagnostics &  diag 
)
static

Parser/writer structure:

class and field structure is closely modeled by the xml structure. each class is a node and each field is either a sub node or an attribute. This allows for a simple parsing concept. the template function parse() is implemented for each type that needs to be read and is called recursively for fields of different types. parsed values are written directly into the fields. This requires all fields to be public/accessible e.g.

C++:
class Fault {
class Trigger {
[...]
};
std::vector<Trigger> triggers;
const char * name;
};
XML:
<fault name="...">
<triggers>
<trigger>
[...]
</trigger>
</triggers>
</fault>
example parser recursion:
parse<Fault>(...)
parse<std::vector<Trigger> >(...)
parse<Trigger>(...)
[...]
getAttribute("name",...)
static bool getAttribute(const pugi::xml_node &node, const std::string &attr_name, std::string &dst, Diagnostics &diag)
Parser/writer structure:
Definition: Fault.cpp:110

Definition at line 110 of file Fault.cpp.

References pugi::xml_node::first_attribute(), and pugi::xml_attribute::next_attribute().

Referenced by getAttribute().

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

◆ parse< std::vector< etiss::fault::Fault > >()

template<>
bool etiss::fault::xml::parse< std::vector< etiss::fault::Fault > > ( pugi::xml_node  node,
std::vector< etiss::fault::Fault > &  dst,
Diagnostics &  diag 
)

Definition at line 152 of file Fault.cpp.

References pugi::xml_node::first_child(), etiss::log(), pugi::xml_node::next_sibling(), and etiss::VERBOSE.

Here is the call graph for this function:

◆ setAttribute() [1/2]

static bool etiss::fault::xml::setAttribute ( pugi::xml_node node,
const std::string &  attr_name,
const int32_t src,
Diagnostics &  diag 
)
static

Definition at line 143 of file Fault.cpp.

References pugi::xml_node::append_attribute(), int32_t, pugi::xml_attribute::set_value(), and static_assert.

Here is the call graph for this function:

◆ setAttribute() [2/2]

static bool etiss::fault::xml::setAttribute ( pugi::xml_node node,
const std::string &  attr_name,
const std::string &  src,
Diagnostics &  diag 
)
static

Definition at line 130 of file Fault.cpp.

References pugi::xml_node::append_attribute(), and pugi::xml_attribute::set_value().

Here is the call graph for this function:

◆ write< std::vector< etiss::fault::Fault > >()

template<>
bool etiss::fault::xml::write< std::vector< etiss::fault::Fault > > ( pugi::xml_node  node,
const std::vector< etiss::fault::Fault > &  src,
Diagnostics &  diag 
)

Definition at line 182 of file Fault.cpp.

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

Here is the call graph for this function: