- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/PdbAtomInfoContainer.cpp
r4fbca9c r16462f 24 24 #include "Helpers/toString.hpp" 25 25 //#include "Helpers/Verbose.hpp" 26 #include "LinearAlgebra/Vector.hpp" 26 27 #include "PdbAtomInfoContainer.hpp" 27 28 28 29 29 30 PdbAtomInfoContainer::PdbAtomInfoContainer() : 31 token("ATOM"), 30 32 serial(0), 31 33 name("-"), 32 alt loc('0'),34 altLoc('0'), 33 35 resName("-"), 34 36 chainID('0'), … … 37 39 occupancy(0.), 38 40 tempFactor(0.), 41 element(""), 39 42 charge(0) 40 43 {} … … 46 49 { 47 50 switch (key) { 51 case PdbKey::token : 52 ScanKey(token, value); 53 break; 48 54 case PdbKey::serial : 49 55 ScanKey(serial, value); … … 52 58 ScanKey(name, value); 53 59 break; 54 case PdbKey::alt loc :55 ScanKey(alt loc, value);60 case PdbKey::altLoc : 61 ScanKey(altLoc, value); 56 62 break; 57 63 case PdbKey::resName : … … 67 73 ScanKey(iCode, value); 68 74 break; 75 case PdbKey::X : 76 ScanKey(XYZ[0], value); 77 break; 78 case PdbKey::Y : 79 ScanKey(XYZ[1], value); 80 break; 81 case PdbKey::Z : 82 ScanKey(XYZ[2], value); 83 break; 69 84 case PdbKey::occupancy : 70 85 ScanKey(occupancy, value); … … 72 87 case PdbKey::tempFactor : 73 88 ScanKey(tempFactor, value); 89 break; 90 case PdbKey::element : 91 ScanKey(element, value); 74 92 break; 75 93 case PdbKey::charge : … … 82 100 } 83 101 84 std::string PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const 102 template <> 103 std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const 85 104 { 86 105 switch (key) { 106 case PdbKey::token : 107 return toString(token); 87 108 case PdbKey::serial : 88 109 return toString(serial); 89 110 case PdbKey::name : 90 111 return toString(name); 91 case PdbKey::alt loc :92 return toString(alt loc);112 case PdbKey::altLoc : 113 return toString(altLoc); 93 114 case PdbKey::resName : 94 115 return toString(resName); … … 99 120 case PdbKey::iCode : 100 121 return toString(iCode); 122 case PdbKey::X : 123 return toString(XYZ[0]); 124 case PdbKey::Y : 125 return toString(XYZ[1]); 126 case PdbKey::Z : 127 return toString(XYZ[2]); 101 128 case PdbKey::occupancy : 102 129 return toString(occupancy); 103 130 case PdbKey::tempFactor : 104 131 return toString(tempFactor); 132 case PdbKey::element : 133 return toString(element); 105 134 case PdbKey::charge : 106 135 return toString(charge); … … 111 140 } 112 141 142 template <> 143 int PdbAtomInfoContainer::get<int>(const PdbKey::PdbDataKey key) const 144 { 145 switch (key) { 146 case PdbKey::serial : 147 return serial; 148 case PdbKey::resSeq : 149 return resSeq; 150 case PdbKey::charge : 151 return charge; 152 default : 153 std::cout << "Unknown key or not presentable as int: " << key << std::endl; 154 return 0; 155 } 156 } 157 158 template <> 159 double PdbAtomInfoContainer::get<double>(const PdbKey::PdbDataKey key) const 160 { 161 switch (key) { 162 case PdbKey::X : 163 return XYZ[0]; 164 case PdbKey::Y : 165 return XYZ[1]; 166 case PdbKey::Z : 167 return XYZ[2]; 168 case PdbKey::occupancy : 169 return occupancy; 170 case PdbKey::tempFactor : 171 return tempFactor; 172 default : 173 std::cout << "Unknown key or not presentable as double: " << key << std::endl; 174 return 0.; 175 } 176 }
Note:
See TracChangeset
for help on using the changeset viewer.