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_QUEUE_H__
18 #define __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__
31 virtual int push(command *c) = 0;
32 virtual command *pop(plugin::plugin_s *p) = 0;
33 virtual void process(plugin::plugin_s *p) = 0;
34 virtual void clear(plugin::plugin_s *p) = 0;
36 static command_queue *interface();
37 static bool is_async()
43 class command_queue_sync:public command_queue
49 virtual ~command_queue_sync()
53 virtual int push(command *c);
54 virtual command *pop(plugin::plugin_s *p);
55 virtual void process(plugin::plugin_s *p);
56 virtual void clear(plugin::plugin_s *p);
58 friend class command_queue;
62 * This is the implementation of asynchronous queue.
63 * In order to pass code coverage tests it is blocked.
65 #ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
66 class command_queue_async:public command_queue
72 virtual ~command_queue_async()
76 virtual int push(command *c);
77 virtual command *pop(plugin::plugin_s *p);
78 virtual void process(plugin::plugin_s *p);
79 virtual void clear(plugin::plugin_s *p);
81 friend class command_queue;
85 * This queue is intended to process mainly the commands, assigned to
88 class command_queue_view : public command_queue
94 virtual ~command_queue_view()
98 static command_queue* interface();
100 virtual int push(command *c);
101 virtual command *pop(plugin::plugin_s *p);
102 virtual void process(plugin::plugin_s *p);
103 virtual void clear(plugin::plugin_s *p);
105 friend class command_queue;
107 static gint iterate(gconstpointer a,
117 queue_autoref(GAsyncQueue *async_queue) : q(async_queue)
119 g_async_queue_ref(q);
123 g_async_queue_unref(q);
126 #endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
131 #endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */