tizen 2.4 release
[framework/context/context-common.git] / include / provider_iface.h
1 /*
2  * Copyright (c) 2015 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 #ifndef __CONTEXT_PROVIDER_INTERFACE_H__
18 #define __CONTEXT_PROVIDER_INTERFACE_H__
19
20 namespace ctx {
21
22         /* Forward Declaration */
23         class json;
24
25         class context_provider_iface {
26         public:
27                 virtual ~context_provider_iface() {}
28                 virtual int subscribe(const char *subject, ctx::json option, ctx::json *request_result);
29                 virtual int unsubscribe(const char *subject, ctx::json option);
30                 virtual int read(const char *subject, ctx::json option, ctx::json *request_result);
31                 virtual int write(const char *subject, ctx::json data, ctx::json *request_result);
32
33         protected:
34                 context_provider_iface() {}
35
36         };      /* class context_provider_iface */
37
38         class context_provider_info {
39                 typedef context_provider_iface *(*creator_t)(void *data);
40                 typedef void (*destroyer_t)(void *data);
41
42         public:
43                 creator_t create;
44                 destroyer_t destroy;
45                 void *data;
46                 const char *privilege;
47
48                 context_provider_info();
49                 context_provider_info(creator_t cr, destroyer_t des, void *dat = NULL, const char *priv = NULL);
50         };
51
52 }       /* namespace ctx */
53
54 #endif  /* End of __CONTEXT_PROVIDER_INTERFACE_H__ */