Class CTraceFifoBase#

Nested Relationships#

Nested Types#

Class Documentation#

class CTraceFifoBase#

Trace fifo class allowing the publishing and monitoring of trace messages.

Unnamed Group

uint8_t *GetDataPtr()#

Get access to the data portion of the buffer.

Returns:

Get a pointer to the data. Returns NULL when the buffer is not initialized.

const uint8_t *GetDataPtr() const#

Get access to the data portion of the buffer.

Returns:

Get a pointer to the data. Returns NULL when the buffer is not initialized.

Public Functions

CTraceFifoBase(uint32_t uiInstanceID, size_t nSize)#

Default constructor.

Parameters:
  • uiInstanceID[in] The instance ID to use for sending/monitoring the messages.

  • nSize[in] Default size of the fifo.

virtual ~CTraceFifoBase()#

Default destructor.

Remark

Automatically closes the fifo if opened before.

CTraceFifoBase(const CTraceFifoBase &rfifo) = delete#

Copy constructor is not available.

Parameters:

rfifo[in] Reference to the fifo to copy.

CTraceFifoBase(CTraceFifoBase &&rfifo) noexcept#

Move constructor.

Parameters:

rfifo[in] Reference to the fifo.

CTraceFifoBase &operator=(const CTraceFifoBase &rfifo) = delete#

Copy assignment is not available.

Parameters:

rfifo[in] Reference to the fifo.

Returns:

Returns a reference to this fifo.

CTraceFifoBase &operator=(CTraceFifoBase &&rfifo) noexcept#

Move assignment.

Parameters:

rfifo[in] Reference to the fifo.

Returns:

Returns a reference to this fifo.

virtual bool Open(size_t nTimeout = 1000, uint32_t uiFlags = 0u) = 0#

Open the fifo. Implemented by derived class.

Parameters:
  • nTimeout[in] Timeout to return from this function. A timeout of 0xffffffff does not return until a connection has been established.

  • uiFlags[in] Zero or more flags of ETraceFifoOpenFlags enum.

Returns:

Returns true when connected; false otherwise.

virtual void Close() = 0#

Cancel any running task and close an open fifo. Implemented by derived class.

virtual bool IsOpened() const = 0#

Is the fifo open for reading and writing? Implemented by derived class.

Returns:

Returns true when opened; false otherwise.

bool SetInstanceID(uint32_t uiInstanceID)#

Set a new instance ID for the communication.

Remark

The instance ID can only be set when the fifo is not opened yet.

Parameters:

uiInstanceID[in] The new instance ID.

Returns:

Returns whether setting the instance ID was successful.

uint32_t GetInstanceID() const#

Return the instance ID to use for the communication.

Returns:

The instance ID.

void SetDefaultSize(size_t nSize)#

Set a new default size to be used during creation of the fifo.

Parameters:

nSize[in] The new default size of the buffer.

size_t GetDefaultSize() const#

Get the default size used during creation of the fifo.

Returns:

The default size of the buffer.

size_t GetViewSize() const#

Get the size of the view.

Returns:

The view size.

size_t GetDataBufferSize() const#

Get the size of the buffer without any headers.

Returns:

Returns the size of the buffer or 0 when the buffer is not initialized.

Protected Functions

void InitializeBuffer(void *pView, size_t nBufferSize, bool bReadOnly)#

Initialize the buffer after successful opening.

Parameters:
  • pView[in] Pointer to the shared memory view.

  • nBufferSize[in] The size of the buffer allocated.

  • bReadOnly[in] When set, the buffer is initialized as read-only. Multiple read-only and only one writable buffer access are allowed.

bool IsInitialized() const#

Check whether the buffer is initialized (signature and instance ID are set).

Returns:

Returns true when the buffer has been initialized; false when not.

void Terminate()#

Clear the buffer pointers.

std::unique_lock<std::recursive_mutex> CreateAccessLockObject() const#

Create a lock object for exclusive access of the buffer.

Returns:

The lock object that allows access.

void *GetView()#

Get access to the view.

Returns:

Get a pointer to the buffer. Returns NULL when the buffer is not initialized.

size_t GetWritePos() const#

Get the write position.

Returns:

The current write position within the buffer.

void SetWritePos(size_t nTxPos)#

Set the write position. Can only be used by writable buffer (causing an access violation otherwise).

Parameters:

nTxPos[in] The new write position.