Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

OhmmsElementBase Class Reference

Abstract class to provide xml-compatible I/O interfaces for the derived classes. More...

Inheritance diagram for OhmmsElementBase:

Inheritance graph
[legend]
Collaboration diagram for OhmmsElementBase:

Collaboration graph
[legend]
List of all members.

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

virtual ~OhmmsElementBase ()
 destructor

const std::string & getName () const
 return the name

void setName (const std::string &aname)
 set name

void setIOMode (int imode)
 set iomode

virtual bool get (std::ostream &) const =0
 write to a ostream

virtual bool put (std::istream &)=0
 read from istream

virtual bool put (xmlNodePtr cur)=0
 read from an xmlNode

virtual void reset ()=0
 reset member data

virtual bool add (xmlNodePtr parent)
 add a xmlNode to the children list of parent

void put (const std::string &s)
 read from string

virtual void begin_node (std::ostream &os) const
 write the start of a node

virtual void end_node (std::ostream &os) const
 write the end of a node


Protected Attributes

int myIOMode
 the type of IO mode: default is useLIBXML

std::string myName
 the name of the node, corresponds to the xml tag


Detailed Description

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 56 of file OhmmsElementBase.h.


Member Enumeration Documentation

anonymous enum
 

enumeration to choose the xml parser

Enumeration values:
useLIBXML  using libxml2 library
useLIBXMLPP  using libxml++ library
usePLAIN  using ascii parser

Definition at line 61 of file OhmmsElementBase.h.


Constructor & Destructor Documentation

OhmmsElementBase::OhmmsElementBase const char *  aname = "none"  )  [inline]
 

constructor with a name

Definition at line 67 of file OhmmsElementBase.h.

References myIOMode, myName, and useLIBXML.

virtual OhmmsElementBase::~OhmmsElementBase  )  [inline, virtual]
 

destructor

Definition at line 72 of file OhmmsElementBase.h.


Member Function Documentation

virtual bool OhmmsElementBase::add xmlNodePtr  parent  )  [inline, virtual]
 

add a xmlNode to the children list of parent

Definition at line 96 of file OhmmsElementBase.h.

virtual void OhmmsElementBase::begin_node std::ostream &  os  )  const [inline, virtual]
 

write the start of a node

Reimplemented in OHMMS::ParticleSet.

Definition at line 105 of file OhmmsElementBase.h.

virtual void OhmmsElementBase::end_node std::ostream &  os  )  const [inline, virtual]
 

write the end of a node

Reimplemented in OHMMS::ParticleSet.

Definition at line 108 of file OhmmsElementBase.h.

virtual bool OhmmsElementBase::get std::ostream &   )  const [pure virtual]
 

write to a ostream

Implemented in OHMMS::ParticleSet, and OHMMS::FreeEnergyMC.

const std::string& OhmmsElementBase::getName  )  const [inline]
 

return the name

Definition at line 75 of file OhmmsElementBase.h.

References myName.

void OhmmsElementBase::put const std::string &  s  )  [inline]
 

read from string

Definition at line 99 of file OhmmsElementBase.h.

References put().

virtual bool OhmmsElementBase::put xmlNodePtr  cur  )  [pure virtual]
 

read from an xmlNode

Implemented in OHMMS::ParticleSet, and OHMMS::FreeEnergyMC.

virtual bool OhmmsElementBase::put std::istream &   )  [pure virtual]
 

read from istream

Implemented in OHMMS::ParticleSet, and OHMMS::FreeEnergyMC.

Referenced by put().

virtual void OhmmsElementBase::reset  )  [pure virtual]
 

reset member data

Implemented in OHMMS::ParticleSet, and OHMMS::FreeEnergyMC.

void OhmmsElementBase::setIOMode int  imode  )  [inline]
 

set iomode

Definition at line 81 of file OhmmsElementBase.h.

References myIOMode.

void OhmmsElementBase::setName const std::string &  aname  )  [inline]
 

set name

Definition at line 78 of file OhmmsElementBase.h.

References myName.


Member Data Documentation

int OhmmsElementBase::myIOMode [protected]
 

the type of IO mode: default is useLIBXML

Definition at line 113 of file OhmmsElementBase.h.

Referenced by OhmmsElementBase(), and setIOMode().

std::string OhmmsElementBase::myName [protected]
 

the name of the node, corresponds to the xml tag

Definition at line 116 of file OhmmsElementBase.h.

Referenced by getName(), OhmmsElementBase(), and setName().


The documentation for this class was generated from the following file:
Generated on Thu Aug 12 18:35:17 2004 for ohmms by doxygen 1.3.4