00001
00002
00003 #ifndef FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_
00004 #define FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_
00005
00006 #include "flatbuffers/flatbuffers.h"
00007
00008 namespace BT_Serialization
00009 {
00010 struct Timestamp;
00011
00012 struct KeyValue;
00013
00014 struct TreeNode;
00015
00016 struct BehaviorTree;
00017
00018 struct StatusChange;
00019
00020 struct StatusChangeLog;
00021
00022 enum class Status : int8_t
00023 {
00024 IDLE = 0,
00025 RUNNING = 1,
00026 SUCCESS = 2,
00027 FAILURE = 3,
00028 MIN = IDLE,
00029 MAX = FAILURE
00030 };
00031
00032 inline const Status (&EnumValuesStatus())[4]
00033 {
00034 static const Status values[] = {Status::IDLE, Status::RUNNING, Status::SUCCESS,
00035 Status::FAILURE};
00036 return values;
00037 }
00038
00039 inline const char* const* EnumNamesStatus()
00040 {
00041 static const char* const names[] = {"IDLE", "RUNNING", "SUCCESS", "FAILURE", nullptr};
00042 return names;
00043 }
00044
00045 inline const char* EnumNameStatus(Status e)
00046 {
00047 const size_t index = static_cast<int>(e);
00048 return EnumNamesStatus()[index];
00049 }
00050
00051 enum class Type : int8_t
00052 {
00053 UNDEFINED = 0,
00054 ACTION = 1,
00055 CONDITION = 2,
00056 CONTROL = 3,
00057 DECORATOR = 4,
00058 SUBTREE = 5,
00059 MIN = UNDEFINED,
00060 MAX = SUBTREE
00061 };
00062
00063 inline const Type (&EnumValuesType())[6]
00064 {
00065 static const Type values[] = {Type::UNDEFINED, Type::ACTION, Type::CONDITION,
00066 Type::CONTROL, Type::DECORATOR, Type::SUBTREE};
00067 return values;
00068 }
00069
00070 inline const char* const* EnumNamesType()
00071 {
00072 static const char* const names[] = {"UNDEFINED", "ACTION", "CONDITION", "CONTROL",
00073 "DECORATOR", "SUBTREE", nullptr};
00074 return names;
00075 }
00076
00077 inline const char* EnumNameType(Type e)
00078 {
00079 const size_t index = static_cast<int>(e);
00080 return EnumNamesType()[index];
00081 }
00082
00083 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) Timestamp FLATBUFFERS_FINAL_CLASS
00084 {
00085 private:
00086 uint64_t usec_since_epoch_;
00087
00088 public:
00089 Timestamp()
00090 {
00091 memset(this, 0, sizeof(Timestamp));
00092 }
00093 Timestamp(uint64_t _usec_since_epoch)
00094 : usec_since_epoch_(flatbuffers::EndianScalar(_usec_since_epoch))
00095 {
00096 }
00097 uint64_t usec_since_epoch() const
00098 {
00099 return flatbuffers::EndianScalar(usec_since_epoch_);
00100 }
00101 };
00102 FLATBUFFERS_STRUCT_END(Timestamp, 8);
00103
00104 FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) StatusChange FLATBUFFERS_FINAL_CLASS
00105 {
00106 private:
00107 uint16_t uid_;
00108 int8_t prev_status_;
00109 int8_t status_;
00110 int32_t padding0__;
00111 Timestamp timestamp_;
00112
00113 public:
00114 StatusChange()
00115 {
00116 memset(this, 0, sizeof(StatusChange));
00117 }
00118 StatusChange(uint16_t _uid, Status _prev_status, Status _status, const Timestamp& _timestamp)
00119 : uid_(flatbuffers::EndianScalar(_uid))
00120 , prev_status_(flatbuffers::EndianScalar(static_cast<int8_t>(_prev_status)))
00121 , status_(flatbuffers::EndianScalar(static_cast<int8_t>(_status)))
00122 , padding0__(0)
00123 , timestamp_(_timestamp)
00124 {
00125 (void)padding0__;
00126 }
00127 uint16_t uid() const
00128 {
00129 return flatbuffers::EndianScalar(uid_);
00130 }
00131 Status prev_status() const
00132 {
00133 return static_cast<Status>(flatbuffers::EndianScalar(prev_status_));
00134 }
00135 Status status() const
00136 {
00137 return static_cast<Status>(flatbuffers::EndianScalar(status_));
00138 }
00139 const Timestamp& timestamp() const
00140 {
00141 return timestamp_;
00142 }
00143 };
00144 FLATBUFFERS_STRUCT_END(StatusChange, 16);
00145
00146 struct KeyValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
00147 {
00148 enum
00149 {
00150 VT_KEY = 4,
00151 VT_VALUE = 6
00152 };
00153 const flatbuffers::String* key() const
00154 {
00155 return GetPointer<const flatbuffers::String*>(VT_KEY);
00156 }
00157 const flatbuffers::String* value() const
00158 {
00159 return GetPointer<const flatbuffers::String*>(VT_VALUE);
00160 }
00161 bool Verify(flatbuffers::Verifier& verifier) const
00162 {
00163 return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_KEY) &&
00164 verifier.Verify(key()) && VerifyOffset(verifier, VT_VALUE) &&
00165 verifier.Verify(value()) && verifier.EndTable();
00166 }
00167 };
00168
00169 struct KeyValueBuilder
00170 {
00171 flatbuffers::FlatBufferBuilder& fbb_;
00172 flatbuffers::uoffset_t start_;
00173 void add_key(flatbuffers::Offset<flatbuffers::String> key)
00174 {
00175 fbb_.AddOffset(KeyValue::VT_KEY, key);
00176 }
00177 void add_value(flatbuffers::Offset<flatbuffers::String> value)
00178 {
00179 fbb_.AddOffset(KeyValue::VT_VALUE, value);
00180 }
00181 explicit KeyValueBuilder(flatbuffers::FlatBufferBuilder& _fbb) : fbb_(_fbb)
00182 {
00183 start_ = fbb_.StartTable();
00184 }
00185 KeyValueBuilder& operator=(const KeyValueBuilder&);
00186 flatbuffers::Offset<KeyValue> Finish()
00187 {
00188 const auto end = fbb_.EndTable(start_);
00189 auto o = flatbuffers::Offset<KeyValue>(end);
00190 return o;
00191 }
00192 };
00193
00194 inline flatbuffers::Offset<KeyValue> CreateKeyValue(
00195 flatbuffers::FlatBufferBuilder& _fbb, flatbuffers::Offset<flatbuffers::String> key = 0,
00196 flatbuffers::Offset<flatbuffers::String> value = 0)
00197 {
00198 KeyValueBuilder builder_(_fbb);
00199 builder_.add_value(value);
00200 builder_.add_key(key);
00201 return builder_.Finish();
00202 }
00203
00204 inline flatbuffers::Offset<KeyValue> CreateKeyValueDirect(flatbuffers::FlatBufferBuilder& _fbb,
00205 const char* key = nullptr,
00206 const char* value = nullptr)
00207 {
00208 return BT_Serialization::CreateKeyValue(_fbb, key ? _fbb.CreateString(key) : 0,
00209 value ? _fbb.CreateString(value) : 0);
00210 }
00211
00212 struct TreeNode FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
00213 {
00214 enum
00215 {
00216 VT_UID = 4,
00217 VT_CHILDREN_UID = 6,
00218 VT_TYPE = 8,
00219 VT_STATUS = 10,
00220 VT_INSTANCE_NAME = 12,
00221 VT_REGISTRATION_NAME = 14,
00222 VT_PARAMS = 16
00223 };
00224 uint16_t uid() const
00225 {
00226 return GetField<uint16_t>(VT_UID, 0);
00227 }
00228 const flatbuffers::Vector<uint16_t>* children_uid() const
00229 {
00230 return GetPointer<const flatbuffers::Vector<uint16_t>*>(VT_CHILDREN_UID);
00231 }
00232 Type type() const
00233 {
00234 return static_cast<Type>(GetField<int8_t>(VT_TYPE, 0));
00235 }
00236 Status status() const
00237 {
00238 return static_cast<Status>(GetField<int8_t>(VT_STATUS, 0));
00239 }
00240 const flatbuffers::String* instance_name() const
00241 {
00242 return GetPointer<const flatbuffers::String*>(VT_INSTANCE_NAME);
00243 }
00244 const flatbuffers::String* registration_name() const
00245 {
00246 return GetPointer<const flatbuffers::String*>(VT_REGISTRATION_NAME);
00247 }
00248 const flatbuffers::Vector<flatbuffers::Offset<KeyValue>>* params() const
00249 {
00250 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<KeyValue>>*>(VT_PARAMS);
00251 }
00252 bool Verify(flatbuffers::Verifier& verifier) const
00253 {
00254 return VerifyTableStart(verifier) && VerifyField<uint16_t>(verifier, VT_UID) &&
00255 VerifyOffset(verifier, VT_CHILDREN_UID) && verifier.Verify(children_uid()) &&
00256 VerifyField<int8_t>(verifier, VT_TYPE) && VerifyField<int8_t>(verifier, VT_STATUS) &&
00257 VerifyOffsetRequired(verifier, VT_INSTANCE_NAME) &&
00258 verifier.Verify(instance_name()) &&
00259 VerifyOffsetRequired(verifier, VT_REGISTRATION_NAME) &&
00260 verifier.Verify(registration_name()) && VerifyOffset(verifier, VT_PARAMS) &&
00261 verifier.Verify(params()) && verifier.VerifyVectorOfTables(params()) &&
00262 verifier.EndTable();
00263 }
00264 };
00265
00266 struct TreeNodeBuilder
00267 {
00268 flatbuffers::FlatBufferBuilder& fbb_;
00269 flatbuffers::uoffset_t start_;
00270 void add_uid(uint16_t uid)
00271 {
00272 fbb_.AddElement<uint16_t>(TreeNode::VT_UID, uid, 0);
00273 }
00274 void add_children_uid(flatbuffers::Offset<flatbuffers::Vector<uint16_t>> children_uid)
00275 {
00276 fbb_.AddOffset(TreeNode::VT_CHILDREN_UID, children_uid);
00277 }
00278 void add_type(Type type)
00279 {
00280 fbb_.AddElement<int8_t>(TreeNode::VT_TYPE, static_cast<int8_t>(type), 0);
00281 }
00282 void add_status(Status status)
00283 {
00284 fbb_.AddElement<int8_t>(TreeNode::VT_STATUS, static_cast<int8_t>(status), 0);
00285 }
00286 void add_instance_name(flatbuffers::Offset<flatbuffers::String> instance_name)
00287 {
00288 fbb_.AddOffset(TreeNode::VT_INSTANCE_NAME, instance_name);
00289 }
00290 void add_registration_name(flatbuffers::Offset<flatbuffers::String> registration_name)
00291 {
00292 fbb_.AddOffset(TreeNode::VT_REGISTRATION_NAME, registration_name);
00293 }
00294 void add_params(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> params)
00295 {
00296 fbb_.AddOffset(TreeNode::VT_PARAMS, params);
00297 }
00298 explicit TreeNodeBuilder(flatbuffers::FlatBufferBuilder& _fbb) : fbb_(_fbb)
00299 {
00300 start_ = fbb_.StartTable();
00301 }
00302 TreeNodeBuilder& operator=(const TreeNodeBuilder&);
00303 flatbuffers::Offset<TreeNode> Finish()
00304 {
00305 const auto end = fbb_.EndTable(start_);
00306 auto o = flatbuffers::Offset<TreeNode>(end);
00307 fbb_.Required(o, TreeNode::VT_INSTANCE_NAME);
00308 fbb_.Required(o, TreeNode::VT_REGISTRATION_NAME);
00309 return o;
00310 }
00311 };
00312
00313 inline flatbuffers::Offset<TreeNode>
00314 CreateTreeNode(flatbuffers::FlatBufferBuilder& _fbb, uint16_t uid = 0,
00315 flatbuffers::Offset<flatbuffers::Vector<uint16_t>> children_uid = 0,
00316 Type type = Type::UNDEFINED, Status status = Status::IDLE,
00317 flatbuffers::Offset<flatbuffers::String> instance_name = 0,
00318 flatbuffers::Offset<flatbuffers::String> registration_name = 0,
00319 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<KeyValue>>> params = 0)
00320 {
00321 TreeNodeBuilder builder_(_fbb);
00322 builder_.add_params(params);
00323 builder_.add_registration_name(registration_name);
00324 builder_.add_instance_name(instance_name);
00325 builder_.add_children_uid(children_uid);
00326 builder_.add_uid(uid);
00327 builder_.add_status(status);
00328 builder_.add_type(type);
00329 return builder_.Finish();
00330 }
00331
00332 inline flatbuffers::Offset<TreeNode>
00333 CreateTreeNodeDirect(flatbuffers::FlatBufferBuilder& _fbb, uint16_t uid = 0,
00334 const std::vector<uint16_t>* children_uid = nullptr,
00335 Type type = Type::UNDEFINED, Status status = Status::IDLE,
00336 const char* instance_name = nullptr, const char* registration_name = nullptr,
00337 const std::vector<flatbuffers::Offset<KeyValue>>* params = nullptr)
00338 {
00339 return BT_Serialization::CreateTreeNode(
00340 _fbb, uid, children_uid ? _fbb.CreateVector<uint16_t>(*children_uid) : 0, type, status,
00341 instance_name ? _fbb.CreateString(instance_name) : 0,
00342 registration_name ? _fbb.CreateString(registration_name) : 0,
00343 params ? _fbb.CreateVector<flatbuffers::Offset<KeyValue>>(*params) : 0);
00344 }
00345
00346 struct BehaviorTree FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
00347 {
00348 enum
00349 {
00350 VT_ROOT_UID = 4,
00351 VT_NODES = 6
00352 };
00353 uint16_t root_uid() const
00354 {
00355 return GetField<uint16_t>(VT_ROOT_UID, 0);
00356 }
00357 const flatbuffers::Vector<flatbuffers::Offset<TreeNode>>* nodes() const
00358 {
00359 return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<TreeNode>>*>(VT_NODES);
00360 }
00361 bool Verify(flatbuffers::Verifier& verifier) const
00362 {
00363 return VerifyTableStart(verifier) && VerifyField<uint16_t>(verifier, VT_ROOT_UID) &&
00364 VerifyOffset(verifier, VT_NODES) && verifier.Verify(nodes()) &&
00365 verifier.VerifyVectorOfTables(nodes()) && verifier.EndTable();
00366 }
00367 };
00368
00369 struct BehaviorTreeBuilder
00370 {
00371 flatbuffers::FlatBufferBuilder& fbb_;
00372 flatbuffers::uoffset_t start_;
00373 void add_root_uid(uint16_t root_uid)
00374 {
00375 fbb_.AddElement<uint16_t>(BehaviorTree::VT_ROOT_UID, root_uid, 0);
00376 }
00377 void add_nodes(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TreeNode>>> nodes)
00378 {
00379 fbb_.AddOffset(BehaviorTree::VT_NODES, nodes);
00380 }
00381 explicit BehaviorTreeBuilder(flatbuffers::FlatBufferBuilder& _fbb) : fbb_(_fbb)
00382 {
00383 start_ = fbb_.StartTable();
00384 }
00385 BehaviorTreeBuilder& operator=(const BehaviorTreeBuilder&);
00386 flatbuffers::Offset<BehaviorTree> Finish()
00387 {
00388 const auto end = fbb_.EndTable(start_);
00389 auto o = flatbuffers::Offset<BehaviorTree>(end);
00390 return o;
00391 }
00392 };
00393
00394 inline flatbuffers::Offset<BehaviorTree> CreateBehaviorTree(
00395 flatbuffers::FlatBufferBuilder& _fbb, uint16_t root_uid = 0,
00396 flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<TreeNode>>> nodes = 0)
00397 {
00398 BehaviorTreeBuilder builder_(_fbb);
00399 builder_.add_nodes(nodes);
00400 builder_.add_root_uid(root_uid);
00401 return builder_.Finish();
00402 }
00403
00404 inline flatbuffers::Offset<BehaviorTree>
00405 CreateBehaviorTreeDirect(flatbuffers::FlatBufferBuilder& _fbb, uint16_t root_uid = 0,
00406 const std::vector<flatbuffers::Offset<TreeNode>>* nodes = nullptr)
00407 {
00408 return BT_Serialization::CreateBehaviorTree(
00409 _fbb, root_uid, nodes ? _fbb.CreateVector<flatbuffers::Offset<TreeNode>>(*nodes) : 0);
00410 }
00411
00412 struct StatusChangeLog FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table
00413 {
00414 enum
00415 {
00416 VT_BEHAVIOR_TREE = 4,
00417 VT_STATE_CHANGES = 6
00418 };
00419 const BehaviorTree* behavior_tree() const
00420 {
00421 return GetPointer<const BehaviorTree*>(VT_BEHAVIOR_TREE);
00422 }
00423 const flatbuffers::Vector<const StatusChange*>* state_changes() const
00424 {
00425 return GetPointer<const flatbuffers::Vector<const StatusChange*>*>(VT_STATE_CHANGES);
00426 }
00427 bool Verify(flatbuffers::Verifier& verifier) const
00428 {
00429 return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_BEHAVIOR_TREE) &&
00430 verifier.VerifyTable(behavior_tree()) && VerifyOffset(verifier, VT_STATE_CHANGES) &&
00431 verifier.Verify(state_changes()) && verifier.EndTable();
00432 }
00433 };
00434
00435 struct StatusChangeLogBuilder
00436 {
00437 flatbuffers::FlatBufferBuilder& fbb_;
00438 flatbuffers::uoffset_t start_;
00439 void add_behavior_tree(flatbuffers::Offset<BehaviorTree> behavior_tree)
00440 {
00441 fbb_.AddOffset(StatusChangeLog::VT_BEHAVIOR_TREE, behavior_tree);
00442 }
00443 void
00444 add_state_changes(flatbuffers::Offset<flatbuffers::Vector<const StatusChange*>> state_changes)
00445 {
00446 fbb_.AddOffset(StatusChangeLog::VT_STATE_CHANGES, state_changes);
00447 }
00448 explicit StatusChangeLogBuilder(flatbuffers::FlatBufferBuilder& _fbb) : fbb_(_fbb)
00449 {
00450 start_ = fbb_.StartTable();
00451 }
00452 StatusChangeLogBuilder& operator=(const StatusChangeLogBuilder&);
00453 flatbuffers::Offset<StatusChangeLog> Finish()
00454 {
00455 const auto end = fbb_.EndTable(start_);
00456 auto o = flatbuffers::Offset<StatusChangeLog>(end);
00457 return o;
00458 }
00459 };
00460
00461 inline flatbuffers::Offset<StatusChangeLog> CreateStatusChangeLog(
00462 flatbuffers::FlatBufferBuilder& _fbb, flatbuffers::Offset<BehaviorTree> behavior_tree = 0,
00463 flatbuffers::Offset<flatbuffers::Vector<const StatusChange*>> state_changes = 0)
00464 {
00465 StatusChangeLogBuilder builder_(_fbb);
00466 builder_.add_state_changes(state_changes);
00467 builder_.add_behavior_tree(behavior_tree);
00468 return builder_.Finish();
00469 }
00470
00471 inline flatbuffers::Offset<StatusChangeLog> CreateStatusChangeLogDirect(
00472 flatbuffers::FlatBufferBuilder& _fbb, flatbuffers::Offset<BehaviorTree> behavior_tree = 0,
00473 const std::vector<StatusChange>* state_changes = nullptr)
00474 {
00475 return BT_Serialization::CreateStatusChangeLog(
00476 _fbb, behavior_tree,
00477 state_changes ? _fbb.CreateVectorOfStructs<StatusChange>(*state_changes) : 0);
00478 }
00479
00480 inline const BT_Serialization::BehaviorTree* GetBehaviorTree(const void* buf)
00481 {
00482 return flatbuffers::GetRoot<BT_Serialization::BehaviorTree>(buf);
00483 }
00484
00485 inline const BT_Serialization::BehaviorTree* GetSizePrefixedBehaviorTree(const void* buf)
00486 {
00487 return flatbuffers::GetSizePrefixedRoot<BT_Serialization::BehaviorTree>(buf);
00488 }
00489
00490 inline bool VerifyBehaviorTreeBuffer(flatbuffers::Verifier& verifier)
00491 {
00492 return verifier.VerifyBuffer<BT_Serialization::BehaviorTree>(nullptr);
00493 }
00494
00495 inline bool VerifySizePrefixedBehaviorTreeBuffer(flatbuffers::Verifier& verifier)
00496 {
00497 return verifier.VerifySizePrefixedBuffer<BT_Serialization::BehaviorTree>(nullptr);
00498 }
00499
00500 inline void FinishBehaviorTreeBuffer(flatbuffers::FlatBufferBuilder& fbb,
00501 flatbuffers::Offset<BT_Serialization::BehaviorTree> root)
00502 {
00503 fbb.Finish(root);
00504 }
00505
00506 inline void FinishSizePrefixedBehaviorTreeBuffer(
00507 flatbuffers::FlatBufferBuilder& fbb, flatbuffers::Offset<BT_Serialization::BehaviorTree> root)
00508 {
00509 fbb.FinishSizePrefixed(root);
00510 }
00511
00512 }
00513
00514 #endif // FLATBUFFERS_GENERATED_BTLOGGER_BT_SERIALIZATION_H_