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;
37 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
39 class PropertyValueTime {
41 AbstractPropertyType* value;
45 class AsyncPropertyRequest
48 AsyncPropertyRequest()
49 :property(VehicleProperty::NoValue)
54 AsyncPropertyRequest(const AsyncPropertyRequest &request)
56 this->property = request.property;
57 this->completed = request.completed;
60 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
62 this->property = other.property;
63 this->completed = other.completed;
68 VehicleProperty::Property property;
69 GetPropertyCompletedSignal completed;
72 class AsyncPropertyReply: public AsyncPropertyRequest
75 AsyncPropertyReply(const AsyncPropertyRequest &request)
76 :AsyncPropertyRequest(request), value(NULL), success(false)
81 AbstractPropertyType* value;
85 class AsyncSetPropertyRequest: public AsyncPropertyRequest
88 AsyncSetPropertyRequest()
94 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
95 :AsyncPropertyRequest(request), value(NULL)
100 AbstractPropertyType* value;
103 class AsyncRangePropertyRequest: public AsyncPropertyRequest
106 AsyncRangePropertyRequest()
112 AsyncRangePropertyRequest(const AsyncPropertyRequest &request)
113 :AsyncPropertyRequest(request), begin(0), end(0)
115 this->property = request.property;
116 this->completed = request.completed;
119 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
120 :AsyncPropertyRequest(request)
122 this->property = request.property;
123 this->completed = request.completed;
124 this->begin = request.begin;
125 this->end = request.end;
132 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
135 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
136 :AsyncRangePropertyRequest(request)
141 std::list<PropertyValueTime*> values;
144 class AbstractRoutingEngine
147 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
148 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
149 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
152 virtual void registerSink(AbstractSink* self) = 0;
153 virtual void unregisterSink(AbstractSink* self) = 0;
154 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
155 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
156 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
157 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
158 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
159 virtual PropertyList supported() = 0;
162 #endif // ABSTRACTROUTINGENGINE_H