bt_zmq_publisher.h
Go to the documentation of this file.
1 #ifndef BT_ZMQ_PUBLISHER_H
2 #define BT_ZMQ_PUBLISHER_H
3 
4 #include <array>
5 #include <future>
6 #include "abstract_logger.h"
7 
8 
9 namespace BT
10 {
12 {
13  static std::atomic<bool> ref_count;
14 
15  public:
16  PublisherZMQ(const BT::Tree& tree, int max_msg_per_second = 25);
17 
18  virtual ~PublisherZMQ();
19 
20  private:
21  virtual void callback(Duration timestamp, const TreeNode& node, NodeStatus prev_status,
22  NodeStatus status) override;
23 
24  virtual void flush() override;
25 
26  const BT::Tree& tree_;
27  std::vector<uint8_t> tree_buffer_;
28  std::vector<uint8_t> status_buffer_;
29  std::vector<SerializedTransition> transition_buffer_;
30  std::chrono::microseconds min_time_between_msgs_;
31 
32  std::atomic_bool active_server_;
33  std::thread thread_;
34 
35  void createStatusBuffer();
36 
39  std::atomic_bool send_pending_;
40 
41  std::future<void> send_future_;
42 
43  struct Pimpl;
44  Pimpl* zmq_;
45 
46 };
47 }
48 
49 #endif // BT_ZMQ_PUBLISHER_H
std::vector< uint8_t > status_buffer_
std::chrono::high_resolution_clock::time_point TimePoint
Definition: basic_types.h:338
std::vector< uint8_t > tree_buffer_
std::atomic_bool active_server_
static pthread_mutex_t mutex
Definition: minitrace.cpp:61
static std::atomic< bool > ref_count
virtual void flush() override
const BT::Tree & tree_
std::future< void > send_future_
virtual void callback(Duration timestamp, const TreeNode &node, NodeStatus prev_status, NodeStatus status) override
PublisherZMQ(const BT::Tree &tree, int max_msg_per_second=25)
Abstract base class for Behavior Tree Nodes.
Definition: tree_node.h:53
std::chrono::microseconds min_time_between_msgs_
std::thread thread_
NodeStatus
Definition: basic_types.h:35
std::vector< SerializedTransition > transition_buffer_
Struct used to store a tree. If this object goes out of scope, the tree is destroyed.
Definition: bt_factory.h:78
std::chrono::high_resolution_clock::duration Duration
Definition: basic_types.h:339
std::atomic_bool send_pending_


behaviortree_cpp
Author(s): Michele Colledanchise, Davide Faconti
autogenerated on Sat Jun 8 2019 18:04:04