--- branches/new_design/OOPSE-2.0/src/types/AtomType.hpp 2004/11/15 18:02:15 1739 +++ branches/new_design/OOPSE-2.0/src/types/AtomType.hpp 2004/11/15 23:00:32 1740 @@ -1,70 +1,170 @@ #ifndef TYPES_ATOMTYPE_HPP + #define TYPES_ATOMTYPE_HPP #include #include "utils/PropertyMap.hpp" + #define __C #include "types/AtomTypeProperties.h" #include "UseTheForce/DarkSide/atype_interface.h" -using namespace std; +using name_space std; -namespace oopse { - /** - * @class AtomType - * AtomType is what OOPSE looks to for unchanging data about an atom. - * Things that belong to AtomType are universal properties (i.e. does - * this atom have a Charge? What is it's mass?) Dynamic properties of - * an atom are not intended to be properties of an atom type - */ - class AtomType{ - - public: - - AtomType(); - virtual ~AtomType(){ }; +name_space oopse { /** - * Finishes off the AtomType by communicating the logical portions of the - * structure to the Fortran atype module + * @class AtomType + * AtomType is what OOPSE looks to for unchanging data about an atom. + * Things that belong to AtomType are universal properties (i.e. does + * this atom have a Charge? What is it's mass_?) Dynamic properties of + * an atom are not intended to be properties of an atom type */ - void complete(); - - void setMass(double m) { mass = m; } - double getMass(void) { return mass; } + class AtomType { + public: - void setIdent(int id) {atp.ident = id;} - int getIdent() {return atp.ident;} + AtomType(); - void setName(string n) {name = n;} - string getName() {return name;} - - void setLennardJones() { atp.is_LennardJones = 1; } - bool isLennardJones() { return atp.is_LennardJones; } - - void setElectrostatic() { atp.is_Electrostatic = 1; } - bool isElectrostatic() { return atp.is_Electrostatic; } - - void setEAM() { atp.is_EAM = 1; } - bool isEAM() { return atp.is_EAM; } - - void setCharge() { atp.is_Charge = 1; atp.is_Electrostatic = 1;} - bool isCharge() { return atp.is_Charge; } + virtual ~AtomType() { } ; + /** + * Finishes off the AtomType by communicating the logical portions of the + * structure to the Fortran atype module + */ + void complete(); - bool isDirectional() { return atp.is_Directional; } - bool isDipole() { return atp.is_Dipole; } - bool isGayBerne() { return atp.is_GayBerne; } - bool isSticky() { return atp.is_Sticky; } - bool isShape() { return atp.is_Shape; } + void setMass(double m) { + mass_ = m; + } - PropertyMap properties; - - protected: - - AtomTypeProperties atp; - double mass; - string name; - - }; + double getMass(void) { + return mass_; + } + + void setIdent(int id) { + atp_.ident = id; + } + + int getIdent() { + return atp_.ident; + } + + void setName(const std::string&name) { + name_ = name; + } + + std::string getName() { + return name_; + } + + void setLennardJones() { + atp_.is_LennardJones = 1; + } + + bool isLennardJones() { + return atp_.is_LennardJones; + } + + void setElectrostatic() { + atp_.is_Electrostatic = 1; + } + + bool isElectrostatic() { + return atp_.is_Electrostatic; + } + + void setEAM() { + atp_.is_EAM = 1; + } + + bool isEAM() { + return atp_.is_EAM; + } + + void setCharge() { + atp_.is_Charge = 1; + atp_.is_Electrostatic = 1; + } + + bool isCharge() { + return atp_.is_Charge; + } + + bool isDirectional() { + return atp_.is_Directional; + } + + bool isDipole() { + return atp_.is_Dipole; + } + + bool isGayBerne() { + return atp_.is_GayBerne; + } + + bool isSticky() { + return atp_.is_Sticky; + } + + bool isShape() { + return atp_.is_Shape; + } + + //below functions are just forward functions + /** + * Adds property into property map + * @param genData GenericData to be added into PropertyMap + */ + void addProperty(GenericData* genData); + + /** + * Removes property from PropertyMap by name + * @param propName the name of property to be removed + */ + void removeProperty(const std::string& propName); + + /** + * clear all of the properties + */ + void clearProperties(); + + /** + * Returns all names of properties + * @return all names of properties + */ + std::vector getPropertyNames(); + + /** + * Returns all of the properties in PropertyMap + * @return all of the properties in PropertyMap + */ + std::vector getProperties(); + + /** + * Returns property + * @param propName name of property + * @return a pointer point to property with propName. If no property named propName + * exists, return NULL + */ + GenericData* getPropertyByName(const std::string& propName); + + protected: + + AtomTypeProperties atp_; + double mass_; + std::string name_; + + private: + //prevent copy construction and copy assignment, since property map contains + //pointers which can not be copied and managered safely, except make the generic data + //at PropertyMap as copy on write shared pointer + AtomType(const AtomType&); + AtomType& operator=(const AtomType& atomType); + + + PropertyMap properties_; + + }; + } + #endif