#define DALI_INTERNAL_MESSAGE_BUFFER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Internal
{
-
/**
* Utility class to reserve a buffer for storing messages.
*/
class MessageBuffer
{
public:
- typedef std::ptrdiff_t WordType;
+ using WordType = std::ptrdiff_t;
/**
* Create a new MessageBuffer
* @param[in] The smallest 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().
*/
- MessageBuffer( std::size_t initialCapacity );
+ MessageBuffer(std::size_t initialCapacity);
/**
* Non-virtual destructor; not suitable as a base class
* @param[in] size The message size with respect to the size of type "char".
* @return A pointer to the address allocated for the message, aligned to a word boundary
*/
- uint32_t* ReserveMessageSlot( std::size_t size );
+ uint32_t* ReserveMessageSlot(std::size_t size);
/**
* Query the capacity of the message buffer.
class Iterator
{
public:
-
// Constructor
Iterator(WordType* current);
// Inlined for performance
WordType* Get()
{
- return ( 0 != mMessageSize ) ? mCurrent : NULL;
+ return (0 != mMessageSize) ? mCurrent : nullptr;
}
// Inlined for performance
Iterator(const Iterator& copy);
private:
-
// Undefined
Iterator& operator=(const Iterator& rhs);
private:
-
- WordType* mCurrent;
+ WordType* mCurrent;
std::size_t mMessageSize;
};
void Reset();
private:
-
// Undefined
MessageBuffer(const MessageBuffer&);
* @pre The newCapacity is greater than mCapacity.
* @param[in] The newCapacity
*/
- void IncreaseCapacity( std::size_t newCapacity );
+ void IncreaseCapacity(std::size_t newCapacity);
private:
-
std::size_t mInitialCapacity; ///< The capacity to allocate during first call to ReserveMessageSlot
WordType* mData; ///< The data allocated for the message buffer