rogue
Loading...
Searching...
No Matches
Fifo.h
Go to the documentation of this file.
1
17#ifndef __ROGUE_INTERFACES_STREAM_FIFO_H__
18#define __ROGUE_INTERFACES_STREAM_FIFO_H__
19#include "rogue/Directives.h"
20
21#include <stdint.h>
22
23#include <memory>
24#include <thread>
25
26#include "rogue/Logging.h"
29
30namespace rogue {
31namespace interfaces {
32namespace stream {
33
54 std::shared_ptr<rogue::Logging> log_;
55
56 // Configurations
57 uint32_t maxDepth_;
58 uint32_t trimSize_;
59 bool noCopy_;
60
61 // Drop frame counter
62 std::size_t dropFrameCnt_;
63
64 // Queue
66
67 // Transmission thread
68 bool threadEn_;
69 std::thread* thread_;
70
71 // Thread background
72 void runThread();
73
74 public:
93 static std::shared_ptr<rogue::interfaces::stream::Fifo> create(uint32_t maxDepth, uint32_t trimSize, bool noCopy);
94
96 static void setup_python();
97
110 Fifo(uint32_t maxDepth, uint32_t trimSize, bool noCopy);
111
113 ~Fifo();
114
116 std::size_t size();
117
119 std::size_t dropCnt() const;
120
122 void clearCnt();
123
129 void acceptFrame(std::shared_ptr<rogue::interfaces::stream::Frame> frame);
130};
131
133typedef std::shared_ptr<rogue::interfaces::stream::Fifo> FifoPtr;
134} // namespace stream
135} // namespace interfaces
136} // namespace rogue
137#endif
Thread-safe bounded queue with optional busy threshold.
Definition Queue.h:38
Stream frame FIFO.
Definition Fifo.h:53
void acceptFrame(std::shared_ptr< rogue::interfaces::stream::Frame > frame)
Receives a frame from upstream and enqueues or drops it.
Definition Fifo.cpp:104
static void setup_python()
Registers this type with Python bindings.
Definition Fifo.cpp:49
std::size_t size()
Returns current FIFO queue depth.
Definition Fifo.cpp:89
std::size_t dropCnt() const
Returns the total dropped-frame counter.
Definition Fifo.cpp:94
void clearCnt()
Clears FIFO counters (including dropped-frame count).
Definition Fifo.cpp:99
~Fifo()
Destroys the FIFO and stops internal worker thread.
Definition Fifo.cpp:80
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
std::shared_ptr< rogue::interfaces::stream::Fifo > FifoPtr
Shared pointer alias for Fifo.
Definition Fifo.h:133