2 Copyright (C) 2012 Intel Corporation
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef ABSTRACTROUTINGENGINE_H
21 #define ABSTRACTROUTINGENGINE_H
23 #include <sys/types.h>
25 #include <boost/any.hpp>
30 #include "vehicleproperty.h"
31 #include "abstractpropertytype.h"
35 class AsyncPropertyReply;
36 class AsyncRangePropertyReply;
39 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
40 typedef std::function<void (AsyncRangePropertyReply*)> GetRangedPropertyCompletedSignal;
42 class AsyncPropertyRequest
45 AsyncPropertyRequest()
46 :property(VehicleProperty::NoValue)
51 AsyncPropertyRequest(const AsyncPropertyRequest &request)
53 this->property = request.property;
54 this->completed = request.completed;
55 this->sourceUuid = request.sourceUuid;
58 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
60 this->property = other.property;
61 this->completed = other.completed;
62 this->sourceUuid = other.sourceUuid;
67 VehicleProperty::Property property;
68 std::string sourceUuid;
69 GetPropertyCompletedSignal completed;
72 class AsyncPropertyReply: public AsyncPropertyRequest
75 AsyncPropertyReply(const AsyncPropertyRequest &request)
76 :AsyncPropertyRequest(request), value(NULL), success(false)
82 AbstractPropertyType* value;
86 class AsyncSetPropertyRequest: public AsyncPropertyRequest
89 AsyncSetPropertyRequest()
95 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
96 :AsyncPropertyRequest(request), value(NULL)
101 AbstractPropertyType* value;
104 class AsyncRangePropertyRequest
107 AsyncRangePropertyRequest()
108 :timeBegin(0), timeEnd(0), sequenceBegin(-1), sequenceEnd(-1)
113 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
116 this->property = request.property;
117 this->completed = request.completed;
118 this->timeBegin = request.timeBegin;
119 this->timeEnd = request.timeEnd;
120 this->sequenceBegin = request.sequenceBegin;
121 this->sequenceEnd = request.sequenceEnd;
122 this->sourceUuid = request.sourceUuid;
125 VehicleProperty::Property property;
126 std::string sourceUuid;
127 GetRangedPropertyCompletedSignal completed;
130 int32_t sequenceBegin;
134 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
137 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
138 :AsyncRangePropertyRequest(request), success(false)
143 ~AsyncRangePropertyReply()
145 for(auto itr = values.begin(); itr != values.end(); itr++)
153 std::list<AbstractPropertyType*> values;
157 class AbstractRoutingEngine
160 virtual ~AbstractRoutingEngine();
162 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
163 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
164 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid) = 0;
167 virtual void registerSink(AbstractSink* self) = 0;
168 virtual void unregisterSink(AbstractSink* self) = 0;
169 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
170 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
171 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
172 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
173 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
174 virtual PropertyList supported() = 0;
177 #endif // ABSTRACTROUTINGENGINE_H