![]() |
QMCPACK
|
Abstract class to provide xml-compatible I/O interfaces for the derived classes. More...
Public Types | |
enum | { useLIBXML = 0, useLIBXMLPP, usePLAIN } |
enumeration to choose the xml parser More... | |
Public Member Functions | |
OhmmsElementBase (const char *aname="none") | |
constructor with a name More... | |
virtual | ~OhmmsElementBase () |
destructor More... | |
const std::string & | getName () const |
return the name More... | |
void | setName (const std::string &aname) |
set name More... | |
void | setIOMode (int imode) |
set iomode More... | |
virtual bool | get (std::ostream &) const =0 |
write to a std::ostream More... | |
virtual bool | put (std::istream &)=0 |
read from std::istream More... | |
virtual bool | put (xmlNodePtr cur)=0 |
read from an xmlNode More... | |
virtual void | reset ()=0 |
reset member data More... | |
virtual bool | add (xmlNodePtr parent) |
add a xmlNode to the children list of parent More... | |
void | put (const std::string &s) |
read from string More... | |
virtual void | begin_node (std::ostream &os) const |
write the start of a node More... | |
virtual void | end_node (std::ostream &os) const |
write the end of a node More... | |
Protected Attributes | |
int | myIOMode |
the type of IO mode: default is useLIBXML More... | |
std::string | myName |
the name of the node, corresponds to the xml tag More... | |
Abstract class to provide xml-compatible I/O interfaces for the derived classes.
Generic interfaces using std::iostream are much preferred. However, there isn't any pure c++ xml parser that is based on std::iostream alone. After evaluating several xml parsers, JK chose libxml (The XML C parser and toolkit of gnome, http://www.xmlsoft.org) based on its performance and availability on many platforms.
The base class is written to be able to handle DTD or Schema in future. Current implementation assumes that each OhmmsElementBase object handles a node and its child nodes. However, it does not specify how the derived classes hanlde the child nodes.
Definition at line 40 of file OhmmsElementBase.h.
anonymous enum |
enumeration to choose the xml parser
Enumerator | |
---|---|
useLIBXML | using libxml2 library |
useLIBXMLPP | using libxml++ library |
usePLAIN | using ascii parser |
Definition at line 44 of file OhmmsElementBase.h.
|
inline |
constructor with a name
Definition at line 52 of file OhmmsElementBase.h.
|
inlinevirtual |
|
inlinevirtual |
add a xmlNode to the children list of parent
Reimplemented in OhmmsParameter< bool >, and OhmmsParameter< T >.
Definition at line 79 of file OhmmsElementBase.h.
|
inlinevirtual |
write the start of a node
Definition at line 89 of file OhmmsElementBase.h.
Referenced by XMLSaveParticle::get().
|
inlinevirtual |
write the end of a node
Definition at line 92 of file OhmmsElementBase.h.
Referenced by XMLSaveParticle::get().
|
pure virtual |
write to a std::ostream
Implemented in OhmmsParameter< bool >, ParticleSet, OhmmsParameter< T >, ParticleAttrib< T, Alloc >, ParticleAttrib< RealType >, ParticleAttrib< qmcplusplus::TinyVector >, RandomNumberControl, ParameterSet, and InitMolecularSystem.
Referenced by ParameterSet::get().
|
inline |
return the name
Definition at line 58 of file OhmmsElementBase.h.
References myName.
Referenced by HamiltonianFactory::addCoulombPotential(), HamiltonianFactory::addForceHam(), ParticleSet::addTable(), HamiltonianFactory::build(), RadialJastrowBuilder::buildComponent(), JastrowBuilder::buildCounting(), JastrowBuilder::buildOneBody(), CoulombPBCAA::CoulombPBCAA(), CountingJastrowBuilder::CountingJastrowBuilder(), qmcplusplus::createDistanceTableAB(), qmcplusplus::createDistanceTableABOMPTarget(), QMCGaussianParserBase::createElectronSet(), RadialJastrowBuilder::createJ1(), RadialJastrowBuilder::createJ2(), XMLSaveParticle::createNode(), ParticleSet::createSK(), ForceBase::ForceBase(), ChiesaCorrection::get(), LatticeDeviationEstimator::get(), SOECPotential::get(), L2Potential::get(), LocalECPotential::get(), NonLocalECPotential::get(), CoulombPBCAB::get(), CoulombPotential< T >::get(), PairCorrEstimator::PairCorrEstimator(), qmcplusplus::parse_electron_ion_pbc_z(), ParticleSet::ParticleSet(), ParticleSet::print(), ReferencePoints::put(), eeI_JastrowBuilder::putkids(), ParticleSet::resetGroups(), JastrowBuilder::resetOptions(), and qmcplusplus::TEST_CASE().
|
pure virtual |
read from std::istream
Implemented in OhmmsParameter< bool >, ParticleSet, OhmmsParameter< T >, ParticleAttrib< T, Alloc >, ParticleAttrib< RealType >, ParticleAttrib< qmcplusplus::TinyVector >, RandomNumberControl, ParameterSet, and InitMolecularSystem.
Referenced by put().
|
pure virtual |
read from an xmlNode
Implemented in OhmmsParameter< bool >, ParticleSet, OhmmsParameter< T >, ParticleAttrib< T, Alloc >, ParticleAttrib< RealType >, ParticleAttrib< qmcplusplus::TinyVector >, ParameterSet, RandomNumberControl, and InitMolecularSystem.
|
inline |
read from string
Definition at line 82 of file OhmmsElementBase.h.
References put(), and qmcplusplus::Units::time::s.
|
pure virtual |
reset member data
Implemented in OhmmsParameter< bool >, OhmmsParameter< T >, ParticleSet, ParticleAttrib< T, Alloc >, ParticleAttrib< RealType >, ParticleAttrib< qmcplusplus::TinyVector >, ParameterSet, RandomNumberControl, and InitMolecularSystem.
|
inline |
set iomode
Definition at line 64 of file OhmmsElementBase.h.
References myIOMode.
|
inline |
set name
Definition at line 61 of file OhmmsElementBase.h.
References myName.
Referenced by PWParameterSet::PWParameterSet().
|
protected |
the type of IO mode: default is useLIBXML
Definition at line 96 of file OhmmsElementBase.h.
Referenced by setIOMode().
|
protected |
the name of the node, corresponds to the xml tag
Definition at line 99 of file OhmmsElementBase.h.
Referenced by OhmmsParameter< T >::add(), OhmmsParameter< bool >::add(), ParticleSet::addTable(), OhmmsParameter< T >::checkValues(), OhmmsParameter< T >::get(), OhmmsParameter< bool >::get(), getName(), OhmmsObject::objName(), ParticleSet::ParticleSet(), ParameterSet::put(), OhmmsParameter< T >::put(), OhmmsParameter< bool >::put(), ParticleSet::resetGroups(), setName(), ParticleSet::setName(), and OhmmsObject::setObjName().