NAME
Oorb::Filter - Filter class for the oorb library
SYNOPSIS
-loorb $(ORBLIBS)
#include "oorb.h"
namespace Oorb
class Filter
DESCRIPTION
The
Filter class represents operations on
Oorb::OrbPacket(3)s
that optionally accept or reject those packets based on certain conditions,
and/or transform those packets based on a set of rules. The
Filter
class is intended as a base class, from which specific filters should be
subclassed. The base class accepts every packet unconditionally and leaves
the content of the packet untouched.
The
Filter constructor is called with two
boolean values to turn on or off
the winnowing and transformation of packets, respectively. These determine
whether the protected methods
accept() and/or
morph() are called.
To use a given
Filter, the calling program should invoke the
filter() method
on each
Oorb::OrbPacket(3) which should be filtered.
Subclasses of
Filter should override the definitions of the virtual methods
accept() and/or
morph(). The former returns a
boolean indicating
whether or not to accept the packet; the latter returns a
std::shared_ptr to the
transformed
Oorb::OrbPacket(3). Subclasses should not need to override the
filter()
method.
CONSTRUCTORS
-
Filter( bool winnow, bool transform, std::shared_ptr<StatusVector> statusVector = nullptr );
The constructor creates a base-class Filter that leaves the incoming packets untouched.
This constructor is mainly used in subclasses, in which the winnow and transform
booleans indicate whether to call the accept() and transform() methods,
respectively. If the input statusVector is non-null, the constructor sets the protected
member variable m_statusVector to the given statusVector value so subclasses can
update status vectors for orb connections as necessary.
METHODS
-
bool accept( std::shared_ptr<OrbPacket> op );
This protected method returns boolean value indicating whether the Oorb::OrbPacket(3)
should be accepted. This method should be overridden by subclasses of Filter.
-
std::shared_ptr<OrbPacket> morph( std::shared_ptr<OrbPacket> op );
This protected method returns a std::shared_ptr to a transformed Oorb::OrbPacket(3),
or the inpout op object if no transformation takes place.
This method should be overridden by subclasses of Filter.
-
std::shared_ptr<OrbPacket> filter( std::shared_ptr<OrbPacket> op );
This method is the main mechanism by which a Filter acts on Oorb::OrbPacket(3)s. It
should be called on each Oorb::OrbPacket(3) of interest. The return value is another
std::shared_ptr to an Oorb::OrbPacket(3). This returned value will be the nullptr
if the Oorb::OrbPacket(3) has been rejected. Otherwise, the returned value will be the
possibly-transformed packet. If a Filter subclass implements both winnowing and transformation,
the accept method is called before the morph method.
LIBRARY
-loorb $(ORBLIBS)
ATTRIBUTES
MT-Safe
SEE ALSO
Oorb(3), OorbFilters(3)
AUTHOR
Kent Lindquist