Go to the documentation of this file.
65 #ifndef COMMUNICATORFACTORY_H
66 #define COMMUNICATORFACTORY_H
89 auto factory = std::make_unique<T>();
90 factory->registerCommunicatorTypes();
128 typedef std::map<CommunicatorTypeId, std::pair<CommunicatorConstructFunc, PortInfoMatchFunc>>
ConstructorsMap;
virtual CommunicatorTypeId portInfoToCommunicatorId(const XsPortInfo &portInfo) const =0
Match a XsPortInfo to a communicator.
static std::unique_ptr< T > createFactory()
Create a new CommunicatorFactory and register its basic types.
static const CommunicatorFactory::CommunicatorTypeId INVALID
virtual void registerCommunicatorTypes()
Registrates communicator types.
A Factory for the communicators.
ConstructorsMap m_constructors
Communicator *(* CommunicatorConstructFunc)()
The typedef of the communicator constructor function.
virtual Communicator * construct(CommunicatorTypeId communicator) const
Construct a communicator based on typeId.
virtual CommunicatorTypeId filenameToCommunicatorId(const XsString &filename) const =0
Match a filename to a communicator.
unsigned int CommunicatorTypeId
The typedef of the communicator type ID.
A base struct for a communication interface.
virtual ~CommunicatorFactory()
Destory the factory.
std::map< CommunicatorTypeId, std::pair< CommunicatorConstructFunc, PortInfoMatchFunc > > ConstructorsMap
The typedef of a map for a communicator type ID and constructors map.
Contains a descriptor for opening a communication port to an Xsens device.
Communicator * create(const XsPortInfo &portInfo) const
Create a communicator based on a port info.
ConstructorsMap const & constructors() const
bool(* PortInfoMatchFunc)(const XsPortInfo &)
The typedef of the port info match function.
CommunicatorFactory()
Create the factory.
A 0-terminated managed string of characters.
bool registerType(CommunicatorTypeId typeId, CommunicatorConstructFunc constructFunc, PortInfoMatchFunc matchFunc)
Register a communicator type with the factory.