![]() |
QMCPACK
|
An OhmmsElementBase with extra members to keep track the object/type. More...
Public Member Functions | |
OhmmsObject () | |
default constructor More... | |
OhmmsObject (const std::string &tname, const std::string &oname) | |
contructor More... | |
~OhmmsObject () override | |
int | id () const |
return the ObjectID which is unique to each object More... | |
void | setID (int i) |
overwrite ObjectID More... | |
int | elementByteSize () const |
returns the byte size of the object More... | |
void | setTypeName (const std::string &tname) |
set the type name More... | |
void | setObjName (const std::string &oname) |
set the object name More... | |
const std::string & | typeName () const |
return the type name More... | |
const std::string & | objName () const |
return the object name More... | |
virtual OhmmsObject * | makeClone () const =0 |
![]() | |
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 | |
std::string | TypeName |
the type name of this object More... | |
int | ObjectID |
the unique ID of this object More... | |
int | ElementByteSize |
the byte size of this object More... | |
![]() | |
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... | |
Additional Inherited Members | |
![]() | |
enum | { useLIBXML = 0, useLIBXMLPP, usePLAIN } |
enumeration to choose the xml parser More... | |
An OhmmsElementBase with extra members to keep track the object/type.
Additional data members of OhmmsObject are
It is common for class libraries or applications to have a base class that has an object counter for garbage collections and other functions. This base class is not that smart but enables keeping track the list unique for a process and makes it easy to retrieve an object with a name.
Definition at line 43 of file OhmmsObject.h.
OhmmsObject | ( | ) |
default constructor
Assign meaningless object and type names. Not givng a name to an object is OKAY as far as the object is not requested from a pool.
Definition at line 28 of file OhmmsObject.cpp.
OhmmsObject | ( | const std::string & | tname, |
const std::string & | oname | ||
) |
contructor
tname | the name of the type |
oname | the name of the object Assign a unique ObjectID using the static data member ObjectCounter |
Definition at line 42 of file OhmmsObject.cpp.
|
override |
Definition at line 52 of file OhmmsObject.cpp.
|
inline |
returns the byte size of the object
Definition at line 57 of file OhmmsObject.h.
References ElementByteSize.
|
inline |
return the ObjectID which is unique to each object
Definition at line 51 of file OhmmsObject.h.
References ObjectID.
|
pure virtual |
Implemented in ParticleAttrib< T, Alloc >, ParticleAttrib< RealType >, and ParticleAttrib< qmcplusplus::TinyVector >.
|
inline |
return the object name
Definition at line 69 of file OhmmsObject.h.
References OhmmsElementBase::myName.
Referenced by AttribListType::add().
|
inline |
overwrite ObjectID
Definition at line 54 of file OhmmsObject.h.
References ObjectID.
Referenced by AttribListType::add().
|
inline |
set the object name
Definition at line 63 of file OhmmsObject.h.
References OhmmsElementBase::myName.
Referenced by ParticleSet::createAttributeList().
|
inline |
set the type name
Definition at line 60 of file OhmmsObject.h.
References TypeName.
Referenced by ParticleSet::createAttributeList().
|
inline |
|
protected |
the byte size of this object
Definition at line 81 of file OhmmsObject.h.
Referenced by elementByteSize().
|
protected |
the unique ID of this object
Definition at line 78 of file OhmmsObject.h.
|
protected |
the type name of this object
Definition at line 75 of file OhmmsObject.h.
Referenced by setTypeName(), and typeName().