Dali 3D User Interface Engine
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
Dali::Internal::MessageBuffer Class Reference

Utility class to reserve a buffer for storing messages. More...

#include <message-buffer.h>

Classes

class  Iterator
 Used to iterate though the messages in the buffer. More...
 

Public Types

typedef std::ptrdiff_t WordType
 

Public Member Functions

 MessageBuffer (std::size_t initialCapacity)
 Create a new MessageBuffer. More...
 
 ~MessageBuffer ()
 Non-virtual destructor; not suitable as a base class. More...
 
unsigned int * ReserveMessageSlot (std::size_t size)
 Reserve space for another message in the buffer. More...
 
std::size_t GetCapacity () const
 Query the capacity of the message buffer. More...
 
Iterator Begin () const
 Returns an iterator to the first message in the buffer. More...
 
void Reset ()
 Sets the size of the buffer to zero (does not deallocate memory) More...
 

Private Member Functions

 MessageBuffer (const MessageBuffer &)
 
MessageBufferoperator= (const MessageBuffer &rhs)
 
void IncreaseCapacity (std::size_t newCapacity)
 Helper to increase the capacity of the buffer. More...
 

Private Attributes

std::size_t mInitialCapacity
 The capacity to allocate during first call to ReserveMessageSlot. More...
 
WordTypemData
 The data allocated for the message buffer. More...
 
WordTypemNextSlot
 The next free location in the buffer. More...
 
std::size_t mCapacity
 The memory allocated with respect to sizeof(WordType) More...
 
std::size_t mSize
 The memory reserved for messages with respect to sizeof(WordType) More...
 

Detailed Description

Utility class to reserve a buffer for storing messages.

Definition at line 33 of file message-buffer.h.

Member Typedef Documentation

Definition at line 36 of file message-buffer.h.

Constructor & Destructor Documentation

Dali::Internal::MessageBuffer::MessageBuffer ( std::size_t  initialCapacity)

Create a new MessageBuffer.

Parameters
[in]Thesmallest capacity which the buffer will allocate, with respect to the size of type "char".
Note
The buffer will not allocate memory until the first call to ReserveMessageSlot().

Definition at line 51 of file message-buffer.cpp.

Dali::Internal::MessageBuffer::~MessageBuffer ( )

Non-virtual destructor; not suitable as a base class.

Definition at line 60 of file message-buffer.cpp.

References mData.

Dali::Internal::MessageBuffer::MessageBuffer ( const MessageBuffer )
private

Member Function Documentation

MessageBuffer::Iterator Dali::Internal::MessageBuffer::Begin ( ) const

Returns an iterator to the first message in the buffer.

There is no past-the-end iterator; use Iterator::IsValid() to determine when the has been reached.

Note
Adding more messages with ReserveMessageSlot() may corrupt this iterator.
Returns
The iterator.

Definition at line 108 of file message-buffer.cpp.

References mData, and mSize.

Referenced by Dali::Internal::Update::MessageQueue::Impl::DeleteBufferContents(), Dali::Internal::EventProcessor::ProcessEvents(), Dali::Internal::SceneGraph::RenderQueue::ProcessMessages(), Dali::Internal::Update::MessageQueue::ProcessMessages(), Dali::Internal::EventProcessor::~EventProcessor(), and Dali::Internal::SceneGraph::RenderQueue::~RenderQueue().

Here is the caller graph for this function:

std::size_t Dali::Internal::MessageBuffer::GetCapacity ( ) const

Query the capacity of the message buffer.

Returns
The capacity with respect to the size of type "char".

Definition at line 103 of file message-buffer.cpp.

References mCapacity, and anonymous_namespace{message-buffer.cpp}::WORD_SIZE.

Referenced by Dali::Internal::Update::MessageQueue::FlushQueue().

Here is the caller graph for this function:

void Dali::Internal::MessageBuffer::IncreaseCapacity ( std::size_t  newCapacity)
private

Helper to increase the capacity of the buffer.

Precondition
The newCapacity is greater than mCapacity.
Parameters
[in]ThenewCapacity

Definition at line 125 of file message-buffer.cpp.

References DALI_ASSERT_ALWAYS, DALI_ASSERT_DEBUG, mCapacity, mData, mNextSlot, mSize, and anonymous_namespace{message-buffer.cpp}::WORD_SIZE.

Referenced by ReserveMessageSlot().

Here is the caller graph for this function:

MessageBuffer& Dali::Internal::MessageBuffer::operator= ( const MessageBuffer rhs)
private
unsigned int * Dali::Internal::MessageBuffer::ReserveMessageSlot ( std::size_t  size)
void Dali::Internal::MessageBuffer::Reset ( )

Sets the size of the buffer to zero (does not deallocate memory)

Definition at line 118 of file message-buffer.cpp.

References mData, mNextSlot, and mSize.

Referenced by Dali::Internal::EventProcessor::ProcessEvents(), Dali::Internal::SceneGraph::RenderQueue::ProcessMessages(), and Dali::Internal::Update::MessageQueue::ProcessMessages().

Here is the caller graph for this function:

Member Data Documentation

std::size_t Dali::Internal::MessageBuffer::mCapacity
private

The memory allocated with respect to sizeof(WordType)

Definition at line 144 of file message-buffer.h.

Referenced by GetCapacity(), IncreaseCapacity(), and ReserveMessageSlot().

WordType* Dali::Internal::MessageBuffer::mData
private

The data allocated for the message buffer.

Definition at line 141 of file message-buffer.h.

Referenced by Begin(), IncreaseCapacity(), ReserveMessageSlot(), Reset(), and ~MessageBuffer().

std::size_t Dali::Internal::MessageBuffer::mInitialCapacity
private

The capacity to allocate during first call to ReserveMessageSlot.

Definition at line 139 of file message-buffer.h.

Referenced by ReserveMessageSlot().

WordType* Dali::Internal::MessageBuffer::mNextSlot
private

The next free location in the buffer.

Definition at line 142 of file message-buffer.h.

Referenced by IncreaseCapacity(), ReserveMessageSlot(), and Reset().

std::size_t Dali::Internal::MessageBuffer::mSize
private

The memory reserved for messages with respect to sizeof(WordType)

Definition at line 145 of file message-buffer.h.

Referenced by Begin(), IncreaseCapacity(), ReserveMessageSlot(), and Reset().


The documentation for this class was generated from the following files:
Dali Docs Home
Read more about Dali