#include <CFilterOutputStage.h> class CFilterOutputStage { public: virtual void open(std::string filename) = 0; virtual void close() = 0; virtual void onAttach(CEventFilter& filter); virtual void DescribeEvent(std::vector<std::string> parameterNames, std::vector<UInt_t> parameterIds) =0; virtual void operator()(CEvent& event) = 0; virtual std::string type() const = 0; };
Filter output is managed by output streamers. These
are concrete subclasses of CFilterOutputStage
.
CFilterOutputStage
provides the interface
between a filter an its output streamer. The output streamer
knows the format for the filter file and is expected to output
filter data tothe filter file in that format.
Currently SpecTcl has a built in filter output stage that
understands how to write data in a simple XDR format. A
plugin also provides for filters to be written as
TNtuples
objects into Root files.
virtual = 0 void open(std::string filename);
Concrete filter classes must implement this to
establish a writable connection to the filter file
filename
. Any file connection
information must be kept by the class.
Any errors
should be reported as exceptions.
The preferred exception type is
CErrnoException
. If that's not
possible (e.g. some library that does not set
errno
was used to make the connection)
an exception derived from CException
should be used, even if it's necessary to create
a new exception type.
virtual = 0 void close();
Concrete classes should implement this method to shutdown any connection to the filter output file. While errors are, theoretically, not possible, they should nonetheless be caught and handled:
Any errors
should be reported as exceptions.
The preferred exception type is
CErrnoException
. If that's not
possible (e.g. some library that does not set
errno
was used to make the connection)
an exception derived from CException
should be used, even if it's necessary to create
a new exception type.
virtual void onAttach(CEventFilter& filter);
This is called when the output stage is attached
to a filter. filter
is a reference to the filter to which this object
has just been attached. Since many filters don't
actually have to take any action on this event,
the base class provides an implementation for
onAttach
that does
nothing.
virtual =0 void DescribeEvent(std::vector<std::string> parameterNames, std::vector<UInt_t> parameterIds);
Called by the filter when it's unambiguously known
which parameters will be output by the filter.
parameterNames
are the
requested parameter names.
parameterIds
are the
ids of the parameters that actually exist.
The filter should act on the parameters
in parameterIds
.
virtual = 0 void operator()(CEvent& event);
Called by the filter to write an event to the output stream.
virtual const = 0 std::string type();
This method should be implemented to return a
string that describes the filter's function
and format. For example,
CXdrFilterOutputStage
::type
()
retuns xdr.