Robot Raconteur Core C++ Library
Tap.h
Go to the documentation of this file.
1 
24 #pragma once
25 
26 #include "RobotRaconteur/Logging.h"
27 #include "RobotRaconteur/Message.h"
28 #include <boost/bind/placeholders.hpp>
29 
30 namespace RobotRaconteur
31 {
46 class ROBOTRACONTEUR_CORE_API MessageTap
47 {
48  public:
53  virtual void Open() = 0;
58  virtual void Close() = 0;
59 
65  virtual void RecordLogRecord(const RRLogRecord& log_record) = 0;
66 
72  virtual void RecordMessage(const RR_INTRUSIVE_PTR<Message>& message) = 0;
73 
74  virtual ~MessageTap() {}
75 };
76 
77 #ifndef ROBOTRACONTEUR_EMSCRIPTEN
78 
79 namespace detail
80 {
81 class LocalMessageTapImpl;
82 }
83 
98 class ROBOTRACONTEUR_CORE_API LocalMessageTap : public MessageTap
99 {
100  RR_WEAK_PTR<detail::LocalMessageTapImpl> tap_impl;
101  std::string tap_name;
102 
103  public:
111  LocalMessageTap(const std::string& tap_name);
112  RR_OVIRTUAL ~LocalMessageTap() RR_OVERRIDE;
113 
114  RR_OVIRTUAL void Open() RR_OVERRIDE;
115  RR_OVIRTUAL void Close() RR_OVERRIDE;
116 
117  RR_OVIRTUAL void RecordLogRecord(const RRLogRecord& log_record) RR_OVERRIDE;
118  RR_OVIRTUAL void RecordMessage(const RR_INTRUSIVE_PTR<Message>& message) RR_OVERRIDE;
119 };
120 
121 #endif
122 
123 }; // namespace RobotRaconteur
Local message tap.
Definition: Tap.h:99
LocalMessageTap(const std::string &tap_name)
Construct a new local tap.
Base class for message taps.
Definition: Tap.h:47
virtual void RecordMessage(const boost::intrusive_ptr< Message > &message)=0
Record a message.
virtual void Open()=0
Open the tap for writing.
virtual void RecordLogRecord(const RRLogRecord &log_record)=0
Record a log record.
virtual void Close()=0
Close the tap.
Robot Raconteur log record.
Definition: Logging.h:49