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"
26 #include <boost/any.hpp>
29 #include "vehicleproperty.h"
30 #include "abstractpropertytype.h"
34 class AsyncPropertyReply;
35 class AsyncRangePropertyReply;
38 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
39 typedef std::function<void (AsyncRangePropertyReply*)> GetRangedPropertyCompletedSignal;
41 class PropertyValueTime {
48 AbstractPropertyType* value;
52 class AsyncPropertyRequest
55 AsyncPropertyRequest()
56 :property(VehicleProperty::NoValue)
61 AsyncPropertyRequest(const AsyncPropertyRequest &request)
63 this->property = request.property;
64 this->completed = request.completed;
67 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
69 this->property = other.property;
70 this->completed = other.completed;
75 VehicleProperty::Property property;
76 GetPropertyCompletedSignal completed;
79 class AsyncPropertyReply: public AsyncPropertyRequest
82 AsyncPropertyReply(const AsyncPropertyRequest &request)
83 :AsyncPropertyRequest(request), value(NULL), success(false)
88 AbstractPropertyType* value;
92 class AsyncSetPropertyRequest: public AsyncPropertyRequest
95 AsyncSetPropertyRequest()
101 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
102 :AsyncPropertyRequest(request), value(NULL)
107 AbstractPropertyType* value;
110 class AsyncRangePropertyRequest
113 AsyncRangePropertyRequest()
119 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
122 this->property = request.property;
123 this->completed = request.completed;
124 this->begin = request.begin;
125 this->end = request.end;
128 VehicleProperty::Property property;
129 GetRangedPropertyCompletedSignal completed;
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<PropertyValueTime*> values;
157 class AbstractRoutingEngine
160 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
161 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
162 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid, double timestamp, uint32_t sequence) = 0;
165 virtual void registerSink(AbstractSink* self) = 0;
166 virtual void unregisterSink(AbstractSink* self) = 0;
167 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
168 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
169 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
170 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
171 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
172 virtual PropertyList supported() = 0;
176 #endif // ABSTRACTROUTINGENGINE_H