Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GDB.hh
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 /* */
3 /* ---- TALOS+ C++ verison ---- */
4 /* TALOS: Torsion Angle Likeness Optimized By Shifts. */
5 /* Yang Shen, Gabriel Cornilescu, Frank Delaglio, and Ad Bax */
6 /* NIH Laboratory of Chemical Physics */
7 /* version, x.2010.0607.00 */
8 /* */
9 /* for any problem, please contact */
10 /* shenyang@niddk.nih.gov */
11 /* */
12 /******************************************************************************/
13 
14 #ifndef GDB_H
15 #define GDB_H
16 
17 // AUTO-REMOVED #include <string>
18 #include <vector>
19 // AUTO-REMOVED #include <map>
20 #include <boost/unordered_map.hpp>
21 #include <utility/vector0.hh>
22 #include <utility/vector1.hh>
23 
24 namespace protocols {
25 namespace sparta {
26 
27 typedef boost::unordered_map< std::string, std::string > GDB_Entry;
28 
29 
30 class GDB
31 {
33  bool plain_text; //only print the data matrix
34  char buf[5000];
35 
36 public:
37 
39 
43 
45 
46  boost::unordered_map<int, std::string> residList;
47 
50  boost::unordered_map<int, std::string> VARS;
51  boost::unordered_map<int, std::string> FORMAT;
52 
53  boost::unordered_map< int, GDB_Entry > Entries;
54 
55  GDB();
56  GDB(const std::string& fileName);
57 
58  void loadGDB(const std::string &fileName);
59  void saveGDB(const std::string &fileName);
60 
61  void showGDB(std::ostream& os);
62 
63  //add one VAR with given FORMAT
64  void addVAR(const std::string &VAR_Name, const std::string &FORMAT_Name);
65  //re-set one VAR with given FORMAT
66  void setVAR(int index, const std::string &VAR_Name, const std::string &FORMAT_Name);
67 
68  //set the DATA with 'DataVal'
69  void setData(const std::string &DataName, const std::string &DataVal);
70  //get the DATA value with 'DataName'
71  std::string getData(const std::string &DataName);
72 
73 
74  GDB_Entry getEntry(int number);
75  GDB_Entry getEntry(const std::string &VName, const std::string &VVal, int index);
76  GDB_Entry getEntry(const std::string &VName1, const std::string &VVal1, const std::string &VName2, const std::string &VVal2, int index);
77  //re-set the 'index'-th data entry with new 'VarVal' for given 'VarName'
78  void setEntry(int index, const std::string &VarName, const std::string &VarVal);
79  //add one data entry to the end of current Entries
80  void addEntry(const std::string &VarName, const std::string &VarVal);
81 
82 
83  void addRemark(const std::string &str); // add one REMARK
84 
85  std::string getResidName(int rNum);
86  int getEntryCount(); // return size of current entries
87 
88  void presetClass(const std::string &ClassName); // pre-set the VARS and FORMAT
89 
90  bool checkFormat(const std::string& f); // check if f is a valid FORMAT
91 
92  bool isVarFloat(int index);
93  bool isVarInt(int index);
94  bool isVarString(int index);
95 
96  bool isVarFloat(const std::string &VarName);
97  bool isVarInt(const std::string &VarName);
98  bool isVarString(const std::string &VarName);
99 
100  void VARS_str_parser(const std::string &str);
101  void FORMAT_str_parser(const std::string &str);
102 
103  void set_plaintext();
104 
105 
106 };
107 
108 }
109 }
110 #endif