rogue
Loading...
Searching...
No Matches
StreamWriterChannel.h
Go to the documentation of this file.
1
19#ifndef __ROGUE_UTILITIES_FILEIO_STREAM_WRITER_CHANNEL_H__
20#define __ROGUE_UTILITIES_FILEIO_STREAM_WRITER_CHANNEL_H__
21#include "rogue/Directives.h"
22
23#include <stdint.h>
24
25#include <memory>
26#include <thread>
27
29
30namespace rogue {
31namespace utilities {
32namespace fileio {
33
34class StreamWriter;
35
50 // Associated stream writer instance.
51 std::shared_ptr<rogue::utilities::fileio::StreamWriter> writer_;
52
53 // Fixed output channel, or 0 to use incoming frame channel.
54 uint8_t channel_;
55
56 // Number of frames accepted by this channel.
57 uint32_t frameCount_;
58
59 // Lock protecting frame counter and wait condition.
60 std::mutex mtx_;
61
62 // Condition signaled when frameCount_ changes.
63 std::condition_variable cond_;
64
65 public:
80 static std::shared_ptr<rogue::utilities::fileio::StreamWriterChannel> create(
81 std::shared_ptr<rogue::utilities::fileio::StreamWriter> writer,
82 uint8_t channel);
83
85 static void setup_python();
86
97 StreamWriterChannel(std::shared_ptr<rogue::utilities::fileio::StreamWriter> writer, uint8_t channel);
98
101
111 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
112
117 uint32_t getFrameCount();
118
123 void setFrameCount(uint32_t count);
124
132 bool waitFrameCount(uint32_t count, uint64_t timeout);
133};
134
135// Convenience
136typedef std::shared_ptr<rogue::utilities::fileio::StreamWriterChannel> StreamWriterChannelPtr;
137} // namespace fileio
138} // namespace utilities
139} // namespace rogue
140
141#endif
Stream slave endpoint and default frame pool.
Definition Slave.h:72
static std::shared_ptr< rogue::interfaces::stream::Slave > create()
Creates a new stream slave.
Definition Slave.cpp:49
Stream sink that writes incoming frames into a tagged writer channel.
~StreamWriterChannel()
Destroys stream writer channel.
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Accepts and writes one incoming frame.
void setFrameCount(uint32_t count)
Sets the accepted-frame counter to a specific value.
uint32_t getFrameCount()
Returns the number of accepted frames.
static void setup_python()
Registers Python bindings for this class.
bool waitFrameCount(uint32_t count, uint64_t timeout)
Waits until at least count frames have been accepted.
std::shared_ptr< rogue::utilities::fileio::StreamWriterChannel > StreamWriterChannelPtr