![]() |
QMCPACK
|
A collection of put/get functions to read from or write to a xmlNode defined in libxml2. More...
Go to the source code of this file.
Functions | |
char * | castXMLCharToChar (xmlChar *c) |
assign a value from a node. Use specialization for classes. More... | |
const char * | castXMLCharToChar (const xmlChar *c) |
unsafe const xmlChar* to const char* cast More... | |
xmlChar * | castCharToXMLChar (char *c) |
unsafe char* to xmlChar* cast More... | |
const xmlChar * | castCharToXMLChar (const char *c) |
unsafe const char* to const xmlChar* cast More... | |
std::string | getNodeName (xmlNodePtr cur) |
template<class T > | |
bool | putContent (T &a, xmlNodePtr cur) |
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}. More... | |
template<class IT > | |
bool | putContent (IT first, IT last, xmlNodePtr cur) |
template<class T > | |
bool | getContent (const T &a, xmlNodePtr cur) |
write a value to a node. More... | |
template<class T > | |
bool | putContent (std::vector< T > &a, const xmlNodePtr cur) |
assign std::vector<T> from a node. More... | |
template<class T > | |
bool | getContent (const std::vector< T > &a, xmlNodePtr cur) |
write std::vector<T> to node. More... | |
template<class F > | |
void | processChildren (const xmlNodePtr cur, const F &functor) |
process through all the children of an XML element F is a lambda or functor void F/[](const std::string& cname, const xmlNodePtr element) {...} More... | |
A collection of put/get functions to read from or write to a xmlNode defined in libxml2.
Definition in file libxmldefs.h.
|
inline |
unsafe char* to xmlChar* cast
Definition at line 70 of file libxmldefs.h.
Referenced by getXMLAttributeValue(), qmcplusplus::TEST_CASE(), qmcplusplus::test_EtOH_mw(), qmcplusplus::test_HCN(), qmcplusplus::test_He(), qmcplusplus::test_He_mw(), and qmcplusplus::test_Ne().
|
inline |
unsafe const char* to const xmlChar* cast
Definition at line 74 of file libxmldefs.h.
|
inline |
assign a value from a node. Use specialization for classes.
a | reference to a value to be assigned |
cur | current node |
If operator >> is implemented for a class, no specialization is required. For instance, no specialization is necessary for intrinsic data types. A simle class that reads the temperature from a xml node
<parameter name="temperature" condition="K">100</parameter>
xmlChar* to char* cast certainly not typesafe but at this interface between libxml and c++ well it beats c style casts and might be more correct than a reinterpret.
This is fine with UTF-8 bytes going into a std::string.
Definition at line 62 of file libxmldefs.h.
Referenced by AGPDeterminantBuilder::createAGP(), RadialJastrowBuilder::createJ1(), getNodeName(), getXMLAttributeValue(), ParameterSet::put(), ShortRangeCuspFunctor< T >::put(), InputSection::readAttributes(), QMCDriverFactory::readSection(), QMCDriverInput::readXML(), EstimatorManagerInput::readXML(), and InputSection::readXML().
|
inline |
unsafe const xmlChar* to const char* cast
Definition at line 66 of file libxmldefs.h.
bool getContent | ( | const T & | a, |
xmlNodePtr | cur | ||
) |
write a value to a node.
a | reference to a value to be copied to a node |
cur | current node to which a content is copied |
Use specialization for classes. If operator << is implemented for a class, no specialization is required. For instance, no specialization is necessary for intrinsic data types.
Definition at line 119 of file libxmldefs.h.
References qmcplusplus::Units::time::s, and XMLNodeString::setXMLNodeContent().
Referenced by OhmmsParameter< T >::add(), OhmmsParameter< bool >::add(), QMCDriver::getQMCNode(), OhmmsParameter< T >::reset(), OhmmsParameter< bool >::reset(), and QMCCostFunctionBase::updateXmlNodes().
|
inline |
write std::vector<T> to node.
Each element is separated by a space.
a | reference std::vector<T> |
cur | current node to which a content is copied |
Specialization for std::vector<T> with data types T with operator <<. This function is only for testing/debugging and will not perform well for large vectors. Use HDF5 library for the real data.
Definition at line 159 of file libxmldefs.h.
References qmcplusplus::Units::time::s, and XMLNodeString::setXMLNodeContent().
std::string getNodeName | ( | xmlNodePtr | cur | ) |
Definition at line 15 of file libxmldefs.cpp.
References castXMLCharToChar(), and qmcplusplus::lowerCase().
Referenced by BackflowBuilder::addOneBody(), BackflowBuilder::addRPA(), BackflowBuilder::addTwoBody(), BackflowBuilder::buildBackflowTransformation(), AGPDeterminantBuilder::buildComponent(), SlaterDetBuilder::buildComponent(), SlaterDetBuilder::createMSDFast(), SPOSetScanner::put(), qmcplusplus::readCuspInfo(), SlaterDetBuilder::readDetList(), SlaterDetBuilder::readDetListH5(), and TEST_CASE().
void processChildren | ( | const xmlNodePtr | cur, |
const F & | functor | ||
) |
process through all the children of an XML element F is a lambda or functor void F/[](const std::string& cname, const xmlNodePtr element) {...}
Definition at line 175 of file libxmldefs.h.
Referenced by HamiltonianFactory::build(), SPOSetBuilderFactory::buildSPOSetCollection(), SPOSetBuilder::createRotatedSPOSet(), LCAOrbitalBuilder::createSPOSetFromXML(), LCAOrbitalBuilder::LCAOrbitalBuilder(), QMCFixedSampleLinearOptimizeBatched::process(), QMCFixedSampleLinearOptimize::put(), XMLParticleParser::readXML(), qmcplusplus::test_lcao_spinor(), qmcplusplus::test_lcao_spinor_excited(), and qmcplusplus::test_lcao_spinor_ion_derivs().
bool putContent | ( | T & | a, |
xmlNodePtr | cur | ||
) |
replaces a's value with the first "element" in the "string" returned by XMLNodeString{cur}.
but if that string is empty then then doesn't touch a. See documentation of the interaction between operator>> streams and the FormattedInputFunction requirement in the c++ standard.
Definition at line 88 of file libxmldefs.h.
Referenced by BackflowBuilder::addOneBody(), SymmetryBuilder::buildByHand(), ECPComponentBuilder::buildL2(), ECPComponentBuilder::buildSemiLocalAndLocal(), WaveFunctionFactory::buildTWF(), CountingJastrowBuilder::createCJ(), ECPComponentBuilder::createGrid(), PWOrbitalSetBuilder::createPW(), SPOSetBuilder::createRotatedSPOSet(), SPOSetBuilder::createSPOSet(), EinsplineSpinorSetBuilder::createSPOSetFromXML(), CompositeSPOSetBuilder::createSPOSetFromXML(), EinsplineSetBuilder::createSPOSetFromXML(), BackflowBuilder::makeLongRange_twoBody(), LatticeParser::put(), SpinDensity::put(), ExampleHeComponent::put(), SPOSetInputInfo::put(), QMCCostFunctionBase::put(), OhmmsParameter< T >::put(), OrbitalImages::put(), PadeFunctor< T >::put(), CountingGaussian::put(), UserFunctor< T >::put(), ParticleAttribXmlNode< PAT >::put(), BsplineFunctor< REAL >::put(), ShortRangeCuspFunctor< T >::put(), Pade2ndOrderFunctor< T >::put(), PadeTwo2ndOrderFunctor< T >::put(), PolynomialFunctor3D::put(), TraceManager::put(), LCAOrbitalBuilder::putFromXML(), LCAOrbitalBuilder::putOccupation(), SpinDensityInput::readXML(), XMLParticleParser::readXML(), QMCCostFunctionBase::resetCostFunction(), WaveFunctionTester::runNodePlot(), DensityMatrices1B::set_state(), ShortRangeCuspFunctor< T >::set_variable_from_xml(), qmcplusplus::setSpeciesProperty(), and TEST_CASE().
bool putContent | ( | IT | first, |
IT | last, | ||
xmlNodePtr | cur | ||
) |
Definition at line 96 of file libxmldefs.h.
|
inline |
assign std::vector<T> from a node.
Create a temporary vector and make assignment.
a | reference std::vector<T> |
cur | current node to which a content is copied |
Specialization for std::vector<T> with data types T with operator >>, e.g., std::vector<double>
Definition at line 141 of file libxmldefs.h.