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/Factories.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;
55 static constexpr
const char* super_parent =
"root";
57 static constexpr
const char* default_parent =
"root_operation";
59 static constexpr
const char* default_objtype =
"op";
73 void removeAttr(
const std::string& name)
override;
79 void addToMessage(Atlas::Message::MapType &)
const override;
88 void setTo(std::string val);
94 void setArgs(std::vector<Root> val);
100 template <
class ObjectData>
112 const std::string&
getFrom()
const;
116 const std::string&
getTo()
const;
128 const std::vector<Root>&
getArgs()
const;
151 int getAttrClass(
const std::string& name)
const override;
153 bool getAttrFlag(
const std::string& name, uint32_t& flag)
const override;
186 friend class ::Atlas::Objects::Allocator;
191 void reset()
override;
192 void free()
override;
196 static void fillDefaultObjectInstance(
RootOperationData& data, std::map<std::string, uint32_t>& attr_data);
203 extern const std::string SERIALNO_ATTR;
204 extern const std::string REFNO_ATTR;
205 extern const std::string FROM_ATTR;
206 extern const std::string TO_ATTR;
207 extern const std::string SECONDS_ATTR;
208 extern const std::string FUTURE_SECONDS_ATTR;
209 extern const std::string ARGS_ATTR;
215 const uint32_t SERIALNO_FLAG = 1u << 14u;
220 m_attrFlags |= SERIALNO_FLAG;
223 const uint32_t REFNO_FLAG = 1u << 15u;
228 m_attrFlags |= REFNO_FLAG;
231 const uint32_t FROM_FLAG = 1u << 16u;
236 m_attrFlags |= FROM_FLAG;
239 const uint32_t TO_FLAG = 1u << 17u;
244 m_attrFlags |= TO_FLAG;
247 const uint32_t SECONDS_FLAG = 1u << 18u;
252 m_attrFlags |= SECONDS_FLAG;
255 const uint32_t FUTURE_SECONDS_FLAG = 1u << 19u;
260 m_attrFlags |= FUTURE_SECONDS_FLAG;
263 const uint32_t ARGS_FLAG = 1u << 20u;
268 m_attrFlags |= ARGS_FLAG;
274 throw Exception(
"You must pass in a valid Factories instance when setting 'args'.");
276 m_attrFlags |= ARGS_FLAG;
283 throw Exception(
"You must pass in a valid Factories instance when setting 'args'.");
285 m_attrFlags |= ARGS_FLAG;
289 template <
class ObjectData>
292 m_attrFlags |= ARGS_FLAG;
299 if(m_attrFlags & SERIALNO_FLAG)
307 if(!(m_attrFlags & SERIALNO_FLAG))
314 if(m_attrFlags & REFNO_FLAG)
322 if(!(m_attrFlags & REFNO_FLAG))
329 if(m_attrFlags & FROM_FLAG)
337 if(!(m_attrFlags & FROM_FLAG))
344 if(m_attrFlags & TO_FLAG)
352 if(!(m_attrFlags & TO_FLAG))
359 if(m_attrFlags & SECONDS_FLAG)
367 if(!(m_attrFlags & SECONDS_FLAG))
374 if(m_attrFlags & FUTURE_SECONDS_FLAG)
382 if(!(m_attrFlags & FUTURE_SECONDS_FLAG))
389 if(m_attrFlags & ARGS_FLAG)
397 if(!(m_attrFlags & ARGS_FLAG))
404 const std::vector<Root>& args_in =
getArgs();
405 Atlas::Message::ListType args_out;
406 for (
const auto& entry : args_in) {
407 args_out.push_back(Atlas::Message::MapType());
408 entry->addToMessage(args_out.back().Map());
415 return (m_attrFlags & SERIALNO_FLAG) == 0;
420 return (m_attrFlags & REFNO_FLAG) == 0;
425 return (m_attrFlags & FROM_FLAG) == 0;
430 return (m_attrFlags & TO_FLAG) == 0;
435 return (m_attrFlags & SECONDS_FLAG) == 0;
440 return (m_attrFlags & FUTURE_SECONDS_FLAG) == 0;
445 return (m_attrFlags & ARGS_FLAG) == 0;
451 #endif // ATLAS_OBJECTS_OPERATION_ROOTOPERATION_H std::int64_t attr_serialno
Serial number.
std::string attr_to
Target of message/operation.
bool getAttrFlag(const std::string &name, uint32_t &flag) const override
Find the flag for the attribute "name".
void setArgs1(SmartPtr< ObjectData > val)
Set the first member of "args".
void removeAttr(const std::string &name) override
Remove the attribute "name". This will not work for static attributes.
const std::string & getTo() const
Retrieve the "to" attribute.
void setTo(std::string val)
Set the "to" attribute.
void addToMessage(Atlas::Message::MapType &) const override
Write this object to an existing Element.
std::string & modifyFrom()
Retrieve the "from" attribute as a non-const reference.
std::string attr_from
Source of message/operation.
void setSerialno(std::int64_t val)
Set the "serialno" attribute.
std::int64_t & modifyRefno()
Retrieve the "refno" attribute as a non-const reference.
void setArgsAsList(const Atlas::Message::ListType &val, const Atlas::Objects::Factories *factories)
Set the "args" attribute AsList.
bool isDefaultArgs() const
Is "args" value default?
Atlas::Message::ListType getArgsAsList() const
Retrieve the "args" attribute AsList.
double & modifySeconds()
Retrieve the "seconds" attribute as a non-const reference.
double getSeconds() const
Retrieve the "seconds" attribute.
void sendRefno(Atlas::Bridge &) const
Send the "refno" attribute to an Atlas::Bridge.
void setAttr(std::string name, Atlas::Message::Element attr, const Atlas::Objects::Factories *factories=nullptr) override
Set the attribute "name" to the value given by"attr".
void setSeconds(double val)
Set the "seconds" attribute.
std::vector< Root > & modifyArgs()
Retrieve the "args" attribute as a non-const reference.
void setFrom(std::string val)
Set the "from" attribute.
const std::string & getFrom() const
Retrieve the "from" attribute.
std::vector< Root > parseListOfObjects(const Atlas::Message::ListType &val) const
void sendArgs(Atlas::Bridge &) const
Send the "args" attribute to an Atlas::Bridge.
void sendSeconds(Atlas::Bridge &) const
Send the "seconds" attribute to an Atlas::Bridge.
double attr_seconds
Time in seconds.
bool isDefaultSerialno() const
Is "serialno" value default?
void setArgs(std::vector< Root > val)
Set the "args" attribute.
void setFutureSeconds(double val)
Set the "future_seconds" attribute.
Base operation for all operators.
std::string & modifyTo()
Retrieve the "to" attribute as a non-const reference.
const std::vector< Root > & getArgs() const
Retrieve the "args" attribute.
double attr_future_seconds
Time in seconds to add current time.
std::int64_t getRefno() const
Retrieve the "refno" attribute.
void sendSerialno(Atlas::Bridge &) const
Send the "serialno" attribute to an Atlas::Bridge.
int copyAttr(const std::string &name, Atlas::Message::Element &attr) const override
void sendFrom(Atlas::Bridge &) const
Send the "from" attribute to an Atlas::Bridge.
All objects inherit from this..
double & modifyFutureSeconds()
Retrieve the "future_seconds" attribute as a non-const reference.
int getAttrClass(const std::string &name) const override
Find the class which contains the attribute "name".
bool isDefaultFrom() const
Is "from" value default?
void sendTo(Atlas::Bridge &) const
Send the "to" attribute to an Atlas::Bridge.
RootOperationData(RootOperationData *defaults=nullptr)
Construct a RootOperationData class definition.
std::vector< Root > attr_args
List of arguments this operation has.
~RootOperationData() override=default
Default destructor.
std::int64_t & modifySerialno()
Retrieve the "serialno" attribute as a non-const reference.
void sendFutureSeconds(Atlas::Bridge &) const
Send the "future_seconds" attribute to an Atlas::Bridge.
RootOperationData * copy() const override
Copy this object.
bool isDefaultRefno() const
Is "refno" value default?
BaseObjectData * m_defaults
bool instanceOf(int classNo) const override
Is this instance of some class?
void reset() override
Resets the object as it's returned to the pool.
void sendContents(Atlas::Bridge &b) const override
Send the contents of this object to a Bridge.
std::int64_t getSerialno() const
Retrieve the "serialno" attribute.
void free() override
Free an instance of this class, returning it to the memory pool.
double getFutureSeconds() const
Retrieve the "future_seconds" attribute.
bool isDefaultFutureSeconds() const
Is "future_seconds" value default?
bool isDefaultSeconds() const
Is "seconds" value default?
std::int64_t attr_refno
Reference to serial number.
bool isDefaultTo() const
Is "to" value default?
void setRefno(std::int64_t val)
Set the "refno" attribute.