#include <CCommunicatorFactory.h> class CCommunicatorFactory { public: virtual CTransport* createFanoutTransport(int endPointId) =0; virtual CTransport* createFanoutClient(int endpointId, int clientId) =0; virtual CTransport* createFanInSource(int endpointId) = 0; virtual CTransport* createFanInSink(int endpointId) = 0; virtual CTransport* createOneToOneSource(int endpointId) = 0; virtual CTransport* createOneToOneSink(int endpointid) = 0; };
Pure abstract transport factory. Parallel programs can feature a variety of communication patterns. This factory is an abstract base class for factories that know how to create transport objects for several common communication factories.
The idea is that application initialization code would use an appropriate factory to create the transports it needs. Use of factories would make changing the communications methods as easy as changing the factory used to create the transports.
As different communication schemes will have differing
ways to specify communication endpoints. specifications
are reduced to integers in this scheme.
A concrete factory will, in general, need a
mechanism to convert these integers into native
endp;oint specifications.
How this is done is factory specific.
See e.g. CZMQCommunicatorFactory
(3daq).
Note that all of these methods return a
CTransport
*. The pointer pointer
points to a transport object the concrete factory
created with new. Furthermore,
in this class, all methods are pure virtual and
must be implemented in a concrete factory.
virtual =0 CTransport* createFanoutTransport(int endPointId);
Creates a transport that fans out
data to multiple clients that operate
with data parallelism. endpointId
identifies any endpoint needed.
virtual =0 CTransport* createFanoutClient((int endpointId, int clientId);
Creates a transport that receives data from
a fanout. The endpoint of the fanout
is identified by endpoingId
.
The client's id is
clientId
.
virtual =0 CTransport* createFanInSource(int endpointId);
Creates a transport that is a source
for fanned in data. The endpoint of the transport
is identified by endpointId
In general there will be one of these that
will send data to a single client with a
transport created by
createFanInSink
below with the same
endpointId
.
virtual = 0 CTransport* createFanInSink(int endpointId);
Creates a sink of data from a
fan in source with the same
endpointId
.
virtual = 0 CTransport* createOneToOneSource(int endpointId);
Creates a transport for the source of
data for a pipeline of data.
The data are consumed by the transport
created by createOneToOneSink
below with the same
endpointId
.
virtual = 0 CTransport* createOneToOneSink(int endpointid);
Creates the sink of a pipeline of data.
The resulting transport receives data sent
by a transport created with
createOnToOneSource
with the same endpointId