ETISS 0.8.0
Extendable Translating Instruction Set Simulator (version 0.8.0)
XML.h
Go to the documentation of this file.
1 
52 #ifndef ETISS_FAULT_XML_H_
53 #define ETISS_FAULT_XML_H_
54 
55 #include <list>
56 #include <string>
57 
58 #ifndef NO_ETISS
59 #include "etiss/fault/Defs.h"
61 #else
62 #include "fault/Defs.h"
63 #include "fault/xml/pugixml.hpp"
64 #endif
65 
66 #include <cstdio>
67 
68 namespace etiss
69 {
70 
71 namespace fault
72 {
73 
74 // some helper for changing Core Names
75 extern int coreIDActuallXML;
76 void setCoreName(std::string &str);
77 
78 #if ETISS_FAULT_XML
79 
115 namespace xml
116 {
117 
121 class Diagnostics
122 {
123  public:
124  std::list<std::string> warnings;
125  std::list<std::string> errors;
126  void ignoredNode(const pugi::xml_node &node, const std::string &msg);
127  void unexpectedNode(const pugi::xml_node &node, const std::string &msg);
128  void print(std::ostream &out) const;
129 };
130 
132 #if CXX0X_UP_SUPPORTED
133 template <typename T>
134 bool parse(pugi::xml_node node, T &dst, Diagnostics &diag)
135 {
136  static_assert((sizeof(T) == -1), "etiss::fault::xml::parse needs to be specialized.");
137  return false;
138 }
139 template <typename T>
140 bool write(pugi::xml_node node, const T &src, Diagnostics &diag)
141 {
142  static_assert((sizeof(T) == -1), "etiss::fault::xml::write needs to be specialized.");
143  return false;
144 }
145 #else
146 template <typename T>
147 bool parse(pugi::xml_node node, T &dst, Diagnostics &diag);
148 template <typename T>
149 bool write(pugi::xml_node node, const T &src, Diagnostics &diag);
150 #endif
151 
152 #if CXX0X_UP_SUPPORTED
153 template <typename T>
154 bool parse_attr(pugi::xml_node node, const std::string &attr_name, T &dst, Diagnostics &diag)
155 {
156  static_assert((sizeof(T) == -1), "etiss::fault::xml::parse_attr needs to be specialized.");
157  return false;
158 }
159 template <typename T>
160 bool write_attr(pugi::xml_node node, const std::string &attr_name, const T &src, Diagnostics &diag)
161 {
162  static_assert((sizeof(T) == -1), "etiss::fault::xml::write_attr needs to be specialized.");
163  return false;
164 }
165 #else
166 template <typename T>
167 bool parse_attr(pugi::xml_node node, const std::string &attr_name, T &dst, Diagnostics &diag);
168 template <typename T>
169 bool write_attr(pugi::xml_node node, const std::string &attr_name, const T &src, Diagnostics &diag);
170 #endif
171 
173 
174 template <>
175 bool parse<std::string>(pugi::xml_node node, std::string &dst, Diagnostics &diag);
176 template <>
177 bool write<std::string>(pugi::xml_node node, const std::string &src, Diagnostics &diag);
178 
179 template <>
180 bool parse<uint64_t>(pugi::xml_node node, uint64_t &dst, Diagnostics &diag);
181 
182 bool parse_hex(pugi::xml_node node, uint64_t &dst, Diagnostics &diag);
183 template <>
184 bool write<uint64_t>(pugi::xml_node node, const uint64_t &src, Diagnostics &diag);
185 
186 template <>
187 bool parse<unsigned>(pugi::xml_node node, unsigned &dst, Diagnostics &diag);
188 template <>
189 bool write<unsigned>(pugi::xml_node node, const unsigned &src, Diagnostics &diag);
190 
191 template <>
192 bool parse_attr<std::string>(pugi::xml_node node, const std::string &attr_name, std::string &dst, Diagnostics &diag);
193 template <>
194 bool write_attr<std::string>(pugi::xml_node node, const std::string &attr_name, const std::string &src,
195  Diagnostics &diag);
196 
198 template <typename T>
200 bool fromString(const std::string &s, T &val);
201 
202 template <>
203 bool fromString<uint64_t>(const std::string &s, uint64_t &val);
204 template <>
205 bool fromString<unsigned>(const std::string &s, unsigned &val);
206 
207 bool hasName(const pugi::xml_node &node, const std::string &name);
208 bool hasName(const pugi::xml_attribute &attr, const std::string &name);
209 
210 pugi::xml_node findSingleNode(pugi::xml_node node, const std::string &name, Diagnostics &diag);
211 
213 
214 } // namespace xml
215 #endif
216 } // namespace fault
217 
218 } // namespace etiss
219 
220 #endif
contains general definitions used by other fault library code
#define static_assert(x, y)
Definition: Fault.cpp:60
__device__ __2f16 float bool s
static __inline__ uint64_t
Definition: arm_cde.h:31
void setCoreName(std::string &str)
Definition: XML.cpp:62
int coreIDActuallXML
Definition: XML.cpp:61
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
Definition: Benchmark.h:53