1 #ifndef __DALI_REF_OBJECT_H__
2 #define __DALI_REF_OBJECT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/dali-common.h>
23 #include <dali/public-api/common/intrusive-ptr.h>
28 * @addtogroup dali_core_object
35 * @brief Base class for reference counted objects.
37 * Typically this should be used with an instrusive pointer,
38 * instead of calling Reference() and Unreference() methods directly.
40 class DALI_IMPORT_API RefObject
45 * @brief Increment the object's reference count.
50 * @brief Decrement the object's reference count.
52 * When the reference count drops to zero, the object will self-destruct.
57 * @brief Retrieve the object's reference count.
59 * @return The reference count
66 * @brief Default constructor.
71 * @brief RefObject is intended as a base class.
73 * A RefObject may only be deleted when its reference count is zero.
78 * @brief Copy constructor.
80 * The newly copied object will have a reference count of zero.
81 * @param[in] rhs The object to copy
83 RefObject(const RefObject& rhs);
86 * @brief Assignment operator.
88 * The newly copied object will have a reference count of zero.
89 * @param[in] rhs The object to copy
90 * @return a reference to this
92 RefObject& operator=(const RefObject& rhs);
96 volatile int mCount; ///< Reference count
104 #endif // __DALI_REF_OBJECT_H__