1 |
|
#ifndef __GENERICDATA_H__ |
2 |
|
#define __GENERICDATA_H__ |
3 |
|
|
4 |
+ |
#include <algorithm> |
5 |
|
#include <string> |
6 |
|
#include <vector> |
7 |
|
|
8 |
+ |
#define ZCONSTIME_ID "ZCONSTIME" |
9 |
+ |
#define ZCONSPARADATA_ID "ZCONSPARA" |
10 |
+ |
#define ZCONSFILENAME_ID "ZCONSFILENAME" |
11 |
+ |
#define ZCONSTOL_ID "ZCONSTOL" |
12 |
+ |
#define ZCONSFORCEPOLICY_ID "ZCONSFORCEPOLICY" |
13 |
+ |
|
14 |
|
using namespace std; |
15 |
|
|
16 |
|
class GenericData |
31 |
|
/** Something we can improve it here is to use template |
32 |
|
** |
33 |
|
*/ |
27 |
– |
class IndexData : public GenericData |
28 |
– |
{ |
29 |
– |
public: |
30 |
– |
IndexData(); |
31 |
– |
IndexData(const IndexData& rhs); |
32 |
– |
IndexData& operator = (const IndexData& rhs); |
33 |
– |
|
34 |
– |
const vector<int>& getIndexData() const { return indexData; } |
35 |
– |
void setIndexData(const vector<int>& rhs) { indexData = rhs; } |
36 |
– |
protected: |
37 |
– |
vector<int> indexData; |
38 |
– |
}; |
39 |
– |
|
34 |
|
class DoubleData : public GenericData{ |
35 |
|
|
36 |
|
public: |
50 |
|
protected: |
51 |
|
string data; |
52 |
|
}; |
53 |
+ |
|
54 |
+ |
struct ZConsParaItem { |
55 |
+ |
int zconsIndex; |
56 |
+ |
bool havingZPos; |
57 |
+ |
double zPos; |
58 |
+ |
double kRatio; |
59 |
+ |
}; |
60 |
+ |
|
61 |
+ |
class ZConsParaData : public GenericData{ |
62 |
+ |
|
63 |
+ |
public: |
64 |
+ |
ZConsParaData(); |
65 |
+ |
void addItem(ZConsParaItem& item) {data.push_back(item);} |
66 |
+ |
vector<ZConsParaItem>* getData() {return &data;} |
67 |
+ |
void setData(vector<ZConsParaItem>& theData) {data = theData;} |
68 |
+ |
void sortByIndex(); |
69 |
+ |
bool isIndexUnique(); |
70 |
+ |
|
71 |
+ |
private: |
72 |
+ |
vector<ZConsParaItem> data; |
73 |
+ |
}; |
74 |
+ |
|
75 |
+ |
class ZConsParaSortCriterion{ |
76 |
+ |
public: |
77 |
+ |
bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){ |
78 |
+ |
return item1.zconsIndex < item2.zconsIndex; |
79 |
+ |
} |
80 |
+ |
|
81 |
+ |
}; |
82 |
+ |
|
83 |
|
#endif |