libepp_nicbr
Launch.H
Go to the documentation of this file.
1 /* ${copyright}$ */
2 /* $Id$ */
7 #ifndef __LAUNCH_H__
8 #define __LAUNCH_H__
9 
10 #include <list>
11 #include <string>
12 
13 #include "SMD.H"
14 
15 using std::list;
16 using std::string;
17 
18 LIBEPP_NICBR_NS_BEGIN
19 
21 class CodeMark
22 {
23 public:
26  {
27  reset();
28  }
29 
31 
34  void set_code(const string &code) { _code = code; }
35 
37 
40  string get_code() const { return _code; }
41 
43 
46  void set_mark(const SMDMark &mark) { _mark = mark; }
47 
49 
52  SMDMark get_mark() const { return _mark; }
53 
55  void reset()
56  {
57  _code.clear();
58  _mark.reset();
59  }
60 
61 private:
65  string _code;
66 
68  SMDMark _mark;
69 };
70 
73 {
74 public:
77  {
78  reset();
79  }
80 
82 
85  void set_encoding(const string &encoding) { _encoding = encoding; }
86 
88 
91  string get_encoding() const { return _encoding; }
92 
94 
97  void set_data(const string &data) { _data = data; }
98 
100 
103  string get_data() const { return _data; }
104 
106  void reset()
107  {
108  _encoding.clear();
109  _data.clear();
110  }
111 
112 private:
114  string _encoding;
116  string _data;
117 };
118 
119 
122 {
123 public:
125  enum Value {
126  NONE,
127  SUNRISE,
128  LANDRUSH,
129  CLAIMS,
130  OPEN,
131  CUSTOM
132  };
133 
135 
139  static string toStr(const Value value)
140  {
141  switch (value) {
142  case NONE:
143  break;
144  case SUNRISE:
145  return "sunrise";
146  case LANDRUSH:
147  return "landrush";
148  case CLAIMS:
149  return "claims";
150  case OPEN:
151  return "open";
152  case CUSTOM:
153  return "custom";
154  }
155 
156  return "";
157  }
158 
160 
164  static Value fromStr(const string &value)
165  {
166  if (value == "sunrise") {
167  return SUNRISE;
168 
169  } else if (value == "landrush") {
170  return LANDRUSH;
171 
172  } else if (value == "claims") {
173  return CLAIMS;
174 
175  } else if (value == "open") {
176  return OPEN;
177 
178  } else if (value == "custom") {
179  return CUSTOM;
180  }
181 
182  return NONE;
183  }
184 
187  {
188  reset();
189  }
190 
192 
195  LaunchPhase(const Value phase) :
196  _phase(phase),
197  _name("")
198  {
199  }
200 
202 
205  LaunchPhase(const string &name) :
206  _phase(CUSTOM),
207  _name(name)
208  {
209  }
210 
212 
215  void set_phase(const Value phase) { _phase = phase; }
216 
218 
221  Value get_phase() const { return _phase; }
222 
224 
227  void set_name(const string &name) { _name = name; }
228 
230 
233  string get_name() const { return _name; }
234 
236  void reset()
237  {
238  _phase = NONE;
239  _name.clear();
240  }
241 
242 private:
244  Value _phase;
245 
247  string _name;
248 };
249 
250 LIBEPP_NICBR_NS_END
251 
252 #endif // __LAUNCH_H__
LaunchPhase(const Value phase)
Constructor used when the phase is not CUSTOM.
Definition: Launch.H:195
void set_phase(const Value phase)
Sets the launch phase.
Definition: Launch.H:215
EPP CodeMark Class.
Definition: Launch.H:21
EPP EncodedSignedMark Class.
Definition: Launch.H:72
void reset()
Reset object attributes.
Definition: SMD.H:1314
EPP Launch Phase Class.
Definition: Launch.H:121
EPP SMDMark Class.
Definition: SMD.H:1244
void set_mark(const SMDMark &mark)
Sets the mark information.
Definition: Launch.H:46
void reset()
Reset object attributes.
Definition: Launch.H:106
void set_data(const string &data)
Sets the signed mark encoded data.
Definition: Launch.H:97
SMDMark get_mark() const
Returns the mark information.
Definition: Launch.H:52
EncodedSignedMark()
Default constructor.
Definition: Launch.H:76
static string toStr(const Value value)
Convert phase to text format.
Definition: Launch.H:139
Value
Possible phase values.
Definition: Launch.H:125
void reset()
Reset object attributes.
Definition: Launch.H:236
Signed Mark Data (SMD)
LaunchPhase(const string &name)
Constructor used when the phase is CUSTOM.
Definition: Launch.H:205
Value get_phase() const
Returns the launch phase.
Definition: Launch.H:221
void set_name(const string &name)
Sets the launch phase name when the phase is CUSTOM.
Definition: Launch.H:227
string get_name() const
Returns the launch phase name when the phase is CUSTOM.
Definition: Launch.H:233
void set_code(const string &code)
Sets the code used to validate the information.
Definition: Launch.H:34
string get_code() const
Returns the code used to validate the information.
Definition: Launch.H:40
string get_data() const
Returns the signed mark encoded data.
Definition: Launch.H:103
void set_encoding(const string &encoding)
Sets the encoding of the data.
Definition: Launch.H:85
LaunchPhase()
Default constructor.
Definition: Launch.H:186
static Value fromStr(const string &value)
Convert text phase to value.
Definition: Launch.H:164
CodeMark()
Default constructor.
Definition: Launch.H:25
void reset()
Reset object attributes.
Definition: Launch.H:55
string get_encoding() const
Returns the encoding of the data.
Definition: Launch.H:91