RSB  0.19.0
rsb::filter::TypeFilter Class Reference

This filter matches events based on the data type of their payload. More...

#include <TypeFilter.h>

Inheritance diagram for rsb::filter::TypeFilter:
Inheritance graph
Collaboration diagram for rsb::filter::TypeFilter:
Collaboration graph

Public Member Functions

 TypeFilter (const std::string &type, bool invert=false)
 Creates a new type filter that matches events whose payload is of the type designated by type. More...
 
const std::string & getType () const
 
bool isInverted () const
 
bool match (EventPtr event)
 Matches the given event against the constraints specified by this filter. More...
 
void notifyObserver (FilterObserverPtr observer, FilterAction::Types action)
 Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface. More...
 
- Public Member Functions inherited from rsb::filter::Filter
 Filter ()
 
virtual ~Filter ()
 

Static Public Member Functions

template<typename T >
static TypeFiltercreateForType (bool invert=false)
 Creates a new type filter that matches events whose payload is of type T. More...
 

Private Attributes

std::string type
 
bool invert
 

Detailed Description

This filter matches events based on the data type of their payload.

Author
jmoringe

Definition at line 43 of file TypeFilter.h.

Constructor & Destructor Documentation

rsb::filter::TypeFilter::TypeFilter ( const std::string &  type,
bool  invert = false 
)

Creates a new type filter that matches events whose payload is of the type designated by type.

Parameters
typeString designating the which the payload of matching events has to have.
invertIf true, events match if their payload type does not match type.

Definition at line 36 of file TypeFilter.cpp.

Member Function Documentation

template<typename T >
static TypeFilter* rsb::filter::TypeFilter::createForType ( bool  invert = false)
inlinestatic

Creates a new type filter that matches events whose payload is of type T.

Template Parameters
TThe type matching event payloads must have.
Parameters
invertIf true, events match if their type fields do not match type.
Returns
A pointer to the newly created object.

Definition at line 55 of file TypeFilter.h.

References event.

const std::string & rsb::filter::TypeFilter::getType ( ) const

Definition at line 41 of file TypeFilter.cpp.

References type.

bool rsb::filter::TypeFilter::isInverted ( ) const

Definition at line 45 of file TypeFilter.cpp.

References invert.

bool rsb::filter::TypeFilter::match ( EventPtr  e)
virtual

Matches the given event against the constraints specified by this filter.

Parameters
ethe event to match. Must not be changed!
Returns
true if the event matches the restrictions specified by this filter and hence can be delivered to the client, false to remove the event from the stream.

Implements rsb::filter::Filter.

Definition at line 49 of file TypeFilter.cpp.

References invert, and type.

void rsb::filter::TypeFilter::notifyObserver ( FilterObserverPtr  fo,
FilterAction::Types  at 
)
virtual

Double-dispatch method to notfify a FilterObserver about changes for this filter with a more specific type that the general Filter interface.

The default implementation does not generate a specific notification on FilterObserver. Override this method if there is a specific reception method in FilterObserver.

Parameters
fothe observer to notify
ataction that is performed with this filter. Just pass this to the observer

Reimplemented from rsb::filter::Filter.

Definition at line 54 of file TypeFilter.cpp.

Member Data Documentation

bool rsb::filter::TypeFilter::invert
private

Definition at line 81 of file TypeFilter.h.

Referenced by isInverted(), and match().

std::string rsb::filter::TypeFilter::type
private

Definition at line 80 of file TypeFilter.h.

Referenced by getType(), and match().


The documentation for this class was generated from the following files: