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 /*----------------------------------------------------------------------------*/
37 static volatile int command_request_id;
39 static command empty_instance;
46 } /* Please, do not construct an empty object */
48 command(maps_service_h ms);
49 command(const command &src);
51 command & operator=(const command &src);
56 static command *empty_ptr()
58 return &empty_instance;
61 plugin::interface_s *interface() const;
62 maps_plugin_h handle() const;
64 plugin::plugin_s *plugin()const;
67 /*----------------------------------------------------------------------------*/
71 plugin::plugin_s *plg;
77 command_handler(plugin::plugin_s *plugin, void *user_data,
79 virtual ~command_handler();
81 command_handler() : plg(NULL), user_data(NULL),
82 user_req_id(-1), plg_req_id(-1)
85 command_handler(const command_handler &src) : plg(NULL),
86 user_data(NULL), user_req_id(-1), plg_req_id(-1)
89 command_handler &operator=(const command_handler &src)
94 plugin::plugin_s *plugin()const
99 static void destroy(void *p);
102 /*----------------------------------------------------------------------------*/
104 class pending_request
107 plugin::plugin_s *plg;
109 pending_request(plugin::plugin_s *plugin);
110 virtual ~pending_request()
114 pending_request() : plg(NULL) {
116 pending_request(const pending_request &src)
119 pending_request &operator=(const pending_request &src)
124 bool add(const int user_req_id);
125 void update(int user_req_id, command_handler *handler);
126 void remove(int user_req_id);
127 command_handler *look_up(const int user_req_id);
128 int extract_plg_id(const int user_req_id);
129 bool contains(const int user_req_id);
131 int *int_dup(const int n);
135 #endif /* __MAPS_SERVICE_SESSION_COMMAND_H__ */