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
23 #include "abstractsink.h"
24 #include "abstractsource.h"
25 #include "abstractroutingengine.h"
27 #include <unordered_map>
30 class Core: public AbstractRoutingEngine
38 void setSupported(PropertyList supported, AbstractSource* source);
39 void updateSupported(PropertyList added, PropertyList removed, AbstractSource* source);
40 void updateProperty(AbstractPropertyType* value, const std::string &uuid);
44 void registerSink(AbstractSink *self);
45 void unregisterSink(AbstractSink *self);
46 AsyncPropertyReply* getPropertyAsync(AsyncPropertyRequest request);
47 AsyncRangePropertyReply* getRangePropertyAsync(AsyncRangePropertyRequest request);
48 AsyncPropertyReply * setProperty(AsyncSetPropertyRequest request);
49 void subscribeToProperty(VehicleProperty::Property, AbstractSink* self);
50 void subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, AbstractSink *self);
51 void subscribeToProperty(VehicleProperty::Property, std::string sourceUuidFilter, Zone::Type zoneFilter, AbstractSink *self);
52 void unsubscribeToProperty(VehicleProperty::Property, AbstractSink* self);
53 PropertyList supported();
55 PropertyInfo getPropertyInfo(VehicleProperty::Property, std::string sourceUuid);
56 std::list<std::string> sourcesForProperty(VehicleProperty::Property property);
59 Performance(): propertiesPerSecond(0), firedPropertiesPerSecond(0) {}
60 int propertiesPerSecond;
61 int firedPropertiesPerSecond;
66 void handleAddSupported(const PropertyList& added, AbstractSource* source);
67 void handleRemoveSupported(const PropertyList& removed, AbstractSource* source);
68 AbstractSource* sourceForProperty(const VehicleProperty::Property& property, const std::string& sourceUuidFilter = "") const;
71 std::multimap<AbstractSource*, VehicleProperty::Property> mMasterPropertyList;
73 // K = AbstractSource::uuid(), T = AbstractSource*
74 std::map<std::string, AbstractSource*> mSources;
75 std::set<AbstractSink*> mSinks;
77 Performance performance;
79 std::unordered_map<VehicleProperty::Property, std::set<AbstractSink*> > propertySinkMap;
81 // std::string here is AbstractSource::uuid()
82 std::map<AbstractSink*, std::map<VehicleProperty::Property, std::string> > filteredSourceSinkMap;