Atlas-C++
RootOperation.h
1 // This file may be redistributed and modified only under the terms of
2 // the GNU Lesser General Public License (See COPYING for details).
3 // Copyright 2000-2001 Stefanus Du Toit and Aloril.
4 // Copyright 2001-2005 Alistair Riddoch.
5 // Copyright 2011 Erik Ogenvik.
6 // Automatically generated using gen_cpp.py.
7 
8 #ifndef ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H
9 #define ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H
10 
11 #include <Atlas/Objects/Root.h>
12 #include <Atlas/Objects/SmartPtr.h>
13 
14 #include <Atlas/Objects/objectFactory.h>
15 
16 namespace Atlas { namespace Objects { namespace Operation {
17 
28 class RootOperationData;
29 typedef SmartPtr<RootOperationData> RootOperation;
30 
31 static const int ROOT_OPERATION_NO = 9;
32 
35 
42 {
43 protected:
45  RootOperationData(RootOperationData *defaults = nullptr) :
46  RootData((RootData*)defaults)
47  {
48  m_class_no = ROOT_OPERATION_NO;
49  }
51  ~RootOperationData() override = default;
52 
53 public:
55  RootOperationData * copy() const override;
56 
58  bool instanceOf(int classNo) const override;
59 
62  int copyAttr(const std::string& name, Atlas::Message::Element & attr) const override;
64  void setAttr(const std::string& name,
65  const Atlas::Message::Element& attr) override;
67  void removeAttr(const std::string& name) override;
68 
70  void sendContents(Atlas::Bridge & b) const override;
71 
73  void addToMessage(Atlas::Message::MapType &) const override;
74 
76  void setSerialno(long val);
78  void setRefno(long val);
80  void setFrom(const std::string& val);
82  void setTo(const std::string& val);
84  void setSeconds(double val);
86  void setFutureSeconds(double val);
88  void setArgs(const std::vector<Root>& val);
90  void setArgsAsList(const Atlas::Message::ListType& val);
92  template <class ObjectData>
93  void setArgs1(const SmartPtr<ObjectData> & val);
94 
96  long getSerialno() const;
98  long& modifySerialno();
100  long getRefno() const;
102  long& modifyRefno();
104  const std::string& getFrom() const;
106  std::string& modifyFrom();
108  const std::string& getTo() const;
110  std::string& modifyTo();
112  double getSeconds() const;
114  double& modifySeconds();
116  double getFutureSeconds() const;
118  double& modifyFutureSeconds();
120  const std::vector<Root>& getArgs() const;
122  std::vector<Root>& modifyArgs();
124  const Atlas::Message::ListType getArgsAsList() const;
125 
127  bool isDefaultSerialno() const;
129  bool isDefaultRefno() const;
131  bool isDefaultFrom() const;
133  bool isDefaultTo() const;
135  bool isDefaultSeconds() const;
137  bool isDefaultFutureSeconds() const;
139  bool isDefaultArgs() const;
140 
141 protected:
143  int getAttrClass(const std::string& name)const override;
145  int32_t getAttrFlag(const std::string& name)const override;
151  std::string attr_from;
153  std::string attr_to;
155  double attr_seconds;
159  std::vector<Root> attr_args;
160 
162  void sendSerialno(Atlas::Bridge&) const;
164  void sendRefno(Atlas::Bridge&) const;
166  void sendFrom(Atlas::Bridge&) const;
168  void sendTo(Atlas::Bridge&) const;
170  void sendSeconds(Atlas::Bridge&) const;
172  void sendFutureSeconds(Atlas::Bridge&) const;
174  void sendArgs(Atlas::Bridge&) const;
175 
176  void iterate(int& current_class, std::string& attr) const override;
177 
178 public:
179  template <typename>
180  friend class ::Atlas::Objects::Allocator;
181  static Allocator<RootOperationData> allocator;
182 
183 protected:
185  void reset() override;
186  void free() override;
187 
188 private:
189 
190  static void fillDefaultObjectInstance(RootOperationData& data, std::map<std::string, int32_t>& attr_data);
191 };
192 
193 //
194 // Attribute name strings follow.
195 //
196 
197 extern const std::string SERIALNO_ATTR;
198 extern const std::string REFNO_ATTR;
199 extern const std::string FROM_ATTR;
200 extern const std::string TO_ATTR;
201 extern const std::string SECONDS_ATTR;
202 extern const std::string FUTURE_SECONDS_ATTR;
203 extern const std::string ARGS_ATTR;
204 
205 //
206 // Inlined member functions follow.
207 //
208 
209 const int32_t SERIALNO_FLAG = 1 << 14;
210 
211 inline void RootOperationData::setSerialno(long val)
212 {
213  attr_serialno = val;
214  m_attrFlags |= SERIALNO_FLAG;
215 }
216 
217 const int32_t REFNO_FLAG = 1 << 15;
218 
219 inline void RootOperationData::setRefno(long val)
220 {
221  attr_refno = val;
222  m_attrFlags |= REFNO_FLAG;
223 }
224 
225 const int32_t FROM_FLAG = 1 << 16;
226 
227 inline void RootOperationData::setFrom(const std::string& val)
228 {
229  attr_from = val;
230  m_attrFlags |= FROM_FLAG;
231 }
232 
233 const int32_t TO_FLAG = 1 << 17;
234 
235 inline void RootOperationData::setTo(const std::string& val)
236 {
237  attr_to = val;
238  m_attrFlags |= TO_FLAG;
239 }
240 
241 const int32_t SECONDS_FLAG = 1 << 18;
242 
243 inline void RootOperationData::setSeconds(double val)
244 {
245  attr_seconds = val;
246  m_attrFlags |= SECONDS_FLAG;
247 }
248 
249 const int32_t FUTURE_SECONDS_FLAG = 1 << 19;
250 
251 inline void RootOperationData::setFutureSeconds(double val)
252 {
253  attr_future_seconds = val;
254  m_attrFlags |= FUTURE_SECONDS_FLAG;
255 }
256 
257 const int32_t ARGS_FLAG = 1 << 20;
258 
259 inline void RootOperationData::setArgs(const std::vector<Root>& val)
260 {
261  attr_args = val;
262  m_attrFlags |= ARGS_FLAG;
263 }
264 
265 inline void RootOperationData::setArgsAsList(const Atlas::Message::ListType& val)
266 {
267  m_attrFlags |= ARGS_FLAG;
268  attr_args.resize(0);
269  for (const auto& entry : val) {
270  if (entry.isMap()) {
271  attr_args.push_back(Factories::instance()->createObject(entry.Map()));
272  }
273  }
274 }
275 
276 template <class ObjectData>
278 {
279  m_attrFlags |= ARGS_FLAG;
280  if(attr_args.size()!=1) attr_args.resize(1);
281  attr_args[0] = val;
282 }
283 
285 {
286  if(m_attrFlags & SERIALNO_FLAG)
287  return attr_serialno;
288  else
289  return ((RootOperationData*)m_defaults)->attr_serialno;
290 }
291 
293 {
294  if(!(m_attrFlags & SERIALNO_FLAG))
296  return attr_serialno;
297 }
298 
299 inline long RootOperationData::getRefno() const
300 {
301  if(m_attrFlags & REFNO_FLAG)
302  return attr_refno;
303  else
304  return ((RootOperationData*)m_defaults)->attr_refno;
305 }
306 
308 {
309  if(!(m_attrFlags & REFNO_FLAG))
311  return attr_refno;
312 }
313 
314 inline const std::string& RootOperationData::getFrom() const
315 {
316  if(m_attrFlags & FROM_FLAG)
317  return attr_from;
318  else
319  return ((RootOperationData*)m_defaults)->attr_from;
320 }
321 
322 inline std::string& RootOperationData::modifyFrom()
323 {
324  if(!(m_attrFlags & FROM_FLAG))
326  return attr_from;
327 }
328 
329 inline const std::string& RootOperationData::getTo() const
330 {
331  if(m_attrFlags & TO_FLAG)
332  return attr_to;
333  else
334  return ((RootOperationData*)m_defaults)->attr_to;
335 }
336 
337 inline std::string& RootOperationData::modifyTo()
338 {
339  if(!(m_attrFlags & TO_FLAG))
341  return attr_to;
342 }
343 
344 inline double RootOperationData::getSeconds() const
345 {
346  if(m_attrFlags & SECONDS_FLAG)
347  return attr_seconds;
348  else
349  return ((RootOperationData*)m_defaults)->attr_seconds;
350 }
351 
353 {
354  if(!(m_attrFlags & SECONDS_FLAG))
356  return attr_seconds;
357 }
358 
360 {
361  if(m_attrFlags & FUTURE_SECONDS_FLAG)
362  return attr_future_seconds;
363  else
364  return ((RootOperationData*)m_defaults)->attr_future_seconds;
365 }
366 
368 {
369  if(!(m_attrFlags & FUTURE_SECONDS_FLAG))
371  return attr_future_seconds;
372 }
373 
374 inline const std::vector<Root>& RootOperationData::getArgs() const
375 {
376  if(m_attrFlags & ARGS_FLAG)
377  return attr_args;
378  else
379  return ((RootOperationData*)m_defaults)->attr_args;
380 }
381 
382 inline std::vector<Root>& RootOperationData::modifyArgs()
383 {
384  if(!(m_attrFlags & ARGS_FLAG))
386  return attr_args;
387 }
388 
389 inline const Atlas::Message::ListType RootOperationData::getArgsAsList() const
390 {
391  const std::vector<Root>& args_in = getArgs();
392  Atlas::Message::ListType args_out;
393  for (const auto& entry : args_in) {
394  args_out.push_back(Atlas::Message::MapType());
395  entry->addToMessage(args_out.back().Map());
396  }
397  return args_out;
398 }
399 
401 {
402  return (m_attrFlags & SERIALNO_FLAG) == 0;
403 }
404 
406 {
407  return (m_attrFlags & REFNO_FLAG) == 0;
408 }
409 
411 {
412  return (m_attrFlags & FROM_FLAG) == 0;
413 }
414 
416 {
417  return (m_attrFlags & TO_FLAG) == 0;
418 }
419 
421 {
422  return (m_attrFlags & SECONDS_FLAG) == 0;
423 }
424 
426 {
427  return (m_attrFlags & FUTURE_SECONDS_FLAG) == 0;
428 }
429 
431 {
432  return (m_attrFlags & ARGS_FLAG) == 0;
433 }
434 
435 
436 } } } // namespace Atlas::Objects::Operation
437 
438 #endif // ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H
long attr_refno
Reference to serial number.
Definition: RootOperation.h:149
double & modifyFutureSeconds()
Retrieve the "future_seconds" attribute as a non-const reference.
Definition: RootOperation.h:367
void setArgs(const std::vector< Root > &val)
Set the "args" attribute.
Definition: RootOperation.h:259
long getRefno() const
Retrieve the "refno" attribute.
Definition: RootOperation.h:299
void setSeconds(double val)
Set the "seconds" attribute.
Definition: RootOperation.h:243
bool isDefaultFrom() const
Is "from" value default?
Definition: RootOperation.h:410
const std::vector< Root > & getArgs() const
Retrieve the "args" attribute.
Definition: RootOperation.h:374
std::string attr_from
Source of message/operation.
Definition: RootOperation.h:151
std::string & modifyTo()
Retrieve the "to" attribute as a non-const reference.
Definition: RootOperation.h:337
Base operation for all operators.
Definition: RootOperation.h:41
void setArgs1(const SmartPtr< ObjectData > &val)
Set the first member of "args".
Definition: RootOperation.h:277
Atlas stream bridge.
Definition: Bridge.h:35
long & modifyRefno()
Retrieve the "refno" attribute as a non-const reference.
Definition: RootOperation.h:307
std::vector< Root > & modifyArgs()
Retrieve the "args" attribute as a non-const reference.
Definition: RootOperation.h:382
void setTo(const std::string &val)
Set the "to" attribute.
Definition: RootOperation.h:235
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
Retrieve the attribute "name".
double getFutureSeconds() const
Retrieve the "future_seconds" attribute.
Definition: RootOperation.h:359
double attr_future_seconds
Time in seconds to add current time.
Definition: RootOperation.h:157
BaseObjectData * m_defaults
The default instance, acting as a prototype for all other instances.
Definition: BaseObject.h:440
void setFutureSeconds(double val)
Set the "future_seconds" attribute.
Definition: RootOperation.h:251
void sendSeconds(Atlas::Bridge &) const
Send the "seconds" attribute to an Atlas::Bridge.
Multi-type container.
Definition: Element.h:60
std::string & modifyFrom()
Retrieve the "from" attribute as a non-const reference.
Definition: RootOperation.h:322
bool isDefaultRefno() const
Is "refno" value default?
Definition: RootOperation.h:405
void setArgsAsList(const Atlas::Message::ListType &val)
Set the "args" attribute AsList.
Definition: RootOperation.h:265
std::vector< Root > attr_args
List of arguments this operation has.
Definition: RootOperation.h:159
void setFrom(const std::string &val)
Set the "from" attribute.
Definition: RootOperation.h:227
double & modifySeconds()
Retrieve the "seconds" attribute as a non-const reference.
Definition: RootOperation.h:352
void setSerialno(long val)
Set the "serialno" attribute.
Definition: RootOperation.h:211
long attr_serialno
Serial number.
Definition: RootOperation.h:147
long & modifySerialno()
Retrieve the "serialno" attribute as a non-const reference.
Definition: RootOperation.h:292
The Atlas namespace.
Definition: Bridge.h:20
RootOperationData(RootOperationData *defaults=nullptr)
Construct a RootOperationData class definition.
Definition: RootOperation.h:45
All objects inherit from this.
Definition: Root.h:36
bool isDefaultTo() const
Is "to" value default?
Definition: RootOperation.h:415
~RootOperationData() override=default
Default destructor.
void sendTo(Atlas::Bridge &) const
Send the "to" attribute to an Atlas::Bridge.
const Atlas::Message::ListType getArgsAsList() const
Retrieve the "args" attribute AsList.
Definition: RootOperation.h:389
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
void setAttr(const std::string &name, const Atlas::Message::Element &attr) override
Set the attribute "name" to the value given by"attr".
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
void iterate(int &current_class, std::string &attr) const override
Iterate over the attributes of this instance.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
void sendArgs(Atlas::Bridge &) const
Send the "args" attribute to an Atlas::Bridge.
double attr_seconds
Time in seconds.
Definition: RootOperation.h:155
double getSeconds() const
Retrieve the "seconds" attribute.
Definition: RootOperation.h:344
void reset() override
Resets the object as it&#39;s returned to the pool.
void free() override
Free an instance of this class, returning it to the memory pool.
void sendFrom(Atlas::Bridge &) const
Send the "from" attribute to an Atlas::Bridge.
void sendFutureSeconds(Atlas::Bridge &) const
Send the "future_seconds" attribute to an Atlas::Bridge.
bool isDefaultSeconds() const
Is "seconds" value default?
Definition: RootOperation.h:420
const std::string & getFrom() const
Retrieve the "from" attribute.
Definition: RootOperation.h:314
Definition: Decoder.h:16
void sendSerialno(Atlas::Bridge &) const
Send the "serialno" attribute to an Atlas::Bridge.
Trait which handles allocation of instances of BaseObject.
Definition: BaseObject.h:63
bool isDefaultFutureSeconds() const
Is "future_seconds" value default?
Definition: RootOperation.h:425
void setRefno(long val)
Set the "refno" attribute.
Definition: RootOperation.h:219
const std::string & getTo() const
Retrieve the "to" attribute.
Definition: RootOperation.h:329
std::string attr_to
Target of message/operation.
Definition: RootOperation.h:153
long getSerialno() const
Retrieve the "serialno" attribute.
Definition: RootOperation.h:284
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
int32_t getAttrFlag(const std::string &name) const override
Find the flag for the attribute "name".
bool isDefaultArgs() const
Is "args" value default?
Definition: RootOperation.h:430
bool instanceOf(int classNo) const override
Is this instance of some class?
RootOperationData * copy() const override
Copy this object.
bool isDefaultSerialno() const
Is "serialno" value default?
Definition: RootOperation.h:400
void sendRefno(Atlas::Bridge &) const
Send the "refno" attribute to an Atlas::Bridge.

Copyright 2000-2004 the respective authors.

This document can be licensed under the terms of the GNU Free Documentation License or the GNU General Public License and may be freely distributed under the terms given by one of these licenses.