2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 FUiEffects_RendererSystemSmartPtrRefCounterHandlerAtomic.h
20 * @brief The SmartPtrRefCounterHandlerAtomic template
24 #ifndef _FUI_EFFECTS_INTERNAL_RENDERER_SYSTEM_SMARTPTR_REFCOUNTER_HANDLER_ATOMIC_H_
25 #define _FUI_EFFECTS_INTERNAL_RENDERER_SYSTEM_SMARTPTR_REFCOUNTER_HANDLER_ATOMIC_H_
27 #include <renderer/system/FUiEffects_RendererSystemSmartPtrRefCounter.h>
29 namespace Tizen { namespace Ui { namespace Effects { namespace _Renderer { namespace System
32 class SmartPtrRefCounterHandlerAtomic
35 typedef long CounterType;
36 typedef SmartPtrRefCounter<CounterType> CounterData;
38 static inline CounterData* NewCounter(void);
39 static inline void DeleteCounter(CounterData* pCounterData);
41 static inline CounterType IncrementUse(CounterData* pCounterData);
42 static inline CounterType DecrementUse(CounterData* pCounterData);
44 static inline CounterType IncrementOwner(CounterData* pCounterData);
45 static inline CounterType DecrementOwner(CounterData* pCounterData);
49 inline SmartPtrRefCounterHandlerAtomic::CounterData* SmartPtrRefCounterHandlerAtomic::NewCounter(void)
51 return new (std::nothrow) CounterData;
54 inline void SmartPtrRefCounterHandlerAtomic::DeleteCounter(CounterData* pCounterData)
56 if (pCounterData != null)
62 inline SmartPtrRefCounterHandlerAtomic::CounterType SmartPtrRefCounterHandlerAtomic::IncrementUse(CounterData* pCounterData)
64 return ++(pCounterData->useCount);
67 inline SmartPtrRefCounterHandlerAtomic::CounterType SmartPtrRefCounterHandlerAtomic::DecrementUse(CounterData* pCounterData)
69 return --(pCounterData->useCount);
72 inline SmartPtrRefCounterHandlerAtomic::CounterType SmartPtrRefCounterHandlerAtomic::IncrementOwner(CounterData* pCounterData)
74 return ++(pCounterData->ownerCount);
77 inline SmartPtrRefCounterHandlerAtomic::CounterType SmartPtrRefCounterHandlerAtomic::DecrementOwner(CounterData* pCounterData)
79 return --(pCounterData->ownerCount);
82 }}}}} //Tizen::Ui::Effects::_Renderer::System
84 #endif //_FUI_EFFECTS_INTERNAL_RENDERER_SYSTEM_SMARTPTR_REFCOUNTER_HANDLER_ATOMIC_H_