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)
77 AbstractPropertyType* value;
81 class AsyncSetPropertyRequest: public AsyncPropertyRequest
84 AsyncSetPropertyRequest()
90 AsyncSetPropertyRequest(const AsyncPropertyRequest &request)
91 :AsyncPropertyRequest(request), value(NULL)
96 AbstractPropertyType* value;
99 class AsyncRangePropertyRequest
102 AsyncRangePropertyRequest()
103 :timeBegin(0), timeEnd(0), sequenceBegin(-1), sequenceEnd(-1)
108 AsyncRangePropertyRequest(const AsyncRangePropertyRequest &request)
111 this->property = request.property;
112 this->completed = request.completed;
113 this->timeBegin = request.timeBegin;
114 this->timeEnd = request.timeEnd;
115 this->sequenceBegin = request.sequenceBegin;
116 this->sequenceEnd = request.sequenceEnd;
119 VehicleProperty::Property property;
120 GetRangedPropertyCompletedSignal completed;
123 int32_t sequenceBegin;
127 class AsyncRangePropertyReply: public AsyncRangePropertyRequest
130 AsyncRangePropertyReply(AsyncRangePropertyRequest request)
131 :AsyncRangePropertyRequest(request), success(false)
136 ~AsyncRangePropertyReply()
138 for(auto itr = values.begin(); itr != values.end(); itr++)
146 std::list<AbstractPropertyType*> values;
150 class AbstractRoutingEngine
153 virtual void setSupported(PropertyList supported, AbstractSource* source) = 0;
154 virtual void updateSupported(PropertyList added, PropertyList removed) = 0;
155 virtual void updateProperty(VehicleProperty::Property property, AbstractPropertyType* value, std::string uuid) = 0;
158 virtual void registerSink(AbstractSink* self) = 0;
159 virtual void unregisterSink(AbstractSink* self) = 0;
160 virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request) = 0;
161 virtual AsyncRangePropertyReply * getRangePropertyAsync(AsyncRangePropertyRequest request) = 0;
162 virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request) = 0;
163 virtual void subscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
164 virtual void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self) = 0;
165 virtual PropertyList supported() = 0;
169 #endif // ABSTRACTROUTINGENGINE_H