politopix  4.1.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Tracking.h
Go to the documentation of this file.
1 // politopix allows to make computations on polytopes such as finding vertices, intersecting, Minkowski sums, ...
2 // Copyright (C) 2014-2015 : Delos Vincent
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Lesser General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Lesser General Public License for more details.
13 //
14 // You should have received a copy of the GNU Lesser General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
19 // I2M (UMR CNRS 5295 / University of Bordeaux)
20 
21 #ifndef INC_Tracking
22 #define INC_Tracking
23 
24 
30 };
31 
37 };
38 
39 
42 
43  public:
44 
46 
47  void setNumbersOfEntities(unsigned int nbEntBefore, unsigned int nbEntAfter) {
48  _operator.resize(nbEntBefore);
49  _result.resize(nbEntAfter);
50  // Set DELETED by default as we will change the status further on.
51  for (unsigned int i=0;i<_operator.size();++i)
52  _operator[i].first = Operator_DELETED;
53  for (unsigned int i=0;i<_result.size();++i)
54  _result[i].first = Result_UNCHANGED;
55  }
56 
58  void setOperatorEntityAsUnchanged(unsigned int nb) {_operator[nb].first = Operator_UNCHANGED;}
59 
61  void setOperatorEntityAsModified(unsigned int nb) {_operator[nb].first = Operator_MODIFIED;}
62 
64  void setOperatorEntityAsDeleted(unsigned int nb) {_operator[nb].first = Operator_DELETED;}
65 
67  void setResultEntityAsUnchanged(unsigned int nb) {_result[nb].first = Result_UNCHANGED;}
68 
70  void setResultEntityAsModified(unsigned int nb) {_result[nb].first = Result_MODIFIED;}
71 
73  void setResultEntityAsUnknown(unsigned int nb) {_result[nb].first = Result_UNKNOWN;}
74 
76  void setResultEntityAsCreated(unsigned int nb) {_result[nb].first = Result_CREATED;}
77 
79  StatusAfter getResultEntityStatus(unsigned int nb) {return _result[nb].first;}
80 
82  StatusBefore getOperatorEntityStatus(unsigned int nb) {return _operator[nb].first;}
83 
84 
86  void setOperator_Result(unsigned int nb, int nbRes) {_operator[nb].second = nbRes;}
87 
89  void setResult_Operator(unsigned int nbRes, int nb) {_result[nbRes].second = nb;}
90 
92  const std::vector< std::pair< StatusBefore, int > >& getOperatorToResult() const {return _operator;}
93 
95  const std::vector< std::pair< StatusAfter, int > >& getResultToOperator() const {return _result;}
96 
97  protected:
98 
100  std::vector< std::pair< StatusBefore, int > > _operator;
102  std::vector< std::pair< StatusAfter, int > > _result;
103 
104 };
105 
106 
107 typedef std::pair< int, int > operator1_operator2;
108 
111 
112  public:
113 
115 
116  void setNumbersOfEntities(unsigned int nbEntBefore1, unsigned int nbEntBefore2, unsigned int nbEntAfter) {
117  _operator1.resize(nbEntBefore1);
118  _operator2.resize(nbEntBefore2);
119  _result.resize(nbEntAfter);
120  {for (unsigned int i=0;i<_operator1.size();++i) {
121  _operator1[i].first = Operator_DELETED;
122  // Put -1 at the moment as we don't know the corresponding element.
123  _operator1[i].second = -1;
124  }}
125  {for (unsigned int i=0;i<_operator2.size();++i) {
126  _operator2[i].first = Operator_DELETED;
127  _operator2[i].second = -1;
128  }}
129  {for (unsigned int i=0;i<_result.size();++i) {
130  _result[i].first = Result_UNCHANGED;
131  _result[i].second.first = -1;
132  _result[i].second.second = -1;
133  }}
134  }
135 
137  void setOperator1_Result(unsigned int nbOp1, int nbRes) {_operator1[nbOp1].second = nbRes;}
138 
140  void setOperator2_Result(unsigned int nbOp2, int nbRes) {_operator2[nbOp2].second = nbRes;}
141 
143  void setResult_Operator1Operator2(unsigned int nbRes, int nbOp1, int nbOp2) {
144  _result[nbRes].second.first = nbOp1;
145  _result[nbRes].second.second = nbOp2;
146  }
147 
149  const std::vector< std::pair< StatusAfter, operator1_operator2 > >& getResultStatus_Operator1Operator2() const { return _result;}
150 
152  void setOperator1EntityAsUnchanged(unsigned int nbOp1) {_operator1[nbOp1].first = Operator_UNCHANGED;}
153 
155  void setOperator1EntityAsModified( unsigned int nbOp1) {_operator1[nbOp1].first = Operator_MODIFIED;}
156 
158  void setOperator1EntityAsDeleted( unsigned int nbOp1) {_operator1[nbOp1].first = Operator_DELETED;}
159 
161  void setOperator2EntityAsUnchanged(unsigned int nbOp2) {_operator2[nbOp2].first = Operator_UNCHANGED;}
162 
164  void setOperator2EntityAsModified( unsigned int nbOp2) {_operator2[nbOp2].first = Operator_MODIFIED;}
165 
167  void setOperator2EntityAsDeleted( unsigned int nbOp2) {_operator2[nbOp2].first = Operator_DELETED;}
168 
170  void setResultEntityAsUnchanged(unsigned int nbRes) { _result[nbRes].first = Result_UNCHANGED;}
171 
173  void setResultEntityAsModified( unsigned int nbRes) { _result[nbRes].first = Result_MODIFIED;}
174 
176  void setResultEntityAsUnknown( unsigned int nbRes) { _result[nbRes].first = Result_UNKNOWN;}
177 
179  void setResultEntityAsCreated( unsigned int nbRes) { _result[nbRes].first = Result_CREATED;}
180 
181 
182  protected:
184  std::vector< std::pair< StatusBefore, int > > _operator1;
186  std::vector< std::pair< StatusBefore, int > > _operator2;
188  std::vector< std::pair< StatusAfter, operator1_operator2 > > _result;
189 
190 };
191 
192 #endif // INC_Tracking
StatusAfter getResultEntityStatus(unsigned int nb)
Get the nb-th entity status after the operation.
Definition: Tracking.h:79
void setOperator2EntityAsUnchanged(unsigned int nbOp2)
Mark Operator_UNCHANGED the nbOp2-th entity of operator2.
Definition: Tracking.h:161
void setResult_Operator1Operator2(unsigned int nbRes, int nbOp1, int nbOp2)
Set the link between the nbRes-th entity of the result and the nbOp1-th entity of operator1 and the n...
Definition: Tracking.h:143
void setResult_Operator(unsigned int nbRes, int nb)
Set the link between the nb-th entity of operator1 and the nbRes-th entity of the result...
Definition: Tracking.h:89
void setOperator1EntityAsUnchanged(unsigned int nbOp1)
Mark Operator_UNCHANGED the nbOp1-th entity of operator1.
Definition: Tracking.h:152
void setOperator2_Result(unsigned int nbOp2, int nbRes)
Set the link between the nbOp2-th entity of operator2 and the nbRes-th entity of the result...
Definition: Tracking.h:140
void setOperator1EntityAsModified(unsigned int nbOp1)
Mark Operator_MODIFIED the nbOp1-th entity of operator1.
Definition: Tracking.h:155
void setResultEntityAsUnchanged(unsigned int nb)
Mark as Result_UNCHANGED the nb-th entity before the operation.
Definition: Tracking.h:67
void setResultEntityAsModified(unsigned int nbRes)
Mark Result_MODIFIED the nbRes-th entity of the result.
Definition: Tracking.h:173
std::vector< std::pair< StatusBefore, int > > _operator2
List of the entities before the given operation with their status and the entity number it is connect...
Definition: Tracking.h:186
StatusAfter
Definition: Tracking.h:32
void setOperator1_Result(unsigned int nbOp1, int nbRes)
Set the link between the nbOp1-th entity of operator1 and the nbRes-th entity of the result...
Definition: Tracking.h:137
const std::vector< std::pair< StatusAfter, int > > & getResultToOperator() const
Definition: Tracking.h:95
void setResultEntityAsUnknown(unsigned int nb)
Mark as Result_UNKNOWN the nb-th entity after the operation.
Definition: Tracking.h:73
StatusBefore
Definition: Tracking.h:25
void setOperator1EntityAsDeleted(unsigned int nbOp1)
Mark Operator_DELETED the nbOp1-th entity of operator1.
Definition: Tracking.h:158
std::vector< std::pair< StatusAfter, operator1_operator2 > > _result
List of the entities after the given operation with their status and the entity numbers it is connect...
Definition: Tracking.h:188
void setNumbersOfEntities(unsigned int nbEntBefore, unsigned int nbEntAfter)
Definition: Tracking.h:47
This class stores static function that dispatch the main geometric values we use. ...
Definition: Tracking.h:110
This class stores static function that dispatch the main geometric values we use. ...
Definition: Tracking.h:41
void setOperatorEntityAsUnchanged(unsigned int nb)
Mark as Operator_UNCHANGED the nb-th entity before the operation.
Definition: Tracking.h:58
void setResultEntityAsCreated(unsigned int nbRes)
Mark Result_CREATED the nbRes-th entity of the result.
Definition: Tracking.h:179
void setResultEntityAsUnchanged(unsigned int nbRes)
Mark Result_UNCHANGED the nbRes-th entity of the result.
Definition: Tracking.h:170
void setOperator2EntityAsDeleted(unsigned int nbOp2)
Mark Operator_DELETED the nbOp2-th entity of operator2.
Definition: Tracking.h:167
void setNumbersOfEntities(unsigned int nbEntBefore1, unsigned int nbEntBefore2, unsigned int nbEntAfter)
Definition: Tracking.h:116
void setResultEntityAsUnknown(unsigned int nbRes)
Mark Result_UNKNOWN the nbRes-th entity of the result.
Definition: Tracking.h:176
std::vector< std::pair< StatusAfter, int > > _result
List of the entities after the given operation with their status and the entity number it is connecte...
Definition: Tracking.h:102
void setResultEntityAsModified(unsigned int nb)
Mark as Result_MODIFIED the nb-th entity after the operation.
Definition: Tracking.h:70
std::vector< std::pair< StatusBefore, int > > _operator
List of the entities before the given operation with their status and the entity number it is connect...
Definition: Tracking.h:100
std::pair< int, int > operator1_operator2
Definition: Tracking.h:107
std::vector< std::pair< StatusBefore, int > > _operator1
List of the entities before the given operation with their status and the entity number it is connect...
Definition: Tracking.h:184
const std::vector< std::pair< StatusAfter, operator1_operator2 > > & getResultStatus_Operator1Operator2() const
Definition: Tracking.h:149
void setOperator_Result(unsigned int nb, int nbRes)
Set the link between the nb-th entity of operator1 and the nbRes-th entity of the result...
Definition: Tracking.h:86
void setResultEntityAsCreated(unsigned int nb)
Mark as Result_CREATED the nb-th entity after the operation.
Definition: Tracking.h:76
void setOperator2EntityAsModified(unsigned int nbOp2)
Mark Operator_MODIFIED the nbOp2-th entity of operator2.
Definition: Tracking.h:164
const std::vector< std::pair< StatusBefore, int > > & getOperatorToResult() const
Definition: Tracking.h:92
StatusBefore getOperatorEntityStatus(unsigned int nb)
Get the nb-th entity status after the operation.
Definition: Tracking.h:82
void setOperatorEntityAsModified(unsigned int nb)
Mark as Operator_MODIFIED the nb-th entity before the operation.
Definition: Tracking.h:61
void setOperatorEntityAsDeleted(unsigned int nb)
Mark as Operator_DELETED the nb-th entity before the operation.
Definition: Tracking.h:64