A Factory for the communicators. More...
#include <communicatorfactory.h>
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... | |
Communicator * | create (const XsPortInfo &portInfo) const |
Create a communicator based on a port info. More... | |
Communicator * | create (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 Communicator * | construct (CommunicatorTypeId communicator) const |
Construct a communicator based on typeId. More... | |
ConstructorsMap const & | constructors () const |
Private Attributes | |
ConstructorsMap | m_constructors |
A Factory for the communicators.
Definition at line 80 of file communicatorfactory.h.
typedef Communicator*(* CommunicatorFactory::CommunicatorConstructFunc) () |
The typedef of the communicator constructor function.
Definition at line 101 of file communicatorfactory.h.
typedef unsigned int CommunicatorFactory::CommunicatorTypeId |
The typedef of the communicator type ID.
Definition at line 98 of file communicatorfactory.h.
|
protected |
The typedef of a map for a communicator type ID and constructors map.
Definition at line 128 of file communicatorfactory.h.
typedef bool(* CommunicatorFactory::PortInfoMatchFunc) (const XsPortInfo &) |
The typedef of the port info match function.
Definition at line 104 of file communicatorfactory.h.
CommunicatorFactory::CommunicatorFactory | ( | ) |
Create the factory.
Definition at line 69 of file communicatorfactory.cpp.
|
virtual |
Destory the factory.
Definition at line 75 of file communicatorfactory.cpp.
|
protectedvirtual |
Construct a communicator based on typeId.
Definition at line 104 of file communicatorfactory.cpp.
|
inlineprotected |
Definition at line 131 of file communicatorfactory.h.
Communicator * CommunicatorFactory::create | ( | const XsPortInfo & | portInfo | ) | const |
Create a communicator based on a port info.
Definition at line 88 of file communicatorfactory.cpp.
Communicator * CommunicatorFactory::create | ( | const XsString & | filename | ) | const |
Create a communicator based on a filename.
Definition at line 96 of file communicatorfactory.cpp.
|
inlinestatic |
Create a new CommunicatorFactory and register its basic types.
Definition at line 87 of file communicatorfactory.h.
|
pure virtual |
Match a filename to a communicator.
filename | A name of file |
Implemented in XdaCommunicatorFactory.
|
pure virtual |
Match a XsPortInfo to a communicator.
portInfo | An information about the port |
Implemented in XdaCommunicatorFactory.
|
inlinevirtual |
Registrates communicator types.
Reimplemented in XdaCommunicatorFactory.
Definition at line 124 of file communicatorfactory.h.
bool CommunicatorFactory::registerType | ( | CommunicatorTypeId | typeId, |
CommunicatorConstructFunc | constructFunc, | ||
PortInfoMatchFunc | matchFunc | ||
) |
Register a communicator type with the factory.
Definition at line 81 of file communicatorfactory.cpp.
|
private |
Definition at line 138 of file communicatorfactory.h.