Class DataBlockView
Defined in File DataBlockView.h
Inheritance Relationships
Base Type
public ska::pst::smrb::DataBlockAccessor
(Class DataBlockAccessor)
Class Documentation
-
class DataBlockView : public ska::pst::smrb::DataBlockAccessor
Object Oriented interface to view to a PSRDADA Shared Memory Ring Buffer (SMRB).
Public Functions
-
explicit DataBlockView(const std::string &key)
Construct a new Data Block View object for the SMRB identified by the key.
- Parameters
key – four-character hexidecimal key that identifies the SMRB in shared memory
-
~DataBlockView()
Destroy the Data Block View object. Closes the access to the SMRB if required.
-
virtual void open() override
Open the SMRB for viewing.
-
virtual void close() override
Clear the information last parsed from the header block.
It is not necessary to close the SMRB when only viewing.
-
virtual void lock() override
Effectively does nothing.
Although viewers need not necessarily lock exclusive access to the ring buffer in shared memory, the assumptions built into DataBlockAccessor base class dictate that the locked flag must be set; therefore, it is necessary to call this method after calling open().
-
virtual char *open_block() override
Open the current viewing buffer in the data block.
- Returns
pointer to the current viewing buffer in the data block
-
virtual ssize_t close_block(uint64_t bytes) override
Internally flag the current data block buffer as viewed.
- Parameters
bytes – effective ignored
- Returns
ssize_t the number of bytes passed as an argument
-
ssize_t read_data(char *ptr, size_t bytes)
Read the specified amount of data from the SMRB data block.
- Parameters
ptr – pointer to buffer where the data will be stored
bytes – size of buffer
- Returns
ssize_t number of bytes read from the data block
-
void read_config()
Read the scan configuration from the header_block.
-
void read_header()
Read the full header from the header_block.
-
int seek_to_end(uint64_t byte_resolution = 0)
Go to the end of the SMRB data block.
- Parameters
byte_resolution – how large of a chunck of data to allow for.
- Returns
int Return 0 on success, -1 on failure
-
ssize_t seek(int64_t offset, int whence)
Move the view to a particular part of the data block.
- Parameters
offset – the offset to apply in bytes
whence – from where to apply the offset
-
char *get_curr_buf()
Get the current buffer of the SMRB data_block.
-
size_t get_current_buffer_index() const
Get the index of the current buffer of the SMRB data_block.
-
void seek_to_buffer_index(size_t buffer_index)
Go to the specified buffer of the SMRB data block.
- Parameters
buffer_index – ring buffer index in the data block
-
explicit DataBlockView(const std::string &key)