Seperate the API macros
[platform/core/uifw/dali-core.git] / dali / devel-api / common / ref-counted-dali-vector.h
1 #ifndef __REF_COUNTED_DALI_VECTOR_H__
2 #define __REF_COUNTED_DALI_VECTOR_H__
3
4 /*
5  * Copyright (c) 2015 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 // INTERNAL INCLUDES
22 #include <dali/public-api/common/dali-vector.h>
23 #include <dali/public-api/object/ref-object.h>
24
25 namespace Dali
26 {
27
28 /**
29  * @brief A reference counting wrapper for a vector class that allows
30  * a set of referencing smart pointers to collaborate in managing its
31  * lifetime and eventually cleaning it up.
32  *
33  * This should only be allocated on the new/delete heap, not a thread's
34  * stack.
35  * @tparam T type of the data that the vector holds
36  */
37 template< typename T >
38 class RefCountedVector : public RefObject
39 {
40 public:
41   /**
42    * @brief Construct empty vector.
43    */
44   RefCountedVector()
45   {
46   }
47
48   /**
49    * @brief Get the referenced vector.
50    *
51    * @return A reference to the vector that this object wraps.
52    */
53   Vector< T >& GetVector()
54   {
55     return mVector;
56   }
57
58 protected:
59   virtual ~RefCountedVector()
60   {
61   }
62
63 private:
64   // Disable copy-constructing and copying:
65   RefCountedVector(const RefCountedVector &); ///< Undefined
66   RefCountedVector & operator = (const RefCountedVector &); ///< Undefined
67
68   Vector< T > mVector; ///< The vector of data
69 };
70
71 } // namespace Dali
72
73 #endif /* __REF_COUNTED_DALI_VECTOR_H__ */