3 #ifndef FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_ 4 #define FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_ 20 struct StatusChangeLog;
41 static const char*
const names[] = {
"IDLE",
"RUNNING",
"SUCCESS",
"FAILURE",
nullptr};
47 const size_t index =
static_cast<int>(e);
72 static const char*
const names[] = {
"UNDEFINED",
"ACTION",
"CONDITION",
"CONTROL",
73 "DECORATOR",
"SUBTREE",
nullptr};
79 const size_t index =
static_cast<int>(e);
86 uint64_t usec_since_epoch_;
91 memset(
this, 0,
sizeof(Timestamp));
93 Timestamp(uint64_t _usec_since_epoch)
94 : usec_since_epoch_(flatbuffers::EndianScalar(_usec_since_epoch))
97 uint64_t usec_since_epoch()
const 99 return flatbuffers::EndianScalar(usec_since_epoch_);
111 Timestamp timestamp_;
116 memset(
this, 0,
sizeof(StatusChange));
118 StatusChange(uint16_t _uid,
Status _prev_status,
Status _status,
const Timestamp& _timestamp)
119 : uid_(flatbuffers::EndianScalar(_uid))
120 , prev_status_(flatbuffers::EndianScalar(static_cast<int8_t>(_prev_status)))
121 , status_(flatbuffers::EndianScalar(static_cast<int8_t>(_status)))
123 , timestamp_(_timestamp)
129 return flatbuffers::EndianScalar(uid_);
131 Status prev_status()
const 133 return static_cast<Status>(flatbuffers::EndianScalar(prev_status_));
137 return static_cast<Status>(flatbuffers::EndianScalar(status_));
139 const Timestamp& timestamp()
const 155 return GetPointer<const flatbuffers::String*>(VT_KEY);
159 return GetPointer<const flatbuffers::String*>(VT_VALUE);
161 bool Verify(flatbuffers::Verifier& verifier)
const 163 return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_KEY) &&
164 verifier.Verify(key()) && VerifyOffset(verifier, VT_VALUE) &&
165 verifier.Verify(value()) && verifier.EndTable();
175 fbb_.AddOffset(KeyValue::VT_KEY, key);
179 fbb_.AddOffset(KeyValue::VT_VALUE, value);
183 start_ = fbb_.StartTable();
188 const auto end = fbb_.EndTable(start_);
205 const char* key =
nullptr,
206 const char* value =
nullptr)
212 struct TreeNode FLATBUFFERS_FINAL_CLASS :
private flatbuffers::Table
220 VT_INSTANCE_NAME = 12,
221 VT_REGISTRATION_NAME = 14,
226 return GetField<uint16_t>(VT_UID, 0);
230 return GetPointer<const flatbuffers::Vector<uint16_t>*>(VT_CHILDREN_UID);
234 return static_cast<Type>(GetField<int8_t>(VT_TYPE, 0));
238 return static_cast<Status>(GetField<int8_t>(VT_STATUS, 0));
242 return GetPointer<const flatbuffers::String*>(VT_INSTANCE_NAME);
246 return GetPointer<const flatbuffers::String*>(VT_REGISTRATION_NAME);
250 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>>*>(VT_PARAMS);
252 bool Verify(flatbuffers::Verifier& verifier)
const 254 return VerifyTableStart(verifier) && VerifyField<uint16_t>(verifier, VT_UID) &&
255 VerifyOffset(verifier, VT_CHILDREN_UID) && verifier.Verify(children_uid()) &&
256 VerifyField<int8_t>(verifier, VT_TYPE) && VerifyField<int8_t>(verifier, VT_STATUS) &&
257 VerifyOffsetRequired(verifier, VT_INSTANCE_NAME) &&
258 verifier.Verify(instance_name()) &&
259 VerifyOffsetRequired(verifier, VT_REGISTRATION_NAME) &&
260 verifier.Verify(registration_name()) && VerifyOffset(verifier, VT_PARAMS) &&
261 verifier.Verify(params()) && verifier.VerifyVectorOfTables(params()) &&
272 fbb_.AddElement<uint16_t>(TreeNode::VT_UID, uid, 0);
276 fbb_.AddOffset(TreeNode::VT_CHILDREN_UID, children_uid);
280 fbb_.AddElement<int8_t>(TreeNode::VT_TYPE,
static_cast<int8_t
>(type), 0);
284 fbb_.AddElement<int8_t>(TreeNode::VT_STATUS,
static_cast<int8_t
>(status), 0);
288 fbb_.AddOffset(TreeNode::VT_INSTANCE_NAME, instance_name);
292 fbb_.AddOffset(TreeNode::VT_REGISTRATION_NAME, registration_name);
296 fbb_.AddOffset(TreeNode::VT_PARAMS, params);
300 start_ = fbb_.StartTable();
305 const auto end = fbb_.EndTable(start_);
307 fbb_.Required(o, TreeNode::VT_INSTANCE_NAME);
308 fbb_.Required(o, TreeNode::VT_REGISTRATION_NAME);
334 const std::vector<uint16_t>* children_uid =
nullptr,
336 const char* instance_name =
nullptr,
const char* registration_name =
nullptr,
340 _fbb, uid, children_uid ? _fbb.
CreateVector<uint16_t>(*children_uid) : 0, type, status,
342 registration_name ? _fbb.
CreateString(registration_name) : 0,
346 struct BehaviorTree FLATBUFFERS_FINAL_CLASS :
private flatbuffers::Table
355 return GetField<uint16_t>(VT_ROOT_UID, 0);
359 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TreeNode>>*>(VT_NODES);
361 bool Verify(flatbuffers::Verifier& verifier)
const 363 return VerifyTableStart(verifier) && VerifyField<uint16_t>(verifier, VT_ROOT_UID) &&
364 VerifyOffset(verifier, VT_NODES) && verifier.Verify(nodes()) &&
365 verifier.VerifyVectorOfTables(nodes()) && verifier.EndTable();
375 fbb_.AddElement<uint16_t>(BehaviorTree::VT_ROOT_UID, root_uid, 0);
379 fbb_.AddOffset(BehaviorTree::VT_NODES, nodes);
383 start_ = fbb_.StartTable();
388 const auto end = fbb_.EndTable(start_);
412 struct StatusChangeLog FLATBUFFERS_FINAL_CLASS :
private flatbuffers::Table
416 VT_BEHAVIOR_TREE = 4,
421 return GetPointer<const BehaviorTree*>(VT_BEHAVIOR_TREE);
425 return GetPointer<const flatbuffers::Vector<const StatusChange*>*>(VT_STATE_CHANGES);
427 bool Verify(flatbuffers::Verifier& verifier)
const 429 return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_BEHAVIOR_TREE) &&
430 verifier.VerifyTable(behavior_tree()) && VerifyOffset(verifier, VT_STATE_CHANGES) &&
431 verifier.Verify(state_changes()) && verifier.EndTable();
441 fbb_.AddOffset(StatusChangeLog::VT_BEHAVIOR_TREE, behavior_tree);
446 fbb_.AddOffset(StatusChangeLog::VT_STATE_CHANGES, state_changes);
450 start_ = fbb_.StartTable();
455 const auto end = fbb_.EndTable(start_);
473 const std::vector<StatusChange>* state_changes =
nullptr)
482 return flatbuffers::GetRoot<BT_Serialization::BehaviorTree>(buf);
487 return flatbuffers::GetSizePrefixedRoot<BT_Serialization::BehaviorTree>(buf);
492 return verifier.VerifyBuffer<BT_Serialization::BehaviorTree>(
nullptr);
497 return verifier.VerifySizePrefixedBuffer<BT_Serialization::BehaviorTree>(
nullptr);
514 #endif // FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_ void add_value(flatbuffers::Offset< flatbuffers::String > value)
flatbuffers::Offset< KeyValue > CreateKeyValueDirect(flatbuffers::FlatBufferBuilder &_fbb, const char *key=nullptr, const char *value=nullptr)
void add_instance_name(flatbuffers::Offset< flatbuffers::String > instance_name)
bool VerifySizePrefixedBehaviorTreeBuffer(flatbuffers::Verifier &verifier)
const flatbuffers::Vector< const StatusChange * > * state_changes() const
void add_registration_name(flatbuffers::Offset< flatbuffers::String > registration_name)
const Status(& EnumValuesStatus())[4]
const flatbuffers::String * registration_name() const
const flatbuffers::String * instance_name() const
StatusChangeLogBuilder(flatbuffers::FlatBufferBuilder &_fbb)
void add_params(flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< KeyValue >>> params)
flatbuffers::Offset< KeyValue > CreateKeyValue(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< flatbuffers::String > key=0, flatbuffers::Offset< flatbuffers::String > value=0)
void Finish(Offset< T > root, const char *file_identifier=nullptr)
Finish serializing a buffer by writing the root offset.
bool Verify(flatbuffers::Verifier &verifier) const
KeyValueBuilder(flatbuffers::FlatBufferBuilder &_fbb)
void add_key(flatbuffers::Offset< flatbuffers::String > key)
const BT_Serialization::BehaviorTree * GetSizePrefixedBehaviorTree(const void *buf)
flatbuffers::Offset< TreeNode > CreateTreeNode(flatbuffers::FlatBufferBuilder &_fbb, uint16_t uid=0, flatbuffers::Offset< flatbuffers::Vector< uint16_t >> children_uid=0, Type type=Type::UNDEFINED, Status status=Status::IDLE, flatbuffers::Offset< flatbuffers::String > instance_name=0, flatbuffers::Offset< flatbuffers::String > registration_name=0, flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< KeyValue >>> params=0)
flatbuffers::Offset< StatusChangeLog > Finish()
void FinishBehaviorTreeBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset< BT_Serialization::BehaviorTree > root)
Offset< String > CreateString(const char *str, size_t len)
Store a string in the buffer, which can contain any binary data.
flatbuffers::uoffset_t start_
uint16_t root_uid() const
void add_nodes(flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< TreeNode >>> nodes)
flatbuffers::Offset< BehaviorTree > Finish()
const char *const * EnumNamesStatus()
const BehaviorTree * behavior_tree() const
flatbuffers::Offset< StatusChangeLog > CreateStatusChangeLogDirect(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< BehaviorTree > behavior_tree=0, const std::vector< StatusChange > *state_changes=nullptr)
flatbuffers::Offset< TreeNode > Finish()
flatbuffers::uoffset_t start_
Helper class to hold data needed in creation of a FlatBuffer. To serialize data, you typically call o...
flatbuffers::Offset< TreeNode > CreateTreeNodeDirect(flatbuffers::FlatBufferBuilder &_fbb, uint16_t uid=0, const std::vector< uint16_t > *children_uid=nullptr, Type type=Type::UNDEFINED, Status status=Status::IDLE, const char *instance_name=nullptr, const char *registration_name=nullptr, const std::vector< flatbuffers::Offset< KeyValue >> *params=nullptr)
void add_status(Status status)
const flatbuffers::Vector< uint16_t > * children_uid() const
FLATBUFFERS_STRUCT_END(Timestamp, 8)
TreeNodeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
flatbuffers::Offset< BehaviorTree > CreateBehaviorTreeDirect(flatbuffers::FlatBufferBuilder &_fbb, uint16_t root_uid=0, const std::vector< flatbuffers::Offset< TreeNode >> *nodes=nullptr)
flatbuffers::FlatBufferBuilder & fbb_
const flatbuffers::Vector< flatbuffers::Offset< KeyValue > > * params() const
void add_children_uid(flatbuffers::Offset< flatbuffers::Vector< uint16_t >> children_uid)
const BT_Serialization::BehaviorTree * GetBehaviorTree(const void *buf)
flatbuffers::FlatBufferBuilder & fbb_
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Timestamp FLATBUFFERS_FINAL_CLASS
const Type(& EnumValuesType())[6]
Offset< Vector< const T * > > CreateVectorOfStructs(const T *v, size_t len)
Serialize an array of structs into a FlatBuffer vector.
const flatbuffers::Vector< flatbuffers::Offset< TreeNode > > * nodes() const
BehaviorTreeBuilder(flatbuffers::FlatBufferBuilder &_fbb)
void add_root_uid(uint16_t root_uid)
Offset< Vector< T > > CreateVector(const T *v, size_t len)
Serialize an array into a FlatBuffer vector.
const char *const * EnumNamesType()
flatbuffers::Offset< BehaviorTree > CreateBehaviorTree(flatbuffers::FlatBufferBuilder &_fbb, uint16_t root_uid=0, flatbuffers::Offset< flatbuffers::Vector< flatbuffers::Offset< TreeNode >>> nodes=0)
void add_behavior_tree(flatbuffers::Offset< BehaviorTree > behavior_tree)
void FinishSizePrefixed(Offset< T > root, const char *file_identifier=nullptr)
Finish a buffer with a 32 bit size field pre-fixed (size of the buffer following the size field)...
flatbuffers::FlatBufferBuilder & fbb_
const flatbuffers::String * value() const
void add_uid(uint16_t uid)
flatbuffers::Offset< KeyValue > Finish()
const char * EnumNameType(Type e)
flatbuffers::Offset< StatusChangeLog > CreateStatusChangeLog(flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset< BehaviorTree > behavior_tree=0, flatbuffers::Offset< flatbuffers::Vector< const StatusChange * >> state_changes=0)
bool VerifyBehaviorTreeBuffer(flatbuffers::Verifier &verifier)
flatbuffers::FlatBufferBuilder & fbb_
const char * EnumNameStatus(Status e)
flatbuffers::uoffset_t start_
flatbuffers::uoffset_t start_
void FinishSizePrefixedBehaviorTreeBuffer(flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset< BT_Serialization::BehaviorTree > root)
const flatbuffers::String * key() const
void add_state_changes(flatbuffers::Offset< flatbuffers::Vector< const StatusChange * >> state_changes)