2 * Copyright (c) 2014 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 #ifndef __MAPS_SERVICE_SESSION_COMMAND_H__
18 #define __MAPS_SERVICE_SESSION_COMMAND_H__
20 #include "maps_plugin.h"
26 /*----------------------------------------------------------------------------*/
35 static volatile int command_request_id;
37 static command empty_instance;
41 } /* Please, do not construct an empty object */
43 command(maps_service_h ms);
44 command(const command &src);
46 command & operator=(const command &src);
51 static command *empty_ptr()
53 return &empty_instance;
56 plugin::interface_s *interface() const;
57 maps_plugin_h handle() const;
59 plugin::plugin_s *plugin()const;
62 /*----------------------------------------------------------------------------*/
66 plugin::plugin_s *plg;
72 command_handler(plugin::plugin_s *plugin, void *user_data,
74 virtual ~command_handler();
76 command_handler() : plg(NULL), user_data(NULL),
77 user_req_id(-1), plg_req_id(-1)
80 command_handler(const command_handler &src) : plg(NULL),
81 user_data(NULL), user_req_id(-1), plg_req_id(-1)
84 command_handler &operator=(const command_handler &src)
89 plugin::plugin_s *plugin()const
94 static void destroy(void *p);
97 /*----------------------------------------------------------------------------*/
102 plugin::plugin_s *plg;
104 pending_request(plugin::plugin_s *plugin);
105 virtual ~pending_request()
109 pending_request() : plg(NULL) {
111 pending_request(const pending_request &src)
114 pending_request &operator=(const pending_request &src)
119 bool add(const int user_req_id);
120 void update(int user_req_id, command_handler *handler);
121 void remove(int user_req_id);
122 command_handler *look_up(const int user_req_id);
123 int extract_plg_id(const int user_req_id);
124 bool contains(const int user_req_id);
126 int *int_dup(const int n);
130 #endif /* __MAPS_SERVICE_SESSION_COMMAND_H__ */