ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/branches/new_design/OOPSE-3.0/src/constraints/ZconsData.hpp
Revision: 1683
Committed: Thu Oct 28 22:34:02 2004 UTC (19 years, 9 months ago)
File size: 1757 byte(s)
Log Message:
This commit was manufactured by cvs2svn to create branch 'new_design'.

File Contents

# User Rev Content
1 tim 1625 #ifndef CONSTRAINT_ZCONSDATA_HPP
2     #define CONSTRAINT_ZCONSDATA_HPP
3     #include <algorithm>
4    
5     #include "utils/GenericData.hpp"
6    
7     #define ZCONSTIME_ID "ZCONSTIME"
8     #define ZCONSPARADATA_ID "ZCONSPARA"
9     #define ZCONSFILENAME_ID "ZCONSFILENAME"
10     #define ZCONSTOL_ID "ZCONSTOL"
11     #define ZCONSFORCEPOLICY_ID "ZCONSFORCEPOLICY"
12     #define ZCONSGAP_ID "ZCONSGAP"
13     #define ZCONSFIXTIME_ID "ZCONSFIXTIME"
14     #define ZCONSUSINGSMD_ID "ZCONSUSINGSMD"
15    
16    
17    
18     using namespace std;
19     using namespace oopse;
20    
21     struct ZConsParaItem {
22     int zconsIndex;
23     bool havingZPos;
24     double zPos;
25     double kRatio;
26     bool havingCantVel;
27     double cantVel;
28     };
29    
30    
31     class ZConsParaSortCriterion{
32     public:
33     bool operator ()(const ZConsParaItem& item1, const ZConsParaItem& item2){
34     return item1.zconsIndex < item2.zconsIndex;
35     }
36    
37     };
38    
39     class ZConsParaData : public GenericData{
40    
41     public:
42     ZConsParaData(const string& id = ZCONSPARADATA_ID) : GenericData(id) {}
43    
44     void addItem(ZConsParaItem& item) {data.push_back(item);}
45    
46     vector<ZConsParaItem>* getData() {return &data;}
47    
48     void setData(vector<ZConsParaItem>& theData) {data = theData;}
49    
50     void sortByIndex() {
51     sort(data.begin(), data.end(), ZConsParaSortCriterion());
52     }
53    
54     bool isIndexUnique() {
55    
56     for(int i = 0; i < (int)(data.size() - 1); i++) {
57     for(int j = i + 1; j < (int)(data.size()); j++) {
58     if(data[i].zconsIndex == data[j].zconsIndex) {
59     return false;
60     }
61     }
62     }
63    
64     return true;
65     }
66    
67     private:
68     vector<ZConsParaItem> data;
69     };
70    
71     #endif //CONSTRAINT_ZCONSDATA_HPP

Properties

Name Value
svn:executable *