8a756904ad5ac2ee473126b46ad064256044bf56
[platform/framework/native/appfw.git] / src / app / inc / FApp_AppManagerEventParamTraits.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file                FIo_IpcCommonParamTraits.h
19  * @brief               This is the header file for common param traits.
20  */
21
22 #ifndef _FAPP_INTERNAL_APPMANAGER_EVENT_ARG_PARAM_TRAITS_H_
23 #define _FAPP_INTERNAL_APPMANAGER_EVENT_ARG_PARAM_TRAITS_H_
24
25 #include "FBaseString.h"
26 #include "FBaseColIList.h"
27 #include "FBaseColArrayList.h"
28 #include "FIo_IpcCommonDataTypes.h"
29
30 #include "base/tuple.h"
31 #include "ipc/ipc_param_traits.h"
32
33 #include "FApp_AppManagerEventArg.h"
34
35
36 //namespace Tizen { namespace App { class _AppManagerEventArg; } }
37
38 namespace IPC
39 {
40 template <>
41 struct ParamTraits<Tizen::App::_AppManagerEventArg>
42 {
43         typedef Tizen::App::_AppManagerEventArg param_type;
44
45         static void Write(Message* m, const param_type& p)
46         {
47                 WriteParam(m, p.GetAppId());
48                 m->WriteInt(p.GetAppType());
49                 m->WriteInt(p.GetEventType());
50         }
51
52         static bool Read(const Message* m, void** iter, param_type* r)
53         {
54                 Tizen::App::AppId appId;
55                 int appType = Tizen::App::_APP_TYPE_UI_APP;
56                 int eventType = Tizen::App::_AppManagerEvent::_APP_MANAGER_EVENT_INVALID;
57
58                 if (!ReadParam(m, iter, &appId))
59                 {
60                         return false;
61                 }
62                 m->ReadInt(iter, &appType);
63                 m->ReadInt(iter, &eventType);
64
65                 Tizen::App::_AppManagerEventArg arg(appId, static_cast<Tizen::App::_AppType>(appType), static_cast<Tizen::App::_AppManagerEvent::_Type>(eventType));
66                 *r = arg;
67
68                 return true;
69         }
70
71         static void Log(const param_type& p, std::string* l)
72         {
73         }
74 };
75 }
76
77 #endif //_FAPP_INTERNAL_APPMANAGER_EVENT_ARG_PARAM_TRAITS_H_