ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new-templateless/OOPSE/libmdtools/GenericData.hpp
(Generate patch)

Comparing:
trunk/OOPSE/libmdtools/GenericData.hpp (file contents), Revision 736 by tim, Thu Aug 28 21:09:47 2003 UTC vs.
branches/new-templateless/OOPSE/libmdtools/GenericData.hpp (file contents), Revision 851 by mmeineke, Wed Nov 5 19:18:17 2003 UTC

# Line 1 | Line 1
1   #ifndef __GENERICDATA_H__
2   #define __GENERICDATA_H__
3  
4 #include <algorithm>
5 #include <string>
6 #include <vector>
7
4   #define ZCONSTIME_ID            "ZCONSTIME"
5   #define ZCONSPARADATA_ID    "ZCONSPARA"
6   #define ZCONSFILENAME_ID     "ZCONSFILENAME"
7   #define ZCONSTOL_ID              "ZCONSTOL"
8   #define ZCONSFORCEPOLICY_ID "ZCONSFORCEPOLICY"
9  
10 < using namespace std;
10 > #define CHIVALUE_ID "CHIVALUE"
11 > #define INTEGRALOFCHIDT_ID "INTEGRALOFCHIDT"
12 > #define ETAVALUE_ID "ETAVALUE"
13  
14 + #define GD_STRING_LENGTH 500
15 +
16   class GenericData
17   {
18 <  public:
19 <    GenericData();
20 <    GenericData(const GenericData& rhs)  {  id = rhs.getID(); }
21 <    GenericData& operator =(const GenericData& rhs);
22 <    virtual ~GenericData() {}
23 <    
24 <    const string& getID() const {  return id; }
25 <    void setID(string rhs)     {  id = rhs;  }
26 <    
27 <  protected:
28 <    string id;
29 < };
18 > public:
19 >  GenericData();
20 >  GenericData(char* theID);
21 >  GenericData(char* theID, double theDval);
22 >  GenericData(char* theID, char* theCval);
23 >  GenericData(char* theID, double* theDarray, int theArrayLength);
24 >  virtual ~GenericData() {
25 >    if( next !=NULL )     delete next;
26 >    if( sameNext !=NULL ) delete sameNext;
27 >    if( dArray !=NULL )   delete dArray;    
28 >  }
29  
30 < /** Something we can improve it here is to use template
31 < **
32 < */
33 < class DoubleData : public GenericData{
30 >  GenericData* add(char* theID);
31 >  GenericData* add(char* theID, double theDval);
32 >  GenericData* add(char* theID, char* theCval);
33 >  GenericData* add(char* theID, double* theDarray, int theArrayLength);
34  
35 <  public:
35 >  GenericData* getNext( void ) { return next; }
36 >  void setNext( GenericData* theNext ) { next = theNext; }
37  
38 <    double getData()         { return data; }
39 <    void setData(double rhs) { data = rhs;  }
40 <            
41 <  protected:
42 <    double data;
43 < };
38 >  GenericData* getSameNext( void ) { return sameNext; }
39 >  void setSameNext( GenericData* theNext ) { sameNext = theNext; }
40  
41 < class StringData : public GenericData{
42 <
43 <  public:  
44 <    const string& getData() const  {  return data; }
45 <    void setData(const string& rhs) {  data = rhs;  }
50 <  protected:
51 <    string data;
52 < };
41 >  GenericData* find( char* theID );
42 >  
43 >  void setValue(double theDval);
44 >  void setValue(char* theCval);
45 >  void setValue(double* theDarray, int theArrayLength);
46  
47 < struct ZConsParaItem
48 < {
49 <  int zconsIndex;
50 <  bool havingZPos;
51 <  double zPos;
52 <  double kRatio;
47 >  char* getID() {  return id; }
48 >  void setID(char* theID);
49 >  
50 >  double getDval( void ) {return dVal;}
51 >  char* getCval( void ) { return cVal; }
52 >  int getDarray( double* &outArray );
53 >    
54 > protected:
55 >
56 >  char id[GD_STRING_LENGTH];
57 >  GenericData* next;
58 >  GenericData* sameNext;
59 >
60 >  double dVal;
61 >  double *dArray;
62 >  int arrayLength;
63 >  char cVal[GD_STRING_LENGTH];
64   };
65  
66 < class ZConsParaData : public GenericData{
67 <        
68 <  public:      
69 <    ZConsParaData();
70 <    void addItem(ZConsParaItem& item) {data.push_back(item);}
71 <    vector<ZConsParaItem>* getData() {return &data;}
68 <    void setData(vector<ZConsParaItem>& theData) {data = theData;}
69 <    void sortByIndex();
70 <    bool isIndexUnique();
71 <        
72 <  private:      
73 <    vector<ZConsParaItem> data;
74 <  };
66 > // struct ZConsParaItem {
67 > //   int zconsIndex;
68 > //   bool havingZPos;
69 > //   double zPos;
70 > //   double kRatio;
71 > // };
72  
73 < class ZConsParaSortCriterion{
77 <  public:
78 <    bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){
79 <      return item1.zconsIndex < item2.zconsIndex;
80 <    }
73 > // class ZConsParaData : public GenericData{
74  
75 < };
75 > //   public:
76 > //     ZConsParaData();
77 > //     void addItem(ZConsParaItem& item) {data.push_back(item);}
78 > //     vector<ZConsParaItem>* getData() {return &data;}
79 > //     void setData(vector<ZConsParaItem>& theData) {data = theData;}
80 > //     void sortByIndex();
81 > //     bool isIndexUnique();
82  
83 + //   private:
84 + //     vector<ZConsParaItem> data;
85 + //   };
86 +
87 + // class ZConsParaSortCriterion{
88 + //   public:
89 + //     bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){
90 + //       return item1.zconsIndex < item2.zconsIndex;
91 + //     }
92 +
93 + // };
94 +
95 +
96   #endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines