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 AsyncPropertyRequest
44 AsyncPropertyRequest()
45 :property(VehicleProperty::NoValue)
50 AsyncPropertyRequest(const AsyncPropertyRequest &request)
52 this->property = request.property;
53 this->completed = request.completed;
56 AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
58 this->property = other.property;
59 this->completed = other.completed;
64 VehicleProperty::Property property;
65 GetPropertyCompletedSignal completed;
68 class AsyncPropertyReply: public AsyncPropertyRequest
71 AsyncPropertyReply(const AsyncPropertyRequest &request)
72 :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
103 AsyncRangePropertyRequest()
104 :timeBegin(0), timeEnd(0), sequenceBegin(-1), sequenceEnd(-1)
109 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
112 this->property = request.property;
113 this->completed = request.completed;
114 this->timeBegin = request.timeBegin;
115 this->timeEnd = request.timeEnd;
116 this->sequenceBegin = request.sequenceBegin;
117 this->sequenceEnd = request.sequenceEnd;
120 VehicleProperty::Property property;
121 GetRangedPropertyCompletedSignal completed;
124 int32_t sequenceBegin;
128 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
131 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
132 :AsyncRangePropertyRequest(request), success(false)
137 ~AsyncRangePropertyReply()
139 for(auto itr = values.begin(); itr != values.end(); itr++)
147 std::list<AbstractPropertyType*> values;
151 class AbstractRoutingEngine
154 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
155 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
156 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid) = 0;
159 virtual void registerSink(AbstractSink* self) = 0;
160 virtual void unregisterSink(AbstractSink* self) = 0;
161 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
162 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
163 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
164 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
165 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
166 virtual PropertyList supported() = 0;
170 #endif // ABSTRACTROUTINGENGINE_H