ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/FAS/src/extradata.h
(Generate patch)

Comparing trunk/FAS/src/extradata.h (file contents):
Revision 67 by tim, Tue Aug 13 17:07:15 2002 UTC vs.
Revision 83 by tim, Fri Aug 16 15:30:40 2002 UTC

# Line 1 | Line 1
1 + /**********************************************************************
2 + *           Copyright (C) 2002-2003 by Gezelter's Group
3 + *This program is free software; you can redistribute it and/or modify
4 + *it under the terms of the GNU General Public License as published by
5 + *the Free Software Foundation version 2 of the License.
6 + *
7 + *This program is distributed in the hope that it will be useful,
8 + *but WITHOUT ANY WARRANTY; without even the implied warranty of
9 + *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 + *GNU General Public License for more details.
11 + *
12 + ************************************************************************
13 + *Author: Teng Lin               Email:  tlin@nd.edu
14 + *Date: 08/13/2002               Version: 1.0
15 + *
16 + ************************************************************************
17 + *Description:
18 + *
19 + ***********************************************************************/
20   #ifndef EXTRADATA_H
21   #define EXTRADATA_H
22   #include <iostream>
23 + #include <vector>
24   #include <map>
25 + #include "fasatom.h"
26 + #include "fasbond.h"
27 + #include "fasresidue.h"
28 + #include "fasmolecule.h"
29  
30 +
31   using namespace std;
32  
33   // the advantage of using namespace over enum type is that you can
34   // add the new type as you want but make sure do not  have conflict value
35 +
36   namespace TExtraDataType
37   {
38          const int UNKNOWN = 0;
39 <        const int COMMENT =1;  
40 <        const int ENERGY = 2;
41 <        const int FORCE= 3;
42 <        const int ANGLE = 4;    
39 >        const int COMMENT = 1;
40 >        const int ENERGY  = 2;
41 >        const int FORCE   = 3;
42 >  const int DISTANCE = 4;
43 >        const int ANGLE   = 5;
44 >  const int DIHE    = 6;
45 >  const int IMPR    = 7;
46 >  const int IC      = 8;
47   };
48  
49  
50 +
51 + class TExtraData
52 + {
53 +        protected:
54 +                string _ident;
55 +                int _type;
56 +        public:
57 +                TExtraData();
58 +                TExtraData(const TExtraData &extraData);
59 +                TExtraData&     operator =(const TExtraData &extraData);
60 +                virtual ~TExtraData()   {}
61 +
62 +                string GetIdent()       {       return _ident;}
63 +                int     GetType()       {       return _type;}
64 +
65 +                void SetIdent(string ident)     {       _ident = ident;}
66 +                void SetType(int type)  {       _type = type;}
67 + };
68 +
69 + class TExtraDataList
70 + {
71 +  protected:
72 +    vector<TExtraData *>  _extraDataList;
73 +
74 +  public:
75 +    void AddExtraData(TExtraData *extraData);
76 +    void RemoveExtraData(TExtraData *extraData);
77 +    TExtraData *GetExtraData(int extraDataType);
78 +    TExtraData *GetExtraData(string attr);
79 +    vector<TExtraData *> &GetExraDataList() { return _extraDataList;}
80 +    void SetExraDataList(vector<TExtraData *> &extraDataList)
81 +                          { _extraDataList = extraDataList;}
82 +
83 + };
84 +
85 + class TMatchExtraData : public unary_function<TExtraData, bool>
86 + {
87 +  private:
88 +    string _attr;
89 +    int _type;
90 +
91 +    enum TMatchExtraType {meAttr, meType} _matchExtraType;
92 +  public:
93 +    TMatchExtraData(const string &attr) : _attr(attr){  _matchExtraType = meAttr;}
94 +    TMatchExtraData(const int &type) : _type(type){  _matchExtraType = meType;}
95 +
96 +    bool operator ()(const TExtraData & extraData) const
97 +    {
98 +      switch (_matchExtraType)
99 +      {
100 +        case meAttr:
101 +          return extraData.GetIdent() == _attr;
102 +          break;
103 +        case meType: ;
104 +          return extraData.GetType() == _type;
105 +          break;
106 +        default:
107 +        //Error
108 +           ;
109 +      }
110 +
111 +
112 +    }
113 +
114 +
115 + };
116 +
117   namespace TEnergyDataType
118   {
119          const int BOND = 1;
# Line 34 | Line 131 | namespace TEnergyDataType
131          const int PRESSURE = 13;
132          const int EFILED = 14;
133          const int UREY_BRADLEY = 15;
134 <        const int RESTRAINT = 16;
134 >        const int RESTRAINT  = 16;
135   };
136  
40 class TExtraData
41 {
42        protected:
43                string _ident;
44                int _type;
45        public:
46                TExtraData();
47                TExtraData(const TExtraData &extraData);
48                TExtraData&     operator =(const TExtraData &extraData);
49                virtual ~TExtraData()   {}
50                
51                string GetIdent()       {       return _ident;}
52                int     GetType()       {       return _type;}
53                
54                void SetIdent(string ident)     {       _ident = ident;}
55                void SetType(int type)  {       _type = type;}
56 };
57
137   class TEnergyData : public TExtraData
138   {
139          protected:
# Line 62 | Line 141 | class TEnergyData : public TExtraData
141                  map<int, float>::iterator FindEnergy(int energyType);
142          public:
143                  TEnergyData();
144 <                TEnergyData(const TEnergyData &energyData);
145 <                TEnergyData &operator =(const TEnergyData &energyData);
144 >    TEnergyData(const TEnergyData &energyData);
145 >    TEnergyData &operator =(const TEnergyData &energyData);
146                  ~TEnergyData();
147  
148                  void AddEnergy(int energyType, float value);
149                  void DeleteEnergy(int energyType);
150                  void ReplaceEnergy(int energyType, float value);
151                  bool IsEnergyExist(int energyType);
152 <                float *GetEnergy(int energyType);              
152 >                float *GetEnergy(int energyType);
153  
154   };
155  
156 + class TDistance
157 + {
158 +  protected:
159 +    pair<TFASAtom *,TFASAtom*> ;
160 +    float _dist;
161 +
162 +  public:
163 +
164 + };
165 +
166 + class TDistData
167 + {
168 +  protected:
169 +    vector<TDistance *> _distList;
170 +
171 +  public:
172 +
173 +
174 + };
175 +
176 + class TAngle
177 + {
178 +  protected:
179 +    TFASAtom * _vertex;
180 +    pair<TFASAtom *, TFASAtom *> _termin;
181 +    float _angle;           //angle ranges from 0-180
182 +
183 +    float CalcAngleFromCoor();
184 +    void SetAngle(float angle)  { _angle = angle;}
185 +  public:
186 +    TAngle();
187 +    TAngle(const TAngle &src);
188 +    TAngle(const TFASAtom *vertex,
189 +          pair<TFASAtom *, TFASAtom *> termin, float angle = -1);
190 +    ~TAngle();
191 +
192 +    float GetAngle(bool reCalc = false);
193 + };
194 +
195 + class TAngleData : public TExtraData
196 + {
197 +  protected:
198 +    vector<TAngle *> _angleList;
199 +  public:
200 +    TAngleData();
201 +    TAngleData(const TAngleData &src);
202 +    ~TAngleData();
203 + };
204 +
205 + class TDIHE
206 + {
207 +
208 + };
209 +
210 + class TDIHEData : public TExtraData
211 + {
212 +  protected:
213 +    vector<TDIHE *> _diheList;
214 + };
215 +
216 + class TIMPR
217 + {
218 +
219 + };
220 +
221 + class TIMPRData : public TExtraData
222 + {
223 +  protected:
224 +    vector<TIMPR *> _imprList;
225 + };
226 +
227 + class TIC
228 + {
229 +
230 + };
231 +
232 + class TICData : public TExtraData
233 + {
234 +  protected:
235 +    vector<TIC *> _icList;
236 + };
237   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines