Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
|
Class that provides means for reading from a DADA ring buffer. More...
#include <cheetah/psrdada/DadaReadClient.h>
Public Member Functions | |
DadaReadClient (key_t key, panda::Engine &engine, NextSequenceCallback const &next_sequence_callback) | |
Instatiate new DadaReadClient. More... | |
DadaReadClient (DadaReadClient const &)=delete | |
template<typename Iterator , typename DataType = typename std::iterator_traits<Iterator>::value_type> | |
Iterator & | read (Iterator &begin, Iterator const &end) |
Read from the data ring buffer. More... | |
void | next_sequence () |
Move to the next sequence in the ring buffer. More... | |
template<typename CallBackFunctor > | |
void | next_sequence (CallBackFunctor callback) |
Move to the next sequence in the ring buffer. More... | |
void | stop () |
std::shared_ptr< bool > | stopped () const |
void | start () |
![]() | |
DadaClientBase (key_t key, std::string const &logger_name) | |
Create a new basic DADA client instance. More... | |
DadaClientBase (DadaClientBase const &)=delete | |
std::size_t | data_buffer_size () const |
Get the sizes of each data block in the ring buffer. | |
std::size_t | header_buffer_size () const |
Get the sizes of each header block in the ring buffer. | |
std::size_t | data_buffer_count () const |
Get the number of data blocks in the ring buffer. | |
std::size_t | header_buffer_count () const |
Get the number of header blocks in the ring buffer. | |
void | connect () |
Connect to ring buffer. | |
void | disconnect () |
Disconnect from ring buffer. | |
void | reconnect () |
Reconnect to the ring buffer. | |
std::string const & | id () const |
Return a string identifier based on the buffer key and log name. | |
Protected Member Functions | |
template<typename CallBack > | |
void | do_next_sequence (std::shared_ptr< bool > destructor_flag, CallBack callback) |
Additional Inherited Members | |
![]() | |
key_t | _key |
dada_hdu_t * | _hdu |
bool | _connected |
detail::MultiLog | _log |
std::string | _id |
Class that provides means for reading from a DADA ring buffer.
This class provides reader-like access to a ring of DADA HDU memory buffers.
Definition at line 61 of file DadaReadClient.h.
ska::cheetah::psrdada::DadaReadClient::DadaReadClient | ( | key_t | key, |
panda::Engine & | engine, | ||
NextSequenceCallback const & | next_sequence_callback | ||
) |
Instatiate new DadaReadClient.
[in] | key | Hexidecimal key to DADA shared memory block |
next_sequence_callback | A callback to be called on the start of each subsequent sequence in the DADA buffer. |
Upon instantiaton the DadaReadClient instance will connect to the DADA buffer identified by the key and open a header block for reading, this header block is passed to the next_sequence_callback in the form of a std::istream reference.
To end reading from the current sequence and start the next sequence, use the next_sequence method. This will flush all data in the buffer until an end-of-data marker is encountered, whereupon the next header block will be opened and passed to the next_sequence_callback.
Definition at line 52 of file DadaReadClient.cpp.
void ska::cheetah::psrdada::DadaReadClient::next_sequence | ( | ) |
Move to the next sequence in the ring buffer.
This will flush all data in the buffer until an end-of-data marker is encountered, whereupon the next header block will be opened and passed to the default next_sequence_callback as passed in the constructor.
Definition at line 95 of file DadaReadClient.cpp.
void ska::cheetah::psrdada::DadaReadClient::next_sequence | ( | CallBackFunctor | callback | ) |
Move to the next sequence in the ring buffer.
same as next_sequence() but will call the provided callback when a buffer becomes availabel instead of the default callback
Definition at line 58 of file DadaReadClient.cpp.
Iterator & ska::cheetah::psrdada::DadaReadClient::read | ( | Iterator & | begin, |
Iterator const & | end | ||
) |
Read from the data ring buffer.
begin | An iterator pointing to the start of the sequence to read into. |
end | An iterator pointing to the end of the sequence to read into. |
DataType | The data type to be read from the buffer. |
Iterator | The iterator type. |
Data will be cast to DataType upon reading from the buffer. It is the responsibility of the caller to ensure that this cast does not result in under or overflow.
Definition at line 36 of file DadaReadClient.cpp.