rogue
Loading...
Searching...
No Matches
Transport.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_PROTOCOLS_PACKETIZER_TRANSPORT_H__
18#define __ROGUE_PROTOCOLS_PACKETIZER_TRANSPORT_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <atomic>
24#include <memory>
25
28
29namespace rogue {
30namespace protocols {
31namespace packetizer {
32
33class Controller;
34
54 // Packetizer controller endpoint. Weak: the Controller owns this Transport.
55 std::weak_ptr<rogue::protocols::packetizer::Controller> cntl_;
56
58 protected:
59 std::unique_ptr<std::thread> thread_;
60 std::atomic<bool> threadEn_{false};
62
63 private:
64 // Worker thread entry point.
65 void runThread();
66
67 public:
78 static std::shared_ptr<rogue::protocols::packetizer::Transport> create();
79
81 static void setup_python();
82
90 Transport();
91
93 ~Transport();
94
104 void setController(std::shared_ptr<rogue::protocols::packetizer::Controller> cntl);
105
110 void stop();
111
116 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
117};
118
119// Convenience
120typedef std::shared_ptr<rogue::protocols::packetizer::Transport> TransportPtr;
121
122} // namespace packetizer
123} // namespace protocols
124}; // namespace rogue
125
126#endif
Stream master endpoint.
Definition Master.h:65
Stream slave endpoint and default frame pool.
Definition Slave.h:72
Packetizer transport endpoint.
Definition Transport.h:53
~Transport()
Destroys the packetizer transport endpoint.
Definition Transport.cpp:59
void stop()
Stops and joins the outbound worker thread.
Definition Transport.cpp:64
static std::shared_ptr< rogue::protocols::packetizer::Transport > create()
Creates a packetizer transport endpoint.
Definition Transport.cpp:39
void setController(std::shared_ptr< rogue::protocols::packetizer::Controller > cntl)
Attaches the packetizer controller.
Definition Transport.cpp:77
static void setup_python()
Registers Python bindings for this class.
Definition Transport.cpp:44
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts a frame from the upstream stream interface.
Transport()
Constructs a packetizer transport endpoint.
Definition Transport.cpp:56
std::shared_ptr< rogue::protocols::packetizer::Transport > TransportPtr
Definition Transport.h:120