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 <boost/any.hpp>
26 #include "vehicleproperty.h"
27 #include "abstractpropertytype.h"
31 class AsyncPropertyReply;
34 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
36 class PropertyValueTime {
38 AbstractPropertyType* value;
42 class AsyncPropertyRequest
45 AsyncPropertyRequest()
46 :property(VehicleProperty::NoValue)
51 AsyncPropertyRequest(const AsyncPropertyRequest &request)
53 this->property = request.property;
54 this->completed = request.completed;
57 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
59 this->property = other.property;
60 this->completed = other.completed;
65 VehicleProperty::Property property;
66 GetPropertyCompletedSignal completed;
69 class AsyncPropertyReply: public AsyncPropertyRequest
72 AsyncPropertyReply(const AsyncPropertyRequest &request)
73 :AsyncPropertyRequest(request), value(NULL), success(false)
78 AbstractPropertyType* value;
82 class AsyncSetPropertyRequest: public AsyncPropertyRequest
85 AsyncSetPropertyRequest()
91 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
92 :AsyncPropertyRequest(request), value(NULL)
97 AbstractPropertyType* value;
100 class AsyncRangePropertyRequest: public AsyncPropertyRequest
103 AsyncRangePropertyRequest()
109 AsyncRangePropertyRequest(const AsyncPropertyRequest &request)
110 :AsyncPropertyRequest(request), begin(0), end(0)
112 this->property = request.property;
113 this->completed = request.completed;
116 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
117 :AsyncPropertyRequest(request)
119 this->property = request.property;
120 this->completed = request.completed;
121 this->begin = request.begin;
122 this->end = request.end;
129 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
132 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
133 :AsyncRangePropertyRequest(request)
138 std::list<PropertyValueTime*> values;
141 class AbstractRoutingEngine
144 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
145 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
146 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
149 virtual void registerSink(AbstractSink* self) = 0;
150 virtual void unregisterSink(AbstractSink* self) = 0;
151 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
152 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
153 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
154 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
155 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
156 virtual PropertyList supported() = 0;
159 #endif // ABSTRACTROUTINGENGINE_H