2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FBase_HandleT.h
20 * @brief This is the header file for the %_HandleT class.
22 * This file contains the declarations of the %_HandleT class.
25 #ifndef _FBASE_INTERNAL_HANDLE_TEMPLATE_H_
26 #define _FBASE_INTERNAL_HANDLE_TEMPLATE_H_
28 #include <FBaseObject.h>
29 #include "FBase_ObjectManagerImpl.h"
31 namespace Tizen { namespace Base
35 class _ObjectManagerT;
39 : public Tizen::Base::Object
43 * This is the default constructor for this class.
48 : __handle(0), __pObjectManagerImpl(null)
53 * This is the destructor for this class.
57 virtual ~_HandleT(void)
62 * Checks whether the handle is initialized or not.
65 * @return @c true if the handle is not initialized, @n
68 bool IsNull(void) const
74 * Checks whether the handle is valid or not.
77 * return @c true if the handle is valid, @n else @c false
79 bool IsValid(void) const
81 if (__handle == 0 || __pObjectManagerImpl == null)
86 return __pObjectManagerImpl->IsValidHandle(__handle);
90 * Get the signed @c int equivalent of the current instance.
93 * @return Signed @c int equivalent of the current instance
101 * Checks whether the two instances of _HandleT are equal.
104 * @return @c true if the values of the two instances of _HandleT are similar, @n
106 * @param[in] rhs An instance of %_HandleT
108 inline bool operator ==(const _HandleT <T>& rhs) const
110 return __handle == rhs.__handle;
114 * Checks whether the two instances of _HandleT are not equal.
117 * @return @c true if the values of the two instances of _HandleT are not similar, @n
119 * @param[in] rhs An instance of %_HandleT
122 inline bool operator !=(const _HandleT <T>& rhs) const
124 return !(*this == rhs);
127 _HandleT(const _HandleT<T>& handle)
129 this->__handle = handle.__handle;
130 this->__pObjectManagerImpl = handle.__pObjectManagerImpl;
133 _HandleT<T>& operator = (const _HandleT& handle)
140 this->__handle = handle.__handle;
141 this->__pObjectManagerImpl = handle.__pObjectManagerImpl;
147 void Initialize(unsigned int handle, _ObjectManagerImpl* pObjectManagerImpl)
150 __pObjectManagerImpl = pObjectManagerImpl;
154 unsigned int __handle;
155 _ObjectManagerImpl* __pObjectManagerImpl;
157 friend class _ObjectManagerT <T>;
162 #endif // _FBASE_RT_INTERNAL_HANDLE_TEMPLATE_H_