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*)> CompletedSignal;
36 class AsyncPropertyRequest
39 AsyncPropertyRequest()
40 :property(VehicleProperty::NoValue)
45 AsyncPropertyRequest(const AsyncPropertyRequest &request)
47 this->property = request.property;
48 this->completed = request.completed;
51 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
53 this->property = other.property;
54 this->completed = other.completed;
59 VehicleProperty::Property property;
60 CompletedSignal completed;
63 class AsyncPropertyReply: public AsyncPropertyRequest
66 AsyncPropertyReply(const AsyncPropertyRequest &request)
67 :AsyncPropertyRequest(request), value(NULL)
72 AbstractPropertyType* value;
75 class AsyncRangePropertyRequest: public AsyncPropertyRequest
78 AsyncRangePropertyRequest()
84 AsyncRangePropertyRequest(const AsyncPropertyRequest &request)
85 :AsyncPropertyRequest(request), begin(0), end(0)
87 this->property = request.property;
88 this->completed = request.completed;
91 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
92 :AsyncPropertyRequest(request)
94 this->property = request.property;
95 this->completed = request.completed;
96 this->begin = request.begin;
97 this->end = request.end;
104 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
107 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
108 :AsyncRangePropertyRequest(request)
113 std::list<AbstractPropertyType*> values;
116 class AbstractRoutingEngine
119 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
120 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
121 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
124 virtual void registerSink(AbstractSink* self) = 0;
125 virtual void unregisterSink(AbstractSink* self) = 0;
126 virtual AsyncPropertyReply *getPropertyAsync(AsyncPropertyRequest request) = 0;
127 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
128 virtual void setProperty(VehicleProperty::Property, AbstractPropertyType*) = 0;
129 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
130 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
131 virtual PropertyList supported() = 0;
134 #endif // ABSTRACTROUTINGENGINE_H