Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / internal / common / message-buffer.h
index 0025106..fc14928 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_MESSAGE_BUFFER_H__
-#define __DALI_INTERNAL_MESSAGE_BUFFER_H__
+#ifndef DALI_INTERNAL_MESSAGE_BUFFER_H
+#define DALI_INTERNAL_MESSAGE_BUFFER_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -19,7 +19,8 @@
  */
 
 // EXTERNAL INCLUDES
-#include <cstddef>
+#include <cstddef> // size_t
+#include <cstdint> // uint32_t
 
 namespace Dali
 {
@@ -33,6 +34,7 @@ namespace Internal
 class MessageBuffer
 {
 public:
+  using WordType = std::ptrdiff_t;
 
   /**
    * Create a new MessageBuffer
@@ -49,10 +51,10 @@ public:
   /**
    * Reserve space for another message in the buffer.
    * @pre size is greater than zero.
-   * @param[in] The message size with respect to the size of type "char".
-   * @return A pointer to the address allocated for the message.
+   * @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
    */
-  unsigned int* ReserveMessageSlot( std::size_t size );
+  uint32_t* ReserveMessageSlot( std::size_t size );
 
   /**
    * Query the capacity of the message buffer.
@@ -68,7 +70,7 @@ public:
   public:
 
     // Constructor
-    Iterator(unsigned int* current);
+    Iterator(WordType* current);
 
     // Inlined for performance
     bool IsValid()
@@ -78,7 +80,7 @@ public:
     }
 
     // Inlined for performance
-    unsigned int* Get()
+    WordType* Get()
     {
       return ( 0 != mMessageSize ) ? mCurrent : NULL;
     }
@@ -101,8 +103,8 @@ public:
 
   private:
 
-    unsigned int* mCurrent;
-    unsigned int mMessageSize;
+    WordType* mCurrent;
+    std::size_t mMessageSize;
   };
 
   /**
@@ -137,15 +139,15 @@ private:
 
   std::size_t mInitialCapacity; ///< The capacity to allocate during first call to ReserveMessageSlot
 
-  unsigned int* mData;     ///< The data allocated for the message buffer
-  unsigned int* mNextSlot; ///< The next free location in the buffer
+  WordType* mData;     ///< The data allocated for the message buffer
+  WordType* mNextSlot; ///< The next free location in the buffer
 
-  std::size_t mCapacity; ///< The memory allocated with respect to sizeof(unsigned int)
-  std::size_t mSize;     ///< The memory reserved for messages with respect to sizeof(unsigned int)
+  std::size_t mCapacity; ///< The memory allocated with respect to sizeof(WordType)
+  std::size_t mSize;     ///< The memory reserved for messages with respect to sizeof(WordType)
 };
 
 } // namespace Internal
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_MESSAGE_BUFFER_H__
+#endif // DALI_INTERNAL_MESSAGE_BUFFER_H