automotive-message-broker  0.12
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
abstractsource.h
1 /*
2  Copyright (C) 2012 Intel Corporation
3 
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.
8 
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.
13 
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
17 */
18 
19 
20 #ifndef ABSTRACTSOURCE_H
21 #define ABSTRACTSOURCE_H
22 
23 #include <string>
24 #include <list>
25 #include <boost/any.hpp>
26 
27 #include "abstractsink.h"
28 #include "vehicleproperty.h"
29 #include "abstractroutingengine.h"
30 #include "abstractpropertytype.h"
31 #include "propertyinfo.hpp"
32 
33 
34 
35 class AbstractSource;
36 
37 typedef std::list<AbstractSource*> SourceList;
38 
39 
40 
42 {
43 
44 public:
48  enum Operations {
49  Get = 0x01,
50  Set = 0x02,
51  GetRanged = 0x04
52  };
53 
54  AbstractSource(AbstractRoutingEngine* engine, map<string, string> config);
55  virtual ~AbstractSource();
56 
58 
64  virtual void getPropertyAsync(AsyncPropertyReply *reply) = 0;
65 
72  virtual void getRangePropertyAsync(AsyncRangePropertyReply *reply) = 0;
73 
81 
88  virtual void subscribeToPropertyChanges(VehicleProperty::Property property) = 0;
89 
95  virtual void unsubscribeToPropertyChanges(VehicleProperty::Property property) = 0;
96 
101  virtual int supportedOperations() = 0;
102 
109  virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property & property);
110 
115  virtual PropertyList supported() = 0;
116 
117 protected:
123 
124 private:
125  AbstractSource():AbstractSink(nullptr, std::map<std::string,std::string>()) { }
126 };
127 
128 #endif // ABSTRACTSOURCE_H
virtual void unsubscribeToPropertyChanges(VehicleProperty::Property property)=0
unsubscribeToPropertyChanges is called when a sink requests to unsubscribe from a given property's ch...
Definition: abstractroutingengine.h:323
Operations
The Operations enum is a bitmask flag used to specify which operations are supported by the source pl...
Definition: abstractsource.h:48
virtual PropertyList supported()=0
supported
AbstractRoutingEngine * routingEngine
routingEngine the core routing engine used to send property updates to sink plugins.
Definition: abstractsource.h:122
virtual void subscribeToPropertyChanges(VehicleProperty::Property property)=0
subscribeToPropertyChanges is called when a sink requests a subscription. Source plugins can keep tra...
virtual PropertyInfo getPropertyInfo(const VehicleProperty::Property &property)
getPropertyInfo used to return specific information about a property
Definition: abstractsource.cpp:34
virtual void getPropertyAsync(AsyncPropertyReply *reply)=0
pure virtual methods:
The AsyncPropertyReply class is used by sources to reply to Get and Set operations. The source should set success to true if the call is successful or 'false' if the request was not successful and set 'error' to the appropriate error.
Definition: abstractroutingengine.h:123
The AsyncSetPropertyRequest class is used by sinks to set a property to the 'value'. The source will reply with a AsyncPropertyReply containing the new value or an error.
Definition: abstractroutingengine.h:179
Definition: propertyinfo.hpp:7
The AsyncRangePropertyReply class is used by a source to reply to an AsyncRangePropertyRequest. the source should set success to 'true' and populate the 'values' member if the request was successful. If the request is not successful, 'success' should be set to 'false' and the 'error' member should be set.
Definition: abstractroutingengine.h:288
Definition: abstractsink.h:40
virtual AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request)=0
setProperty is called when a sink requests to set a value for a given property. This is only called i...
virtual void getRangePropertyAsync(AsyncRangePropertyReply *reply)=0
getRangePropertyAsync is called when a sink requests a series of values for a given property within a...
virtual int supportedOperations()=0
supportedOperations
Definition: abstractsource.h:41