Tizen 2.0 Release
[framework/osp/media.git] / src / FMedia_CamPtrUtil.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0
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 /**
19  * @file                        FMedia_CamPtrUtil.h
20  * @brief               This header file contains the declarations of the pointer utility fuctions for the camera and recorder.
21  *
22  */
23
24 #ifndef _FMEDIA_INTERNAL_CAM_PTR_UTIL_H_
25 #define _FMEDIA_INTERNAL_CAM_PTR_UTIL_H_
26
27 #include <camera.h>
28 #include <FBaseColIList.h>
29 #include <FBaseColIListT.h>
30 #include <FGrpPixelFormat.h>
31 #include <FMediaTypes.h>
32 #include "FMedia_CameraTypes.h"
33
34 namespace Tizen { namespace Media
35 {
36
37 /**
38 * @class        _ListPtrUtil
39 * @brief        This class is utility for list pointer handling.
40 *
41 */
42 class _ListPtrUtil
43 {
44 public:
45         struct Remover
46         {
47                 void operator() (Tizen::Base::Collection::IListT<camera_pixel_format_e>* pList) const
48                 {
49                         if (pList != null)
50                         {
51                                 pList->RemoveAll();
52                                 delete pList;
53                         }
54                 }
55
56                 void operator() (Tizen::Base::Collection::IList* pList) const
57                 {
58                         if (pList != null)
59                         {
60                                 pList->RemoveAll(true);
61                                 delete pList;
62                         }
63                 }
64
65                 void operator() (Tizen::Base::Collection::IListT<int>* pList) const
66                 {
67                         if (pList != null)
68                         {
69                                 pList->RemoveAll();
70                                 delete pList;
71                         }
72                 }
73
74                 void operator() (Tizen::Base::Collection::IListT<Tizen::Graphics::PixelFormat>* pList) const
75                 {
76                         if (pList != null)
77                         {
78                                 pList->RemoveAll();
79                                 delete pList;
80                         }
81                 }
82
83                 void operator() (Tizen::Base::Collection::IListT<CodecType>* pList) const
84                 {
85                         if (pList != null)
86                         {
87                                 pList->RemoveAll();
88                                 delete pList;
89                         }
90                 }
91
92                 void operator() (Tizen::Base::Collection::IListT<MediaContainerType>* pList) const
93                 {
94                         if (pList != null)
95                         {
96                                 pList->RemoveAll();
97                                 delete pList;
98                         }
99                 }
100
101                 void operator() (Tizen::Base::Collection::IListT<_CameraDeviceType>* pList) const
102                 {
103                         if (pList != null)
104                         {
105                                 pList->RemoveAll();
106                                 delete pList;
107                         }
108                 }
109         };
110
111         static Remover remover;
112
113 private:
114         _ListPtrUtil(void);
115         ~_ListPtrUtil(void);
116
117         _ListPtrUtil(const _ListPtrUtil& rhs);
118         _ListPtrUtil& operator =(const _ListPtrUtil& rhs);
119 };
120
121 }}
122 #endif