|
QDP++
|
XML reader class. More...
#include <qdp_xmlio.h>
Public Member Functions | |
| XMLReader () | |
| Empty constructor. | |
| XMLReader (const std::string &filename) | |
| Construct from contents of file. | |
| XMLReader (std::istream &is) | |
| Construct from contents of stream. | |
| XMLReader (const XMLBufferWriter &mw) | |
| Construct from contents of a XMLBufferWriter. | |
| XMLReader (XMLReader &old, const std::string &xpath) | |
| Clone a reader but with a possibly different path. | |
| ~XMLReader () | |
| void | open (const std::string &filename) |
| Opens and reads an XML file. | |
| void | open (std::istream &is) |
| Opens and reads an XML file. | |
| void | open (const XMLBufferWriter &mw) |
| Reads content of a XMLBufferWriter. | |
| bool | is_open () |
| Queries whether the binary file is open. | |
| bool | is_derived () const |
| Queries whether the XML data has been obtained from another XMLReader. | |
| void | close () |
| Closes the last file opened. | |
| void | get (const std::string &xpath, std::string &result) |
| Xpath query. | |
| void | get (const std::string &xpath, int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, unsigned int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, short int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, unsigned short int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, long int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, unsigned long int &result) |
| Xpath query. | |
| void | get (const std::string &xpath, float &result) |
| Xpath query. | |
| void | get (const std::string &xpath, double &result) |
| Xpath query. | |
| void | get (const std::string &xpath, bool &result) |
| Xpath query. | |
| void | getAttribute (const std::string &xpath, const std::string &attrib_name, int &result) |
| read integer attributes so that I can read Matrices in XML | |
| template<typename T> | |
| void | set (const std::string &xpath, const T &to_set) |
| Set a replacement of a primitive. | |
| void | print (std::ostream &is) |
| Return the entire contents of the Reader as a stream. | |
| void | printCurrentContext (std::ostream &is) |
| Print the current context. | |
| int | count (const std::string &xpath) |
| Count the number of occurances from the Xpath query. | |
| void | registerNamespace (const std::string &prefix, const std::string &uri) |
Protected Member Functions | |
| template<typename T> | |
| void | readPrimitive (const std::string &xpath, T &output) |
| template<typename T> | |
| void | readAttrPrimitive (const std::string &xpath, const std::string &attrib_name, T &result) |
XML reader class.
This is used to read data from an XML file using Xpath.
Note that only the primary node opens and reads XML files. Results from Xpath queries are broadcast to all nodes.
Definition at line 43 of file qdp_xmlio.h.
| QDP::XMLReader::XMLReader | ( | ) |
| QDP::XMLReader::XMLReader | ( | const std::string & | filename | ) |
Construct from contents of file.
Opens and reads an XML file.
| filename | The name of the file. |
Definition at line 19 of file qdp_xmlio.cc.
References open().
| QDP::XMLReader::XMLReader | ( | std::istream & | is | ) |
| QDP::XMLReader::XMLReader | ( | const XMLBufferWriter & | mw | ) |
Construct from contents of a XMLBufferWriter.
Definition at line 31 of file qdp_xmlio.cc.
References open().
| QDP::XMLReader::XMLReader | ( | XMLReader & | old, |
| const std::string & | xpath ) |
Clone a reader but with a possibly different path.
Definition at line 37 of file qdp_xmlio.cc.
References open(), and XMLReader().
| QDP::XMLReader::~XMLReader | ( | ) |
Definition at line 125 of file qdp_xmlio.cc.
References close().
| void QDP::XMLReader::close | ( | ) |
Closes the last file opened.
Definition at line 107 of file qdp_xmlio.cc.
References is_open(), and QDP::Layout::primaryNode().
Referenced by QDP::read(), QDP::read(), QDP::read(), QDP::read(), and ~XMLReader().
| int QDP::XMLReader::count | ( | const std::string & | xpath | ) |
Count the number of occurances from the Xpath query.
Definition at line 242 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast(), and QDP::Layout::primaryNode().
Referenced by QDP::read(), QDP::read(), QDP::read(), QDP::read(), and QDP::read().
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| bool & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| double & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| float & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| int & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| long int & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| short int & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| std::string & | result ) |
Xpath query.
Definition at line 129 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast_str(), and QDP::Layout::primaryNode().
Referenced by QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), QDP::read(), and QDP::read().
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| unsigned int & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| unsigned long int & | result ) |
| void QDP::XMLReader::get | ( | const std::string & | xpath, |
| unsigned short int & | result ) |
| void QDP::XMLReader::getAttribute | ( | const std::string & | xpath, |
| const std::string & | attrib_name, | ||
| int & | result ) |
read integer attributes so that I can read Matrices in XML
Definition at line 176 of file qdp_xmlio.cc.
References readAttrPrimitive().
| bool QDP::XMLReader::is_derived | ( | ) | const |
Queries whether the XML data has been obtained from another XMLReader.
A private method allows this XMLReader to be copy the contents of another.
Definition at line 123 of file qdp_xmlio.cc.
Referenced by printCurrentContext().
| bool QDP::XMLReader::is_open | ( | ) |
Queries whether the binary file is open.
Definition at line 121 of file qdp_xmlio.cc.
Referenced by close().
| void QDP::XMLReader::open | ( | const std::string & | filename | ) |
Opens and reads an XML file.
| filename | The name of the file |
Definition at line 45 of file qdp_xmlio.cc.
References QDP::QDPIO::cerr, QDP::Layout::primaryNode(), and QDP::QDP_abort().
Referenced by QDP::QDPFileReader::open(), QDP::QDPFileReader::read(), QDP::QDPFileReader::read(), QDP::QDPFileReader::read(), QDP::QDPFileReader::read(), QDP::QDPFileReader::read(), QDP::QDPFileReader::read(), QDP::readArchiv(), XMLReader(), XMLReader(), XMLReader(), and XMLReader().
| void QDP::XMLReader::open | ( | const XMLBufferWriter & | mw | ) |
Reads content of a XMLBufferWriter.
Definition at line 84 of file qdp_xmlio.cc.
References QDP::Layout::primaryNode().
| void QDP::XMLReader::open | ( | std::istream & | is | ) |
Opens and reads an XML file.
| id | The input stream of the file |
Definition at line 75 of file qdp_xmlio.cc.
References QDP::Layout::primaryNode().
| void QDP::XMLReader::print | ( | std::ostream & | is | ) |
Return the entire contents of the Reader as a stream.
Definition at line 206 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast_str(), and QDP::Layout::primaryNode().
| void QDP::XMLReader::printCurrentContext | ( | std::ostream & | is | ) |
Print the current context.
Definition at line 222 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast_str(), is_derived(), and QDP::Layout::primaryNode().
|
protected |
Definition at line 194 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast(), and QDP::Layout::primaryNode().
Referenced by getAttribute().
|
protected |
Definition at line 183 of file qdp_xmlio.cc.
References QDP::QDPInternal::broadcast(), and QDP::Layout::primaryNode().
Referenced by get(), get(), get(), get(), get(), get(), get(), get(), and get().
| void QDP::XMLReader::registerNamespace | ( | const std::string & | prefix, |
| const std::string & | uri ) |
Definition at line 254 of file qdp_xmlio.cc.
References QDP::Layout::primaryNode().
|
inline |
Set a replacement of a primitive.
Definition at line 130 of file qdp_xmlio.h.
References QDP::Layout::primaryNode().