rogue
Loading...
Searching...
No Matches
Application.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_PROTOCOLS_PACKETIZER_APPLICATION_H__
18#define __ROGUE_PROTOCOLS_PACKETIZER_APPLICATION_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <atomic>
24#include <memory>
25
26#include "rogue/Queue.h"
29
30namespace rogue {
31namespace protocols {
32namespace packetizer {
33
34class Controller;
35
43 // Core module
44 std::shared_ptr<rogue::protocols::packetizer::Controller> cntl_;
45
46 // ID
47 uint8_t id_;
48
50 protected:
51 std::thread* thread_ = nullptr;
52 std::atomic<bool> threadEn_{false};
54
55 private:
56 // Thread background
57 void runThread();
58
59 // Application queue
61
62 public:
76 static std::shared_ptr<rogue::protocols::packetizer::Application> create(uint8_t id);
77
79 static void setup_python();
80
90 explicit Application(uint8_t id);
91
94
99 void setController(std::shared_ptr<rogue::protocols::packetizer::Controller> cntl);
100
105 void pushFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
106
117 std::shared_ptr<rogue::interfaces::stream::Frame> acceptReq(uint32_t size, bool zeroCopyEn);
118
123 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
124};
125
126// Convenience
127typedef std::shared_ptr<rogue::protocols::packetizer::Application> ApplicationPtr;
128
129} // namespace packetizer
130} // namespace protocols
131}; // namespace rogue
132
133#endif
Thread-safe bounded queue with optional busy threshold.
Definition Queue.h:39
Stream master endpoint.
Definition Master.h:65
static std::shared_ptr< rogue::interfaces::stream::Master > create()
Creates a stream master.
Definition Master.cpp:40
Stream slave endpoint and default frame pool.
Definition Slave.h:72
Packetizer application endpoint.
Definition Application.h:42
void pushFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Queues a frame for packetized transmission.
static void setup_python()
Registers Python bindings for this class.
std::shared_ptr< rogue::interfaces::stream::Frame > acceptReq(uint32_t size, bool zeroCopyEn)
Allocates a frame for upstream writers.
~Application()
Destroys the application endpoint.
void setController(std::shared_ptr< rogue::protocols::packetizer::Controller > cntl)
Attaches the packetizer controller.
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts a frame from upstream application logic.
Packetizer base controller.
Definition Controller.h:46
std::shared_ptr< rogue::protocols::packetizer::Application > ApplicationPtr