ARC SDK
DTRStatus.h
1 // -*- indent-tabs-mode: nil -*-
2 
3 #ifndef __ARC_DTRSTATUS_H__
4 #define __ARC_DTRSTATUS_H__
5 
6 #include <string>
7 #include <vector>
8 
9 namespace DataStaging {
10 
12 
16  class DTRStatus {
17 
18  public:
19 
22 
23  // ORDER IS IMPORTANT!!
24 
26  NEW,
27 
30 
33 
36 
39 
42 
45 
48 
51 
54 
57 
60 
63 
66 
69 
72 
75 
78 
81 
84 
87 
90 
93 
96 
99 
102 
105 
108 
111 
114 
117 
120 
123 
126 
129 
132 
133  };
134 
136  DTRStatus(const DTRStatusType& status, std::string desc="")
137  : status(status), desc(desc) {}
140  : status(NEW), desc ("") {}
141 
143  bool operator==(const DTRStatusType& s) const {
144  return status == s;
145  }
147  bool operator==(const DTRStatus& s) const {
148  return status == s.status;
149  }
150 
151 
153  bool operator!=(const DTRStatusType& s) const {
154  return status != s;
155  }
157  bool operator!=(const DTRStatus& s) const {
158  return status != s.status;
159  }
160 
163  status = s;
164  return *this;
165  }
166 
168  std::string str() const;
169 
171  void SetDesc(const std::string& d) {
172  desc = d;
173  }
174 
176  std::string GetDesc() const {
177  return desc;
178  }
179 
182  return status;
183  }
184 
185  // The actions in the following two vectors must match
187  static const std::vector<DTRStatus::DTRStatusType> ToProcessStates;
189  static const std::vector<DTRStatus::DTRStatusType> ProcessingStates;
190 
192  static const std::vector<DTRStatus::DTRStatusType> StagedStates;
193 
194  private:
195 
197  DTRStatusType status;
199  std::string desc;
200 
201  }; // DTRStatus
202 
204 
209 
210  public:
211 
214 
217 
220 
223 
226 
229 
232 
235 
238 
241 
244  };
245 
248 
251 
254 
257 
260 
263  };
264 
266 
273  DTRStatus::DTRStatusType error_state,
274  DTRErrorLocation location,
275  const std::string& desc = ""):
276  error_status(status),
277  last_error_state(error_state),
278  error_location(location),
279  desc(desc) {};
280 
283  error_status(NONE_ERROR),
284  last_error_state(DTRStatus::NULL_STATE),
285  error_location(NO_ERROR_LOCATION),
286  desc("") {};
287 
290  return error_status;
291  }
292 
295  return last_error_state.GetStatus();
296  }
297 
300  return error_location;
301  }
302 
304  std::string GetDesc() const {
305  return desc;
306  }
307 
309  bool operator==(const DTRErrorStatusType& s) const {
310  return error_status == s;
311  }
313  bool operator==(const DTRErrorStatus& s) const {
314  return error_status == s.error_status;
315  }
316 
318  bool operator!=(const DTRErrorStatusType& s) const {
319  return error_status != s;
320  }
322  bool operator!=(const DTRErrorStatus& s) const {
323  return error_status != s.error_status;
324  }
325 
328  error_status = s;
329  return *this;
330  }
331 
332  private:
334  DTRErrorStatusType error_status;
336  DTRStatus last_error_state;
338  DTRErrorLocation error_location;
340  std::string desc;
341 
342  };
343 
344 } // namespace DataStaging
345 
346 #endif /*__ARC_DTRSTATUS_H_*/