25 #include <boost/shared_array.hpp>
29 namespace RobotRaconteur
31 class ROBOTRACONTEUR_CORE_API IntraTransportConnection;
57 friend class IntraTransportConnection;
60 static std::list<RR_WEAK_PTR<IntraTransport> > peer_transports;
61 static boost::mutex peer_transports_lock;
67 RR_UNORDERED_MAP<uint32_t, RR_SHARED_PTR<ITransportConnection> > TransportConnections;
68 boost::mutex TransportConnections_lock;
87 RR_OVIRTUAL
bool IsServer() const RR_OVERRIDE;
89 RR_OVIRTUAL
bool IsClient() const RR_OVERRIDE;
91 RR_OVIRTUAL std::
string GetUrlSchemeString() const RR_OVERRIDE;
93 RR_OVIRTUAL std::vector<std::
string> GetServerListenUrls() RR_OVERRIDE;
95 RR_OVIRTUAL
void SendMessage(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
97 RR_OVIRTUAL
void AsyncSendMessage(
98 const RR_INTRUSIVE_PTR<Message>& m,
101 RR_OVIRTUAL
void AsyncCreateTransportConnection(
102 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e,
103 boost::function<
void(const RR_SHARED_PTR<ITransportConnection>&,
106 RR_OVIRTUAL RR_SHARED_PTR<ITransportConnection> CreateTransportConnection(
107 boost::string_ref url, const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
109 RR_OVIRTUAL
void CloseTransportConnection(const RR_SHARED_PTR<Endpoint>& e) RR_OVERRIDE;
115 virtual
void StartServer();
121 virtual
void StartClient();
124 virtual
void CloseTransportConnection_timed(const boost::system::error_code& err, const RR_SHARED_PTR<Endpoint>& e,
125 const RR_SHARED_PTR<
void>& timer);
128 RR_OVIRTUAL
bool CanConnectService(boost::string_ref url) RR_OVERRIDE;
130 RR_OVIRTUAL
void Close() RR_OVERRIDE;
132 RR_OVIRTUAL
void CheckConnection(uint32_t endpoint) RR_OVERRIDE;
134 RR_OVIRTUAL
void PeriodicCleanupTask() RR_OVERRIDE;
136 RR_OVIRTUAL uint32_t TransportCapability(boost::string_ref name) RR_OVERRIDE;
138 RR_OVIRTUAL
void MessageReceived(const RR_INTRUSIVE_PTR<Message>& m) RR_OVERRIDE;
140 RR_OVIRTUAL
void AsyncGetDetectedNodes(
141 const std::vector<std::
string>& schemes,
142 const boost::function<
void(const RR_SHARED_PTR<std::vector<
NodeDiscoveryInfo> >&)>& handler,
145 template <typename T, typename F>
146 boost::signals2::connection AddCloseListener(const RR_SHARED_PTR<T>& t, const F& f)
148 boost::mutex::scoped_lock lock(closed_lock);
153 return boost::signals2::connection();
156 return close_signal.connect(boost::signals2::signal<
void()>::slot_type(boost::bind(f, t.get())).track(t));
159 bool TryGetNodeInfo(
NodeID& node_id, std::string& node_name, std::string& service_nonce);
161 RR_OVIRTUAL
void LocalNodeServicesChanged() RR_OVERRIDE;
163 void SendNodeDiscovery();
165 void DiscoverAllNodes();
168 virtual
void register_transport(const RR_SHARED_PTR<ITransportConnection>& connection);
169 virtual
void erase_transport(const RR_SHARED_PTR<ITransportConnection>& connection);
173 boost::mutex init_lock;
179 boost::mutex closed_lock;
180 boost::signals2::signal<
void()> close_signal;
183 #ifndef ROBOTRACONTEUR_NO_CXX11_TEMPLATE_ALIASES
boost::shared_ptr< IntraTransport > IntraTransportPtr
Convenience alias for IntraTransport shared_ptr.
Definition: IntraTransport.h:185
#define RR_TIMEOUT_INFINITE
Disable timeout for asynchronous operations.
Definition: RobotRaconteurConstants.h:566
Transport for intra-process communication.
Definition: IntraTransport.h:56
IntraTransport(const boost::shared_ptr< RobotRaconteurNode > &node=RobotRaconteurNode::sp())
Construct a new IntraTransport.
Raw information used to announce and detect nodes.
Definition: Discovery.h:137
NodeID UUID storage and generation.
Definition: NodeID.h:58
Base class for Robot Raconteur exceptions.
Definition: Error.h:50
static boost::shared_ptr< RobotRaconteurNode > sp()
Singleton shared_ptr accessor.
Base class for transports.
Definition: Transport.h:120