Class DataBlockWrite
Defined in File DataBlockWrite.h
Inheritance Relationships
Base Type
public ska::pst::smrb::DataBlockAccessor
(Class DataBlockAccessor)
Class Documentation
-
class DataBlockWrite : public ska::pst::smrb::DataBlockAccessor
Object Oriented interface to write to a PSRDADA Shared Memory Ring Buffer (SMRB).
Public Functions
-
explicit DataBlockWrite(const std::string &key)
Construct a new Data Block Write object for the SMRB identified by the key.
- Parameters
key – 4 character hexidecimal key that identifies the SMRB in shared memory.
-
~DataBlockWrite()
Destroy the Data Block Write object. Closes the access to the SMRB if required.
-
virtual void open() override
Open the SMRB for writing.
-
virtual void lock() override
Lock write access to the SMRB.
-
virtual void close() override
Close the connection to the SMRB.
-
virtual void unlock() override
Unlock write access to the SMRB.
-
void write_config(const std::string &scan_config)
Write the scan configuration string to the header_block.
- Parameters
scan_config – string representation of the scan configuration
-
void write_header(const std::string &full_header)
Write the complete header string to the header_block.
- Parameters
full_header – string representation of the full header
-
ssize_t write_data(char *ptr, size_t bytes)
Write the specified amount of data to the SMRB data_block.
- Parameters
ptr – pointer to data to be written to the data_block
bytes – number of bytes to write to the data_block
- Returns
ssize_t number of bytes written to the data_block
-
virtual char *open_block() override
Open a data_block buffer for DMA.
- Returns
void* pointer to the opened data_block buffer
-
virtual ssize_t close_block(uint64_t bytes) override
Close an opened data_block buffer specifying the number of bytes written.
- Parameters
bytes – number of bytes written to the opened data_block buffer
- Returns
ssize_t number of bytes written
-
ssize_t update_block(uint64_t bytes)
Update the number of bytes written to the opened data_block buffer.
- Parameters
bytes – number of bytes written
- Returns
ssize_t number of bytes updated
-
void zero_next_block()
zero the buffer in the data_block after the currently opened buffer
-
inline size_t get_opened_blocks_count()
Return the number of open blocks.
- Returns
size_t number of opened blocks
-
explicit DataBlockWrite(const std::string &key)