Tizen 2.1 base
[framework/osp/uifw.git] / src / ui / effects / FUiEffects_EffectManagerImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17 /**
18  * @file        FUiEffects_EffectManagerImpl.h
19  * @brief               This is the header file for the _EffectManagerImpl class
20  */
21
22 #ifndef _FUI_EFFECTS_INTERNAL_EFFECTS_MANAGER_IMPL_H_
23 #define _FUI_EFFECTS_INTERNAL_EFFECTS_MANAGER_IMPL_H_
24
25 #include <utility>
26 #include <unique_ptr.h>
27
28 namespace Tizen { namespace Base {
29 class String;
30 }} // Tizen::Base
31
32 namespace Tizen { namespace Ui { namespace Effects
33 {
34
35 class Effect;
36 class EffectManager;
37
38 class _EffectManagerImpl
39 {
40         typedef std::pair<EffectManager*, _EffectManagerImpl*> ManagerAndImplPair;
41 public:
42
43         /**
44          * Gets the effect manager instance.
45          *
46          * @since 2.0
47          *
48          * @return                      A pointer to the %EffectManager instance
49          * @exception           E_SUCCESS                          The %EffectManager instance is constructed successfully.
50          * @exception           E_OUT_OF_MEMORY            The memory is insufficient.
51          * @exception           E_OPERATION_FAILED         The system has failed to initialize the 3D system.
52          */
53          static ManagerAndImplPair GetInstance(void);
54
55         /**
56          * Destroys all previously created effects and their resources. @n
57          * Application can use OpenGL APIs only after invoking this method.
58          *
59          * @since 2.0
60          */
61          static void DestroyInstance(void);
62
63         /**
64          * Creates a new effect from specialised  effect file
65          *
66          * @since 2.0
67          *
68          * @return              If success - pointer to effect; if failed - null
69          * @param [in]  filePath                        The file path of the effect
70          * @exception   E_OUT_OF_MEMORY         Insufficient memory
71          * @exception   E_FILE_NOT_FOUND        The effect file specified doesn't exist
72          * @exception   E_PARSING_FAILED        Syntax Error in the effect file (structure or script)
73          * @see                 UnregisterEffectFile()
74          *
75          */
76         Effect* CreateEffect(const Tizen::Base::String& filePath);
77
78         /**
79          * Deletes an effect specified
80          *
81          * @since 2.0
82          *
83          * @return              An error code
84          * @param [in]  effect                  Reference to effect     to be destroyed
85          * @exception   E_SUCCESS               The effect specified was successfully destroyed
86          * @see                 RegisterEffectFile()
87          *
88          */
89         void DestroyEffect(Effect& effect);
90
91 private:
92         /**
93          * Constructor
94          *
95          * @since 2.0
96          *
97          * @exception   E_OUT_OF_MEMORY _EffectManagerImpl instance can not be created
98          *
99          */
100         _EffectManagerImpl(void);
101
102         /**
103          * Destructor for _EffectManagerImpl
104          *
105          * @since 2.0
106          *
107          *
108          */
109         ~_EffectManagerImpl(void);
110
111         static void InitSingleton(void);
112
113 private:
114
115         static const char* __pPathToEffectFile;
116
117         friend class _EffectImpl; // <-- for access to private area of class _EffectManagerImpl from class Effect
118         friend class boost::default_delete<_EffectManagerImpl>; //for deleting unique_ptr<_EffectManagerImpl> instance in InitSingleton function
119 };
120
121 } } } //Tizen::Ui::Effects
122
123 #endif // _FUI_EFFECTS_INTERNAL_EFFECTS_MANAGER_IMPL_H_