Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/PdbAtomInfoContainer.cpp

    r4fbca9c r16462f  
    2424#include "Helpers/toString.hpp"
    2525//#include "Helpers/Verbose.hpp"
     26#include "LinearAlgebra/Vector.hpp"
    2627#include "PdbAtomInfoContainer.hpp"
    2728
    2829
    2930PdbAtomInfoContainer::PdbAtomInfoContainer() :
     31  token("ATOM"),
    3032  serial(0),
    3133  name("-"),
    32   altloc('0'),
     34  altLoc('0'),
    3335  resName("-"),
    3436  chainID('0'),
     
    3739  occupancy(0.),
    3840  tempFactor(0.),
     41  element(""),
    3942  charge(0)
    4043{}
     
    4649{
    4750  switch (key) {
     51    case PdbKey::token :
     52      ScanKey(token, value);
     53      break;
    4854    case PdbKey::serial :
    4955      ScanKey(serial, value);
     
    5258      ScanKey(name, value);
    5359      break;
    54     case PdbKey::altloc :
    55       ScanKey(altloc, value);
     60    case PdbKey::altLoc :
     61      ScanKey(altLoc, value);
    5662      break;
    5763    case PdbKey::resName :
     
    6773      ScanKey(iCode, value);
    6874      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;
    6984    case PdbKey::occupancy :
    7085      ScanKey(occupancy, value);
     
    7287    case PdbKey::tempFactor :
    7388      ScanKey(tempFactor, value);
     89      break;
     90    case PdbKey::element :
     91      ScanKey(element, value);
    7492      break;
    7593    case PdbKey::charge :
     
    82100}
    83101
    84 std::string PdbAtomInfoContainer::get(const PdbKey::PdbDataKey key) const
     102template <>
     103std::string PdbAtomInfoContainer::get<std::string>(const PdbKey::PdbDataKey key) const
    85104{
    86105  switch (key) {
     106    case PdbKey::token :
     107      return toString(token);
    87108    case PdbKey::serial :
    88109      return toString(serial);
    89110    case PdbKey::name :
    90111      return toString(name);
    91     case PdbKey::altloc :
    92       return toString(altloc);
     112    case PdbKey::altLoc :
     113      return toString(altLoc);
    93114    case PdbKey::resName :
    94115      return toString(resName);
     
    99120    case PdbKey::iCode :
    100121      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]);
    101128    case PdbKey::occupancy :
    102129      return toString(occupancy);
    103130    case PdbKey::tempFactor :
    104131      return toString(tempFactor);
     132    case PdbKey::element :
     133      return toString(element);
    105134    case PdbKey::charge :
    106135      return toString(charge);
     
    111140}
    112141
     142template <>
     143int 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
     158template <>
     159double 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.