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 {
43 AbstractPropertyType* value;
47 class AsyncPropertyRequest
50 AsyncPropertyRequest()
51 :property(VehicleProperty::NoValue)
56 AsyncPropertyRequest(const AsyncPropertyRequest &request)
58 this->property = request.property;
59 this->completed = request.completed;
62 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
64 this->property = other.property;
65 this->completed = other.completed;
70 VehicleProperty::Property property;
71 GetPropertyCompletedSignal completed;
74 class AsyncPropertyReply: public AsyncPropertyRequest
77 AsyncPropertyReply(const AsyncPropertyRequest &request)
78 :AsyncPropertyRequest(request), value(NULL), success(false)
83 AbstractPropertyType* value;
87 class AsyncSetPropertyRequest: public AsyncPropertyRequest
90 AsyncSetPropertyRequest()
96 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
97 :AsyncPropertyRequest(request), value(NULL)
102 AbstractPropertyType* value;
105 class AsyncRangePropertyRequest
108 AsyncRangePropertyRequest()
114 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
117 this->property = request.property;
118 this->completed = request.completed;
119 this->begin = request.begin;
120 this->end = request.end;
123 VehicleProperty::Property property;
124 GetRangedPropertyCompletedSignal completed;
129 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
132 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
133 :AsyncRangePropertyRequest(request), success(false)
138 std::list<PropertyValueTime*> values;
142 class AbstractRoutingEngine
145 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
146 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
147 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value) = 0;
150 virtual void registerSink(AbstractSink* self) = 0;
151 virtual void unregisterSink(AbstractSink* self) = 0;
152 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
153 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
154 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
155 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
156 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
157 virtual PropertyList supported() = 0;
160 #endif // ABSTRACTROUTINGENGINE_H