#include <CFilterOutputStageCreator.h> class CFilterOutputStageCreator { public: virtual CFilterOutputStage* operator()(std::string type) = 0; virtual std::string document() const = 0; virtual CFilterOutputStageCreator* clone() = 0; };
This is an abstract base class that creates objects on behalf of the
CFilterOutputStageFactory
extensible
factory. Concrete classes of this type create specific output
stage objects. This is one of the keys to providing an extensible
Filter subsystsem. To add a new filter output stage type only
requires that you write a filter output stage, a creator for that
output stage and register that creator with the Filter output
stage factcory singleton.
This class defines the interface that is required of a concrete filter output stage creator.
virtual = 0 CFilterOutputStage* operator()(std::string type);
Concrete classes must implement this to respond to their
filter type by returning a pointer to a newly created
instance of a filter output stage. If the
type
is not recognized, the
creator should return a nullptr.
Naturally care must be taken by authors of filter output stage creators not to recognize strings that are already recognized by other formatters.
virtual const = 0 std::string document();
Returns a string that documents the type of output stage created by this creator. This is used by the filter command to provide a list of available filter formats.
To line up properly, the string returned should be of the form:
virtual = 0 CFilterOutputStageCreator* clone();
There are situations when the filter output
stage factor must create a copy of an existing creator
given a pointer to it with type
CFilterOutputStageCreator*
.
The clone
method provides
support for it. The method should return a pointer to
a new instance of a duplicate of the object it is called on.
If a creator implements copy construction, the simplest way to do this is: