21 file_os_.open(filename, std::ofstream::binary | std::ofstream::out);
25 flatbuffers::WriteScalar(size_buff, static_cast<int32_t>(builder.
GetSize()));
45 file_os_.write(reinterpret_cast<const char*>(buffer.data()), buffer.size());
59 for (
const auto& array :
buffer_)
61 file_os_.write(reinterpret_cast<const char*>(array.data()), array.size());
FileLogger(const Tree &tree, const char *filename, uint16_t buffer_size=10)
static raw_event_t * buffer
virtual void flush() override
void CreateFlatbuffersBehaviorTree(flatbuffers::FlatBufferBuilder &builder, const BT::Tree &tree)
std::array< uint8_t, 12 > SerializedTransition
Helper class to hold data needed in creation of a FlatBuffer. To serialize data, you typically call o...
virtual void callback(Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status) override
uoffset_t GetSize() const
The current size of the serialized buffer, counting from the end.
Abstract base class for Behavior Tree Nodes.
std::vector< SerializedTransition > buffer_
Struct used to store a tree. If this object goes out of scope, the tree is destroyed.
virtual ~FileLogger() override
void enableTransitionToIdle(bool enable)
std::chrono::high_resolution_clock::duration Duration
uint8_t * GetBufferPointer() const
Get the serialized buffer (after you call Finish()).
SerializedTransition SerializeTransition(uint16_t UID, Duration timestamp, NodeStatus prev_status, NodeStatus status)