libsdr
0.1.0
A simple SDR library
|
Iterface of a blocking source. More...
#include <node.hh>
Public Member Functions | |
BlockingSource (bool parallel=false, bool connect_idle=true, bool stop_queue_on_eos=false) | |
Constructor. More... | |
virtual | ~BlockingSource () |
Destructor. More... | |
virtual void | next ()=0 |
This method gets called either by the Queue on idle events or by a thread to read more data from the input stream. More... | |
bool | isActive () const |
Returns true if the source is active. More... | |
virtual void | start () |
This function starts the input stream. More... | |
virtual void | stop () |
This function stops the input stream. More... | |
Public Member Functions inherited from sdr::Source | |
Source () | |
Constructor. More... | |
virtual | ~Source () |
Destructor. More... | |
virtual void | send (const RawBuffer &buffer, bool allow_overwrite=false) |
Sends the given buffer to all connected sinks. More... | |
void | connect (SinkBase *sink, bool direct=false) |
Connect this source to a sink. More... | |
void | disconnect (SinkBase *sink) |
Disconnect a sink again. More... | |
virtual void | setConfig (const Config &config) |
Stores the configuration and propergates it if the configuration has been changed. More... | |
virtual double | sampleRate () const |
Returns the configured sample rate or 0 otherwise. More... | |
virtual Config::Type | type () const |
Returns the configured source type or Config::Type_UNDEFINED otherwise. More... | |
template<class T > | |
void | addEOS (T *instance, void(T::*function)()) |
Adds a callback to the end-of-stream signal of the source. More... | |
Protected Member Functions | |
void | _parallel_main () |
The parallel main loop. More... | |
void | _nonvirt_idle_cb () |
The non-virtual idle callback. More... | |
Protected Member Functions inherited from sdr::Source | |
void | signalEOS () |
Signals the EOS. More... | |
void | propagateConfig (const Config &config) |
Propagates the given configuration to all connected sinks. More... | |
Protected Attributes | |
bool | _is_active |
If true, the source is active. More... | |
bool | _is_parallel |
If true, the surce is processed in parallel. More... | |
pthread_t | _thread |
The thread of the source. More... | |
Protected Attributes inherited from sdr::Source | |
Config | _config |
Holds the source configuration, this can be updated by calling setConfig . More... | |
std::map< SinkBase *, bool > | _sinks |
The connected sinks. More... | |
std::list< DelegateInterface * > | _eos |
The connected EOS singal handlers. More... | |
Iterface of a blocking source.
Blocking sources are usually input sources that wait for data from a device or file. Please note, a proper input source that reads data from a file should emmit the eos signal using the signalEOS
method. This can be used to stop the Queue
loop once the input can not provide data anymore.
BlockingSource::BlockingSource | ( | bool | parallel = false , |
bool | connect_idle = true , |
||
bool | stop_queue_on_eos = false |
||
) |
Constructor.
parallel | Specifies whether the source is waiting in a separate thread for new data. |
connect_idle | Specifies wheter the input source next() method should be connected to the idle signal of the Queue . |
stop_queue_on_eos | Signals the that the Queue should be stopped once the EOS is reached. Use this flag only if this source is the only source in the data stream. |
|
virtual |
Destructor.
|
protected |
The non-virtual idle callback.
|
protected |
The parallel main loop.
|
inline |
Returns true if the source is active.
|
pure virtual |
This method gets called either by the Queue
on idle events or by a thread to read more data from the input stream.
The next
function should be blocking in order to avoid busy waiting on incomming data.
|
virtual |
This function starts the input stream.
|
virtual |
This function stops the input stream.
|
protected |
If true, the source is active.
|
protected |
If true, the surce is processed in parallel.
|
protected |
The thread of the source.