Dali 3D User Interface Engine
message-buffer.h
Go to the documentation of this file.
1 #ifndef __DALI_INTERNAL_MESSAGE_BUFFER_H__
2 #define __DALI_INTERNAL_MESSAGE_BUFFER_H__
3 
4 /*
5  * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20 
21 // EXTERNAL INCLUDES
22 #include <cstddef>
23 
24 namespace Dali
25 {
26 
27 namespace Internal
28 {
29 
34 {
35 public:
36  typedef std::ptrdiff_t WordType;
37 
43  MessageBuffer( std::size_t initialCapacity );
44 
49 
56  unsigned int* ReserveMessageSlot( std::size_t size );
57 
62  std::size_t GetCapacity() const;
63 
67  class Iterator
68  {
69  public:
70 
71  // Constructor
72  Iterator(WordType* current);
73 
74  // Inlined for performance
75  bool IsValid()
76  {
77  // Valid until end marker has been found
78  return 0 != mMessageSize;
79  }
80 
81  // Inlined for performance
83  {
84  return ( 0 != mMessageSize ) ? mCurrent : NULL;
85  }
86 
87  // Inlined for performance
88  void Next()
89  {
90  // Jump to next object and read size
93  }
94 
95  // Copy constructor
96  Iterator(const Iterator& copy);
97 
98  private:
99 
100  // Undefined
101  Iterator& operator=(const Iterator& rhs);
102 
103  private:
104 
106  std::size_t mMessageSize;
107  };
108 
115  Iterator Begin() const;
116 
120  void Reset();
121 
122 private:
123 
124  // Undefined
126 
127  // Undefined
129 
135  void IncreaseCapacity( std::size_t newCapacity );
136 
137 private:
138 
139  std::size_t mInitialCapacity;
140 
143 
144  std::size_t mCapacity;
145  std::size_t mSize;
146 };
147 
148 } // namespace Internal
149 
150 } // namespace Dali
151 
152 #endif // __DALI_INTERNAL_MESSAGE_BUFFER_H__
Dali Docs Home
Read more about Dali