Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
Public Member Functions | Protected Member Functions | List of all members
ska::cheetah::psrdada::test_utils::TestDadaDB Class Reference

A mock class for implementing the interface of a DADA DB (Header/Data Unit) More...

#include <cheetah/psrdada/test_utils/TestDadaDB.h>

Collaboration diagram for ska::cheetah::psrdada::test_utils::TestDadaDB:
Collaboration graph

Public Member Functions

 TestDadaDB (uint64_t nbufs=DADA_DEFAULT_BLOCK_NUM, uint64_t bufsz=DADA_DEFAULT_BLOCK_SIZE, uint64_t nhdrs=IPCBUF_XFERS, uint64_t hdrsz=DADA_DEFAULT_HEADER_SIZE)
 Constructa new TestDadaDB instance. More...
 
 TestDadaDB (TestDadaDB const &)=delete
 
void create ()
 Create the data and header blocks in shared memory.
 
void destroy ()
 Destroy the allocated shared memory blocks.
 
uint64_t num_data_buffers () const
 Return the number of data buffers.
 
uint64_t data_buffer_size () const
 Return the size of each data buffer.
 
uint64_t num_header_buffers () const
 Return the number of header buffers.
 
uint64_t header_buffer_size () const
 Return the size of each header buffer.
 
key_t key () const
 Return the hexidecimal shared memory key. More...
 

Protected Member Functions

void do_destroy ()
 

Detailed Description

A mock class for implementing the interface of a DADA DB (Header/Data Unit)

A standard DADA HDU buffer is composed of a set of data buffers of equal size and a set of header buffers of equal size.

The standard use case is that a client connects to the header buffer, reads some metadata and then uses that to determine how to handle the data in the data buffers.

Definition at line 46 of file TestDadaDB.h.

Constructor & Destructor Documentation

◆ TestDadaDB()

ska::cheetah::psrdada::test_utils::TestDadaDB::TestDadaDB ( uint64_t  nbufs = DADA_DEFAULT_BLOCK_NUM,
uint64_t  bufsz = DADA_DEFAULT_BLOCK_SIZE,
uint64_t  nhdrs = IPCBUF_XFERS,
uint64_t  hdrsz = DADA_DEFAULT_HEADER_SIZE 
)

Constructa new TestDadaDB instance.

Parameters
[in]_keyA hexidecimal shared memory key
[in]_nbufsThe number of data buffers
[in]_bufszThe size in bytes of each data buffer
[in]_nhdrsThe number of header buffers
[in]_hdrszThe size in bytes of each header buffer

Definition at line 70 of file TestDadaDB.cpp.

71  : _nbufs(nbufs)
72  , _bufsz(bufsz)
73  , _nhdrs(nhdrs)
74  , _hdrsz(hdrsz)
75  , _dada_key(0)
76  , _data_block(IPCBUF_INIT)
77  , _header(IPCBUF_INIT)
78  , _data_blocks_created(false)
79  , _header_blocks_created(false)
80 {
81 }
Here is the call graph for this function:

Member Function Documentation

◆ key()

key_t ska::cheetah::psrdada::test_utils::TestDadaDB::key ( ) const

Return the hexidecimal shared memory key.

This key can be used by other processes to access the shared memory blocks.

Note
This key is the key to the data blocks. To access the header blocks use key+1. This is handled under the hood by PSRDADA applocations and is handled by DadaReadClient.

Definition at line 158 of file TestDadaDB.cpp.

159 {
160  return _dada_key;
161 }

The documentation for this class was generated from the following files: