rogue
Loading...
Searching...
No Matches
src
rogue
interfaces
stream
Filter.cpp
Go to the documentation of this file.
1
17
#include "
rogue/Directives.h
"
18
19
#include "
rogue/interfaces/stream/Filter.h
"
20
21
#include <inttypes.h>
22
#include <stdint.h>
23
24
#include <memory>
25
26
#include "
rogue/Logging.h
"
27
#include "
rogue/interfaces/stream/Frame.h
"
28
#include "
rogue/interfaces/stream/Master.h
"
29
#include "
rogue/interfaces/stream/Slave.h
"
30
31
namespace
ris
=
rogue::interfaces::stream
;
32
33
#ifndef NO_PYTHON
34
#include <boost/python.hpp>
35
namespace
bp = boost::python;
36
#endif
37
39
ris::FilterPtr
ris::Filter::create(
bool
dropErrors, uint8_t channel) {
40
ris::FilterPtr
p = std::make_shared<ris::Filter>(dropErrors, channel);
41
return
(p);
42
}
43
45
void
ris::Filter::setup_python() {
46
#ifndef NO_PYTHON
47
bp::class_<ris::Filter, ris::FilterPtr, bp::bases<ris::Master, ris::Slave>, boost::noncopyable>(
48
"Filter"
,
49
bp::init<bool, uint8_t>());
50
#endif
51
}
52
54
ris::Filter::Filter(
bool
dropErrors, uint8_t channel) :
ris
::
Master
(),
ris
::
Slave
() {
55
dropErrors_ = dropErrors;
56
channel_ = channel;
57
58
log_ =
rogue::Logging::create
(
"stream.Filter"
);
59
}
60
62
ris::Filter::~Filter() {}
63
65
void
ris::Filter::acceptFrame(
ris::FramePtr
frame) {
66
// Drop channel mismatches
67
if
(frame->getChannel() != channel_)
return
;
68
69
// Drop errored frames
70
if
(dropErrors_ && (frame->getError() != 0)) {
71
log_->debug(
"Dropping errored frame: Channel=%"
PRIu8
", Error=0x%"
PRIx8, channel_, frame->getError());
72
return
;
73
}
74
75
sendFrame(frame);
76
}
Directives.h
Filter.h
Frame.h
Logging.h
rogue::Logging::create
static std::shared_ptr< rogue::Logging > create(const std::string &name, bool quiet=false)
Creates a logger instance.
Definition
Logging.cpp:60
rogue::interfaces::stream::Master
Stream master endpoint.
Definition
Master.h:65
rogue::interfaces::stream::Slave
Stream slave endpoint and default frame pool.
Definition
Slave.h:72
rogue::interfaces::stream
Definition
Buffer.h:29
rogue::interfaces::stream::FramePtr
std::shared_ptr< rogue::interfaces::stream::Frame > FramePtr
Shared pointer alias for Frame.
Definition
Frame.h:549
rogue::interfaces::stream::FilterPtr
std::shared_ptr< rogue::interfaces::stream::Filter > FilterPtr
Shared pointer alias for Filter.
Definition
Filter.h:93
Master.h
Slave.h
Generated by
1.9.8