1 |
#ifndef EXTRADATA_H |
2 |
#define EXTRADATA_H |
3 |
#include <iostream> |
4 |
#include <map> |
5 |
|
6 |
using namespace std; |
7 |
|
8 |
// the advantage of using namespace over enum type is that you can |
9 |
// add the new type as you want but make sure do not have conflict value |
10 |
namespace TExtraDataType |
11 |
{ |
12 |
const int UNKNOWN = 0; |
13 |
const int COMMENT =1; |
14 |
const int ENERGY = 2; |
15 |
const int FORCE= 3; |
16 |
const int ANGLE = 4; |
17 |
}; |
18 |
|
19 |
|
20 |
namespace TEnergyDataType |
21 |
{ |
22 |
const int BOND = 1; |
23 |
const int ANGEL = 2; |
24 |
const int DIHE = 3; |
25 |
const int IMPR = 4; |
26 |
const int VDW = 5; |
27 |
const int COUL = 6; |
28 |
const int HBOND = 7; |
29 |
const int KE = 8; |
30 |
const int PE = 9; |
31 |
const int TEMP = 10; |
32 |
const int TOTAL = 11; |
33 |
const int VOLUME = 12; |
34 |
const int PRESSURE = 13; |
35 |
const int EFILED = 14; |
36 |
const int UREY_BRADLEY = 15; |
37 |
const int RESTRAINT = 16; |
38 |
}; |
39 |
|
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 |
|
58 |
class TEnergyData : public TExtraData |
59 |
{ |
60 |
protected: |
61 |
map<int, float> _energy; |
62 |
map<int, float>::iterator FindEnergy(int energyType); |
63 |
public: |
64 |
TEnergyData(); |
65 |
TEnergyData(const TEnergyData &energyData); |
66 |
TEnergyData &operator =(const TEnergyData &energyData); |
67 |
~TEnergyData(); |
68 |
|
69 |
void AddEnergy(int energyType, float value); |
70 |
void DeleteEnergy(int energyType); |
71 |
void ReplaceEnergy(int energyType, float value); |
72 |
bool IsEnergyExist(int energyType); |
73 |
float *GetEnergy(int energyType); |
74 |
|
75 |
}; |
76 |
|
77 |
#endif |