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

Comparing branches/new-templateless/OOPSE/libmdtools/GenericData.hpp (file contents):
Revision 849, Fri Oct 31 18:28:53 2003 UTC vs.
Revision 850 by mmeineke, Mon Nov 3 22:07: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"
# Line 15 | Line 11 | using namespace std;
11   #define INTEGRALOFCHIDT_ID "INTEGRALOFCHIDT"
12   #define ETAVALUE_ID "ETAVALUE"
13  
14 < using namespace std;
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() {}
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 <    const string& getID() const {  return id; }
31 <    void setID(string rhs)     {  id = rhs;  }
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 <  protected:
36 <    string id;
33 < };
35 >  GenericData* getNext( void ) { return next; }
36 >  void setNext( GenericData* theNext ) { next = theNext; }
37  
38 < /** Something we can improve it here is to use template
39 < **
37 < */
38 < class DoubleData : public GenericData{
38 >  GenericData* getSameNext( void ) { return sameNext; }
39 >  void setSameNext( GenericData* theNext ) { sameNext = theNext; }
40  
41 <  public:
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 <    double getData()         { return data; }
48 <    void setData(double rhs) { data = rhs;  }
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 <  protected:
57 <    double data;
58 < };
56 >  char id[GD_STRING_LENGTH];
57 >  GenericData* next;
58 >  GenericData* sameNext;
59  
60 < class StringData : public GenericData{
61 <
62 <  public:
63 <    const string& getData() const  {  return data; }
53 <    void setData(const string& rhs) {  data = rhs;  }
54 <  protected:
55 <    string data;
60 >  double dVal;
61 >  double *dArray;
62 >  int arrayLenth;
63 >  char cVal[GD_STRING_LENGTH];
64   };
65  
66 < struct ZConsParaItem {
67 <  int zconsIndex;
68 <  bool havingZPos;
69 <  double zPos;
70 <  double kRatio;
71 < };
66 > // struct ZConsParaItem {
67 > //   int zconsIndex;
68 > //   bool havingZPos;
69 > //   double zPos;
70 > //   double kRatio;
71 > // };
72  
73 < class ZConsParaData : public GenericData{
73 > // class ZConsParaData : public GenericData{
74  
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();
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 <  };
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 <    }
87 > // class ZConsParaSortCriterion{
88 > //   public:
89 > //     bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){
90 > //       return item1.zconsIndex < item2.zconsIndex;
91 > //     }
92  
93 < };
93 > // };
94  
95   class DoubleArrayData : public GenericData{
96  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines