rogue
Loading...
Searching...
No Matches
CombinerV1.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_PROTOCOLS_BATCHER_COMBINER_V1_H__
18#define __ROGUE_PROTOCOLS_BATCHER_COMBINER_V1_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <memory>
24#include <mutex>
25#include <vector>
26
27#include "rogue/Logging.h"
31
32namespace rogue {
33namespace protocols {
34namespace batcher {
35
59 std::shared_ptr<rogue::Logging> log_;
60
61 // Queued frames waiting to be batched.
62 std::vector<std::shared_ptr<rogue::interfaces::stream::Frame> > queue_;
63
64 // Width encoding (0-5).
65 uint8_t width_;
66
67 // Header size in bytes.
68 uint32_t headerSize_;
69
70 // Tail size in bytes.
71 uint32_t tailSize_;
72
73 // Sequence counter.
74 uint8_t seq_;
75
76 // Mutex for queue access.
77 std::mutex mtx_;
78
79 public:
81 static void setup_python();
82
88 static std::shared_ptr<rogue::protocols::batcher::CombinerV1> create(uint8_t width);
89
94 explicit CombinerV1(uint8_t width);
95
98
103 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
104
112 void sendBatch();
113
118 uint32_t getCount();
119};
120
121// Convenience
122typedef std::shared_ptr<rogue::protocols::batcher::CombinerV1> CombinerV1Ptr;
123} // namespace batcher
124} // namespace protocols
125} // namespace rogue
126#endif
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
Combines individual frames into a batcher v1 super-frame.
Definition CombinerV1.h:58
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts a frame and immediately queues it for batching.
static void setup_python()
Registers Python bindings for this class.
uint32_t getCount()
Returns the number of frames currently queued.
void sendBatch()
Builds and sends a batcher v1 super-frame from all queued frames.
~CombinerV1()
Destroys the combiner.
std::shared_ptr< rogue::protocols::batcher::CombinerV1 > CombinerV1Ptr
Definition CombinerV1.h:122