2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 * @file model_bind_to_dao.h
18 * @author Grzegorz Krawczyk (g.krawczyk@samsung.com)
23 #ifndef DPL_MODEL_BIND_TO_DAO_H_
24 #define DPL_MODEL_BIND_TO_DAO_H_
32 * @param ObjectType type of object used as delegate argument
33 * @param RetType Type returned from the external function
34 * @param ExtArg Type of argument required by external fun
35 * @param getterFun Object Type method which returns value of type ExtArg
36 * used as argument for external function
43 ExtArg(ObjectType::*argGetter) () const,
44 ValueType(*externalGetter) (ExtArg)
46 struct BindToDAO_Static
48 static ValueType Get(DPL::Event::Model* obj)
50 ObjectType* instance = static_cast<ObjectType*>(obj);
52 return externalGetter((instance->*argGetter)());
61 ExtArg(ObjectType::*argGetter) () const,
62 ValueType(ExtObject::*externalGetter) () const
66 static ValueType Get(DPL::Event::Model* obj)
68 ObjectType* instance = static_cast<ObjectType*>(obj);
69 ExtObject extObject((instance->*argGetter)());
70 return (extObject.*externalGetter)();