/* * PdbAtomInfoContainer.hpp * * Created on: Dec 4, 2010 * Author: heber */ #ifndef PDBATOMINFOCONTAINER_HPP_ #define PDBATOMINFOCONTAINER_HPP_ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include #include #include "LinearAlgebra/Vector.hpp" #include "PdbKey.hpp" #include "ParserTypes.hpp" //template class FormatParser; //template<> class FormatParser< pdb >; /** * Holds tremolo-specific information which is not store in the atom class. */ class PdbAtomInfoContainer { //!> Grant all FormatParser specializations access, otherwise we have to fully define FormatParser template friend class FormatParser; public: PdbAtomInfoContainer(); ~PdbAtomInfoContainer(); // getter and setter template T get(const PdbKey::PdbDataKey key) const { switch (key) { default : std::cout << "Unknown key or not representable as " << typeid(T).name() << ": " << key << std::endl; break; } return (T)NULL; } void set(const PdbKey::PdbDataKey key, std::string value); /** Scans a value from a short string and checks whether its empty. * * @param value value to set * @param _piece short string */ template static void ScanKey(T& value, std::string _piece) { ConvertTo toValue; // scan all empty chars ' ' and skip std::string::iterator iter = _piece.begin(); for (;iter != _piece.end();++iter) if ((*iter != ' ') && (*iter != '\t')) break; // only set if there is something contained in the string if (iter != _piece.end()) { _piece.erase(_piece.begin(), iter); value = toValue(_piece); } } const std::string& getDataKey(PdbKey::PdbDataKey key) const; private: static void fillknownDataKeys(); static void clearknownDataKeys(); typedef std::map knownDataKeysMap; static knownDataKeysMap knownDataKeys; static bool knownDataKeys_Filled; std::string token; int serial; std::string name; char altLoc; std::string resName; char chainID; int resSeq; char iCode; Vector XYZ; float occupancy; float tempFactor; std::string element; int charge; }; std::ostream& operator<<(std::ostream &ost, const PdbAtomInfoContainer& m); template <> std::string PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const; template <> int PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const; template <> double PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const; #endif /* PDBATOMINFOCONTAINER_HPP_ */