Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Attributes | List of all members
CommunicatorFactory Class Referenceabstract

A Factory for the communicators. More...

#include <communicatorfactory.h>

Inheritance diagram for CommunicatorFactory:
Inheritance graph
[legend]

Public Types

typedef Communicator *(* CommunicatorConstructFunc) ()
 The typedef of the communicator constructor function. More...
 
typedef unsigned int CommunicatorTypeId
 The typedef of the communicator type ID. More...
 
typedef bool(* PortInfoMatchFunc) (const XsPortInfo &)
 The typedef of the port info match function. More...
 

Public Member Functions

 CommunicatorFactory ()
 Create the factory. More...
 
Communicatorcreate (const XsPortInfo &portInfo) const
 Create a communicator based on a port info. More...
 
Communicatorcreate (const XsString &filename) const
 Create a communicator based on a filename. More...
 
virtual CommunicatorTypeId filenameToCommunicatorId (const XsString &filename) const =0
 Match a filename to a communicator. More...
 
virtual CommunicatorTypeId portInfoToCommunicatorId (const XsPortInfo &portInfo) const =0
 Match a XsPortInfo to a communicator. More...
 
virtual void registerCommunicatorTypes ()
 Registrates communicator types. More...
 
bool registerType (CommunicatorTypeId typeId, CommunicatorConstructFunc constructFunc, PortInfoMatchFunc matchFunc)
 Register a communicator type with the factory. More...
 
virtual ~CommunicatorFactory ()
 Destory the factory. More...
 

Static Public Member Functions

template<typename T >
static std::unique_ptr< T > createFactory ()
 Create a new CommunicatorFactory and register its basic types. More...
 

Protected Types

typedef std::map< CommunicatorTypeId, std::pair< CommunicatorConstructFunc, PortInfoMatchFunc > > ConstructorsMap
 The typedef of a map for a communicator type ID and constructors map. More...
 

Protected Member Functions

virtual Communicatorconstruct (CommunicatorTypeId communicator) const
 Construct a communicator based on typeId. More...
 
ConstructorsMap const & constructors () const
 

Private Attributes

ConstructorsMap m_constructors
 

Detailed Description

A Factory for the communicators.

Definition at line 80 of file communicatorfactory.h.

Member Typedef Documentation

◆ CommunicatorConstructFunc

typedef Communicator*(* CommunicatorFactory::CommunicatorConstructFunc) ()

The typedef of the communicator constructor function.

Definition at line 101 of file communicatorfactory.h.

◆ CommunicatorTypeId

The typedef of the communicator type ID.

Definition at line 98 of file communicatorfactory.h.

◆ ConstructorsMap

The typedef of a map for a communicator type ID and constructors map.

Definition at line 128 of file communicatorfactory.h.

◆ PortInfoMatchFunc

typedef bool(* CommunicatorFactory::PortInfoMatchFunc) (const XsPortInfo &)

The typedef of the port info match function.

Definition at line 104 of file communicatorfactory.h.

Constructor & Destructor Documentation

◆ CommunicatorFactory()

CommunicatorFactory::CommunicatorFactory ( )

Create the factory.

Definition at line 69 of file communicatorfactory.cpp.

◆ ~CommunicatorFactory()

CommunicatorFactory::~CommunicatorFactory ( )
virtual

Destory the factory.

Definition at line 75 of file communicatorfactory.cpp.

Member Function Documentation

◆ construct()

Communicator * CommunicatorFactory::construct ( CommunicatorTypeId  communicator) const
protectedvirtual

Construct a communicator based on typeId.

Definition at line 104 of file communicatorfactory.cpp.

◆ constructors()

ConstructorsMap const& CommunicatorFactory::constructors ( ) const
inlineprotected
Returns
A constant reference to the constructors map

Definition at line 131 of file communicatorfactory.h.

◆ create() [1/2]

Communicator * CommunicatorFactory::create ( const XsPortInfo portInfo) const

Create a communicator based on a port info.

Definition at line 88 of file communicatorfactory.cpp.

◆ create() [2/2]

Communicator * CommunicatorFactory::create ( const XsString filename) const

Create a communicator based on a filename.

Definition at line 96 of file communicatorfactory.cpp.

◆ createFactory()

template<typename T >
static std::unique_ptr<T> CommunicatorFactory::createFactory ( )
inlinestatic

Create a new CommunicatorFactory and register its basic types.

Returns
A unique pointer to the created factory

Definition at line 87 of file communicatorfactory.h.

◆ filenameToCommunicatorId()

virtual CommunicatorTypeId CommunicatorFactory::filenameToCommunicatorId ( const XsString filename) const
pure virtual

Match a filename to a communicator.

Parameters
filenameA name of file
Returns
A communicator type ID

Implemented in XdaCommunicatorFactory.

◆ portInfoToCommunicatorId()

virtual CommunicatorTypeId CommunicatorFactory::portInfoToCommunicatorId ( const XsPortInfo portInfo) const
pure virtual

Match a XsPortInfo to a communicator.

Parameters
portInfoAn information about the port
Returns
A communicator type ID

Implemented in XdaCommunicatorFactory.

◆ registerCommunicatorTypes()

virtual void CommunicatorFactory::registerCommunicatorTypes ( )
inlinevirtual

Registrates communicator types.

Reimplemented in XdaCommunicatorFactory.

Definition at line 124 of file communicatorfactory.h.

◆ registerType()

bool CommunicatorFactory::registerType ( CommunicatorTypeId  typeId,
CommunicatorConstructFunc  constructFunc,
PortInfoMatchFunc  matchFunc 
)

Register a communicator type with the factory.

Definition at line 81 of file communicatorfactory.cpp.

Member Data Documentation

◆ m_constructors

ConstructorsMap CommunicatorFactory::m_constructors
private

Definition at line 138 of file communicatorfactory.h.


The documentation for this class was generated from the following files:


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:21