8 #ifndef ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H 9 #define ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H 11 #include <Atlas/Objects/Root.h> 12 #include <Atlas/Objects/SmartPtr.h> 14 #include <Atlas/Objects/objectFactory.h> 16 namespace Atlas {
namespace Objects {
namespace Operation {
28 class RootOperationData;
29 typedef SmartPtr<RootOperationData> RootOperation;
31 static const int ROOT_OPERATION_NO = 9;
48 m_class_no = ROOT_OPERATION_NO;
64 void setAttr(
const std::string& name,
67 void removeAttr(
const std::string& name)
override;
73 void addToMessage(Atlas::Message::MapType &)
const override;
80 void setFrom(
const std::string& val);
82 void setTo(
const std::string& val);
88 void setArgs(
const std::vector<Root>& val);
92 template <
class ObjectData>
104 const std::string&
getFrom()
const;
108 const std::string&
getTo()
const;
120 const std::vector<Root>&
getArgs()
const;
143 int getAttrClass(
const std::string& name)
const override;
145 int32_t
getAttrFlag(
const std::string& name)
const override;
176 void iterate(
int& current_class, std::string& attr)
const override;
180 friend class ::Atlas::Objects::Allocator;
185 void reset()
override;
186 void free()
override;
190 static void fillDefaultObjectInstance(
RootOperationData& data, std::map<std::string, int32_t>& attr_data);
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;
209 const int32_t SERIALNO_FLAG = 1 << 14;
214 m_attrFlags |= SERIALNO_FLAG;
217 const int32_t REFNO_FLAG = 1 << 15;
222 m_attrFlags |= REFNO_FLAG;
225 const int32_t FROM_FLAG = 1 << 16;
230 m_attrFlags |= FROM_FLAG;
233 const int32_t TO_FLAG = 1 << 17;
238 m_attrFlags |= TO_FLAG;
241 const int32_t SECONDS_FLAG = 1 << 18;
246 m_attrFlags |= SECONDS_FLAG;
249 const int32_t FUTURE_SECONDS_FLAG = 1 << 19;
254 m_attrFlags |= FUTURE_SECONDS_FLAG;
257 const int32_t ARGS_FLAG = 1 << 20;
262 m_attrFlags |= ARGS_FLAG;
267 m_attrFlags |= ARGS_FLAG;
269 for (
const auto& entry : val) {
271 attr_args.push_back(Factories::instance()->createObject(entry.Map()));
276 template <
class ObjectData>
279 m_attrFlags |= ARGS_FLAG;
286 if(m_attrFlags & SERIALNO_FLAG)
294 if(!(m_attrFlags & SERIALNO_FLAG))
301 if(m_attrFlags & REFNO_FLAG)
309 if(!(m_attrFlags & REFNO_FLAG))
316 if(m_attrFlags & FROM_FLAG)
324 if(!(m_attrFlags & FROM_FLAG))
331 if(m_attrFlags & TO_FLAG)
339 if(!(m_attrFlags & TO_FLAG))
346 if(m_attrFlags & SECONDS_FLAG)
354 if(!(m_attrFlags & SECONDS_FLAG))
361 if(m_attrFlags & FUTURE_SECONDS_FLAG)
369 if(!(m_attrFlags & FUTURE_SECONDS_FLAG))
376 if(m_attrFlags & ARGS_FLAG)
384 if(!(m_attrFlags & ARGS_FLAG))
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());
402 return (m_attrFlags & SERIALNO_FLAG) == 0;
407 return (m_attrFlags & REFNO_FLAG) == 0;
412 return (m_attrFlags & FROM_FLAG) == 0;
417 return (m_attrFlags & TO_FLAG) == 0;
422 return (m_attrFlags & SECONDS_FLAG) == 0;
427 return (m_attrFlags & FUTURE_SECONDS_FLAG) == 0;
432 return (m_attrFlags & ARGS_FLAG) == 0;
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
void setSeconds(double val)
Set the "seconds" attribute.
Definition: RootOperation.h:243
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
const Atlas::Message::ListType getArgsAsList() const
Retrieve the "args" attribute AsList.
Definition: RootOperation.h:389
void setArgs1(const SmartPtr< ObjectData > &val)
Set the first member of "args".
Definition: RootOperation.h:277
void sendTo(Atlas::Bridge &) const
Send the "to" attribute to an Atlas::Bridge.
bool isDefaultRefno() const
Is "refno" value default?
Definition: RootOperation.h:405
bool isDefaultFrom() const
Is "from" value default?
Definition: RootOperation.h:410
bool isDefaultArgs() const
Is "args" value default?
Definition: RootOperation.h:430
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
const std::string & getTo() const
Retrieve the "to" attribute.
Definition: RootOperation.h:329
double getSeconds() const
Retrieve the "seconds" attribute.
Definition: RootOperation.h:344
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
Retrieve the attribute "name".
void sendSerialno(Atlas::Bridge &) const
Send the "serialno" attribute to an Atlas::Bridge.
bool isDefaultFutureSeconds() const
Is "future_seconds" value default?
Definition: RootOperation.h:425
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
Multi-type container.
Definition: Element.h:60
std::string & modifyFrom()
Retrieve the "from" attribute as a non-const reference.
Definition: RootOperation.h:322
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
void sendFrom(Atlas::Bridge &) const
Send the "from" attribute to an Atlas::Bridge.
const std::string & getFrom() const
Retrieve the "from" attribute.
Definition: RootOperation.h:314
The Atlas namespace.
Definition: Bridge.h:20
bool isDefaultTo() const
Is "to" value default?
Definition: RootOperation.h:415
RootOperationData(RootOperationData *defaults=nullptr)
Construct a RootOperationData class definition.
Definition: RootOperation.h:45
All objects inherit from this.
Definition: Root.h:36
void sendRefno(Atlas::Bridge &) const
Send the "refno" attribute to an Atlas::Bridge.
~RootOperationData() override=default
Default destructor.
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 ¤t_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".
double attr_seconds
Time in seconds.
Definition: RootOperation.h:155
void reset() override
Resets the object as it's returned to the pool.
void free() override
Free an instance of this class, returning it to the memory pool.
bool isDefaultSerialno() const
Is "serialno" value default?
Definition: RootOperation.h:400
long getRefno() const
Retrieve the "refno" attribute.
Definition: RootOperation.h:299
bool isDefaultSeconds() const
Is "seconds" value default?
Definition: RootOperation.h:420
Trait which handles allocation of instances of BaseObject.
Definition: BaseObject.h:63
void setRefno(long val)
Set the "refno" attribute.
Definition: RootOperation.h:219
void sendArgs(Atlas::Bridge &) const
Send the "args" attribute to an Atlas::Bridge.
long getSerialno() const
Retrieve the "serialno" attribute.
Definition: RootOperation.h:284
std::string attr_to
Target of message/operation.
Definition: RootOperation.h:153
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
const std::vector< Root > & getArgs() const
Retrieve the "args" attribute.
Definition: RootOperation.h:374
void sendFutureSeconds(Atlas::Bridge &) const
Send the "future_seconds" attribute to an Atlas::Bridge.
int32_t getAttrFlag(const std::string &name) const override
Find the flag for the attribute "name".
void sendSeconds(Atlas::Bridge &) const
Send the "seconds" attribute to an Atlas::Bridge.
bool instanceOf(int classNo) const override
Is this instance of some class?
RootOperationData * copy() const override
Copy this object.
double getFutureSeconds() const
Retrieve the "future_seconds" attribute.
Definition: RootOperation.h:359