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__
30 virtual int push(command *c) = 0;
31 virtual command *pop(plugin::plugin_s *p) = 0;
32 virtual void process(plugin::plugin_s *p) = 0;
33 virtual void clear(plugin::plugin_s *p) = 0;
35 static command_queue *interface();
36 static bool is_async()
42 class command_queue_sync:public command_queue
48 virtual ~command_queue_sync()
52 virtual int push(command *c);
53 virtual command *pop(plugin::plugin_s *p);
54 virtual void process(plugin::plugin_s *p);
55 virtual void clear(plugin::plugin_s *p);
57 friend class command_queue;
61 * This is the implementation of asynchronous queue.
62 * In order to pass code coverage tests it is blocked.
64 #ifdef _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_
65 class command_queue_async:public command_queue
71 virtual ~command_queue_async()
75 virtual int push(command *c);
76 virtual command *pop(plugin::plugin_s *p);
77 virtual void process(plugin::plugin_s *p);
78 virtual void clear(plugin::plugin_s *p);
80 friend class command_queue;
84 * This queue is intended to process mainly the commands, assigned to
87 class command_queue_view : public command_queue
93 virtual ~command_queue_view()
97 static command_queue* interface();
99 virtual int push(command *c);
100 virtual command *pop(plugin::plugin_s *p);
101 virtual void process(plugin::plugin_s *p);
102 virtual void clear(plugin::plugin_s *p);
104 friend class command_queue;
106 static gint iterate(gconstpointer a,
116 queue_autoref(GAsyncQueue *async_queue) : q(async_queue)
118 g_async_queue_ref(q);
122 g_async_queue_unref(q);
125 #endif /* _MAPS_SERVICE_SUPPORTS_ASYNC_QUEUE_ */
129 #endif /* __MAPS_SERVICE_SESSION_COMMAND_QUEUE_H__ */