6 #include <Poco/SharedPtr.h>
7 #include <Poco/Instantiator.h>
9 #include "util/Loggable.h"
10 #include "zwave/ZWaveMapperRegistry.h"
31 void setSpecMap(
const std::map<std::string, std::string> &specMap);
38 const uint16_t vendor;
39 const uint16_t product;
41 bool operator <(
const Spec &other)
const;
42 std::string toString()
const;
43 static Spec parse(
const std::string &input);
51 typedef Poco::SharedPtr<MapperInstantiator> Ptr;
55 virtual Mapper::Ptr create(
const ZWaveNode &node) = 0;
63 template <
typename MapperType>
66 Mapper::Ptr create(
const ZWaveNode &node)
override
68 return new MapperType(node.
id(), node.
product());
80 const std::string &name,
81 MapperInstantiator::Ptr instantiator);
84 typedef std::map<std::string, MapperInstantiator::Ptr> InstantiatorsMap;
85 InstantiatorsMap m_instantiators;
86 std::map<Spec, InstantiatorsMap::iterator> m_specMap;
SpecificZWaveMapperRegistry implements the method resolve() generically. The subclass of SpecificZWav...
Definition: SpecificZWaveMapperRegistry.h:20
ZWaveMapperRegistry is mostly intended to map Z-Wave specific data type hierarchy to BeeeOn ModuleTyp...
Definition: ZWaveMapperRegistry.h:22
void registerInstantiator(const std::string &name, MapperInstantiator::Ptr instantiator)
The subclass would call this method for each instantiator type it offers. The name of instantiator is...
Definition: SpecificZWaveMapperRegistry.cpp:94
std::string product() const
Definition: ZWaveNode.cpp:313
Specification of a Z-Wave node to match.
Definition: SpecificZWaveMapperRegistry.h:37
Instantiator of specific Mapper implementations.
Definition: SpecificZWaveMapperRegistry.h:49
Mapper::Ptr resolve(const ZWaveNode &node) override
Try to resolve a Mapper implementation suitable for the given Z-Wave node.
Definition: SpecificZWaveMapperRegistry.cpp:56
ZWaveNode represents information from the Z-Wave network about a particular node. Each Z-Wave node is...
Definition: ZWaveNode.h:22
Definition: Loggable.h:19
const Identity & id() const
Definition: ZWaveNode.cpp:278
void setSpecMap(const std::map< std::string, std::string > &specMap)
Set the spec mapping where the map key is a string in form: VENDOR:PRODUCT and the value is the name ...
Definition: SpecificZWaveMapperRegistry.cpp:71
Template implementation of MapperInstantiator creating MapperType instances having constructor specif...
Definition: SpecificZWaveMapperRegistry.h:64