source: src/Parser/PdbAtomInfoContainer.hpp@ 873037

Action_Thermostats Add_AtomRandomPerturbation Add_FitFragmentPartialChargesAction Add_RotateAroundBondAction Add_SelectAtomByNameAction Added_ParseSaveFragmentResults AddingActions_SaveParseParticleParameters Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_ParticleName_to_Atom Adding_StructOpt_integration_tests AtomFragments Automaking_mpqc_open AutomationFragmentation_failures Candidate_v1.5.4 Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator CombiningParticlePotentialParsing Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_BoundInBox_CenterInBox_MoleculeActions Fix_ChargeSampling_PBC Fix_ChronosMutex Fix_FitPartialCharges Fix_FitPotential_needs_atomicnumbers Fix_ForceAnnealing Fix_IndependentFragmentGrids Fix_ParseParticles Fix_ParseParticles_split_forward_backward_Actions Fix_PopActions Fix_QtFragmentList_sorted_selection Fix_Restrictedkeyset_FragmentMolecule Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns Fix_fitting_potentials Fixes ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion FragmentAction_writes_AtomFragments FragmentMolecule_checks_bonddegrees GeometryObjects Gui_Fixes Gui_displays_atomic_force_velocity ImplicitCharges IndependentFragmentGrids IndependentFragmentGrids_IndividualZeroInstances IndependentFragmentGrids_IntegrationTest IndependentFragmentGrids_Sole_NN_Calculation JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix MoreRobust_FragmentAutomation ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PdbParser_setsAtomName PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks Rewrite_FitPartialCharges RotateToPrincipalAxisSystem_UndoRedo SaturateAtoms_findBestMatching SaturateAtoms_singleDegree StoppableMakroAction Subpackage_CodePatterns Subpackage_JobMarket Subpackage_LinearAlgebra Subpackage_levmar Subpackage_mpqc_open Subpackage_vmg Switchable_LogView ThirdParty_MPQC_rebuilt_buildsystem TrajectoryDependenant_MaxOrder TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps TremoloParser_setsAtomName Ubuntu_1604_changes stable
Last change on this file since 873037 was 873037, checked in by Frederik Heber <heber@…>, 14 years ago

Refined static filling of PdbAtomInfoContainer::knownDataKeys.

  • have static bool which says whether map is filled or not.
  • static clearknownDataKeys() called by PdbParser's dstor.
  • Property mode set to 100644
File size: 2.4 KB
Line 
1/*
2 * PdbAtomInfoContainer.hpp
3 *
4 * Created on: Dec 4, 2010
5 * Author: heber
6 */
7
8#ifndef PDBATOMINFOCONTAINER_HPP_
9#define PDBATOMINFOCONTAINER_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17#include "PdbKey.hpp"
18
19class PdbParser;
20class Vector;
21
22#include <string>
23#include <typeinfo>
24
25/**
26 * Holds tremolo-specific information which is not store in the atom class.
27 */
28class PdbAtomInfoContainer {
29 friend class PdbParser;
30public:
31 PdbAtomInfoContainer();
32 ~PdbAtomInfoContainer();
33
34 // getter and setter
35 template <class T> T get(const PdbKey::PdbDataKey key) const {
36 switch (key) {
37 default :
38 std::cout << "Unknown key or not representable as " << typeid(T).name() << ": " << key << std::endl;
39 break;
40 }
41 return (T)NULL;
42 }
43 void set(const PdbKey::PdbDataKey key, std::string value);
44
45 /** Scans a value from a short string and checks whether its empty.
46 *
47 * @param value value to set
48 * @param _piece short string
49 */
50 template <class T> static void ScanKey(T& value, std::string _piece)
51 {
52 ConvertTo<T> toValue;
53 // scan all empty chars ' ' and skip
54 std::string::iterator iter = _piece.begin();
55 for (;iter != _piece.end();++iter)
56 if ((*iter != ' ') && (*iter != '\t'))
57 break;
58 // only set if there is something contained in the string
59 if (iter != _piece.end()) {
60 _piece.erase(_piece.begin(), iter);
61 value = toValue(_piece);
62 }
63 }
64
65 const std::string& getDataKey(PdbKey::PdbDataKey key) const;
66
67private:
68
69 static void fillknownDataKeys();
70 static void clearknownDataKeys();
71
72 typedef std::map<PdbKey::PdbDataKey, std::string> knownDataKeysMap;
73 static knownDataKeysMap knownDataKeys;
74 static bool knownDataKeys_Filled;
75
76 std::string token;
77 int serial;
78 std::string name;
79 char altLoc;
80 std::string resName;
81 char chainID;
82 int resSeq;
83 char iCode;
84 Vector XYZ;
85 float occupancy;
86 float tempFactor;
87 std::string element;
88 int charge;
89 size_t timestep;
90};
91
92std::ostream& operator<<(std::ostream &ost, const PdbAtomInfoContainer& m);
93
94template <>
95std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const;
96template <>
97int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const;
98template <>
99double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const;
100
101#endif /* PDBATOMINFOCONTAINER_HPP_ */
Note: See TracBrowser for help on using the repository browser.