From c6aae453642aa9e1493b50d2b6da091f681c38a2 Mon Sep 17 00:00:00 2001 From: Koichi Shiraishi Date: Thu, 16 Mar 2017 06:52:47 +0900 Subject: [PATCH] sample: update auto-generated monster_generated.h (#4219) Signed-off-by: Koichi Shiraishi --- samples/monster_generated.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/samples/monster_generated.h b/samples/monster_generated.h index e835a7da6..48ca9818d 100644 --- a/samples/monster_generated.h +++ b/samples/monster_generated.h @@ -224,6 +224,10 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { const void *equipped() const { return GetPointer(VT_EQUIPPED); } + template const T *equipped_as() const; + const Weapon *equipped_as_Weapon() const { + return (equipped_type() == Equipment_Weapon)? static_cast(equipped()) : nullptr; + } void *mutable_equipped() { return GetPointer(VT_EQUIPPED); } @@ -250,6 +254,10 @@ struct Monster FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MonsterT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); }; +template<> inline const Weapon *Monster::equipped_as() const { + return equipped_as_Weapon(); +} + struct MonsterBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_;