TAO_EC_Masked_Type_Filter Class Reference

A masked type filter. More...

#include <EC_Masked_Type_Filter.h>

Inheritance diagram for TAO_EC_Masked_Type_Filter:

Inheritance graph
[legend]
Collaboration diagram for TAO_EC_Masked_Type_Filter:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAO_EC_Masked_Type_Filter (CORBA::ULong source_mask, CORBA::ULong type_mask, CORBA::ULong source_value, CORBA::ULong type_value)
 Constructor.
virtual ~TAO_EC_Masked_Type_Filter (void)
 Destructor.
virtual ChildrenIterator begin (void) const
virtual ChildrenIterator end (void) const
virtual int size (void) const
virtual int filter (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual int filter_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void push_nocopy (RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info)
virtual void clear (void)
virtual CORBA::ULong max_event_size (void) const
 Returns the maximum size of the events pushed by this filter.
virtual int can_match (const RtecEventComm::EventHeader &header) const
virtual int add_dependencies (const RtecEventComm::EventHeader &header, const TAO_EC_QOS_Info &qos_info)

Private Member Functions

 TAO_EC_Masked_Type_Filter (const TAO_EC_Masked_Type_Filter &)
TAO_EC_Masked_Type_Filteroperator= (const TAO_EC_Masked_Type_Filter &)

Private Attributes

CORBA::ULong source_mask_
 The bitmasks.
CORBA::ULong type_mask_
CORBA::ULong source_value_
 The values.
CORBA::ULong type_value_

Detailed Description

A masked type filter.

This filter only accepts events whose type and/or source have a given value when a bitmask is applied to them. In short the filter checks that: (event.header.type & type_mask) == type_value and that: (event.header.source & source_mask) == source_value

Definition at line 40 of file EC_Masked_Type_Filter.h.


Constructor & Destructor Documentation

TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_EC_Masked_Type_Filter::TAO_EC_Masked_Type_Filter ( CORBA::ULong  source_mask,
CORBA::ULong  type_mask,
CORBA::ULong  source_value,
CORBA::ULong  type_value 
)

Constructor.

Definition at line 10 of file EC_Masked_Type_Filter.cpp.

00014   :  source_mask_ (source_mask),
00015      type_mask_ (type_mask),
00016      source_value_ (source_value),
00017      type_value_ (type_value)
00018 {
00019 }

TAO_EC_Masked_Type_Filter::~TAO_EC_Masked_Type_Filter ( void   )  [virtual]

Destructor.

Definition at line 21 of file EC_Masked_Type_Filter.cpp.

00022 {
00023 }

TAO_EC_Masked_Type_Filter::TAO_EC_Masked_Type_Filter ( const TAO_EC_Masked_Type_Filter  )  [private]


Member Function Documentation

int TAO_EC_Masked_Type_Filter::add_dependencies ( const RtecEventComm::EventHeader header,
const TAO_EC_QOS_Info qos_info 
) [virtual]

This is used for computing the scheduling dependencies:

Leaf filters check if the header could be matched, similar to the can_match() method; if it does they return 1, and 0 otherwise. Intermediate nodes always return 0.

This is used to build precise dependencies between the suppliers and the leaf of the filters that accept that event. Notice that only the nodes doing scheduling recurse through the list, so in configurations that do no require scheduling the recursion stops fairly soon.

Implements TAO_EC_Filter.

Definition at line 114 of file EC_Masked_Type_Filter.cpp.

00117 {
00118   return 0;
00119 }

TAO_EC_Filter::ChildrenIterator TAO_EC_Masked_Type_Filter::begin ( void   )  const [virtual]

STL-like iterators Filters follow the Composite pattern. All filters expose the same interface as if they all had children, but for simple filters the iterators return an empty range.

Reimplemented from TAO_EC_Filter.

Definition at line 26 of file EC_Masked_Type_Filter.cpp.

00027 {
00028   return 0;
00029 }

int TAO_EC_Masked_Type_Filter::can_match ( const RtecEventComm::EventHeader header  )  const [virtual]

Returns 0 if an event with that header could never be accepted. This can used by the suppliers to filter out consumers that couldn't possibly be interested in their events. The rt_info and

Implements TAO_EC_Filter.

Definition at line 103 of file EC_Masked_Type_Filter.cpp.

References RtecEventComm::EventHeader::source, and RtecEventComm::EventHeader::type.

00105 {
00106   if ((header.type & this->type_mask_) == this->type_value_
00107       && (header.source & this->source_mask_) == this->source_value_)
00108     return 1;
00109 
00110   return 0;
00111 }

void TAO_EC_Masked_Type_Filter::clear ( void   )  [virtual]

Clear any saved state, must reset and assume no events have been received.

Implements TAO_EC_Filter.

Definition at line 92 of file EC_Masked_Type_Filter.cpp.

00093 {
00094 }

TAO_EC_Filter::ChildrenIterator TAO_EC_Masked_Type_Filter::end ( void   )  const [virtual]

Reimplemented from TAO_EC_Filter.

Definition at line 32 of file EC_Masked_Type_Filter.cpp.

00033 {
00034   return 0;
00035 }

int TAO_EC_Masked_Type_Filter::filter ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Filter this event, returns 1 if the event is accepted, 0 otherwise. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Attention:
There seems to be a disparity in interfaces: Supplier always push event sets of size 1 to the EC_ProxyPushSupplier, and EC_Filters do not implement handling of sets of more than 1 event. Then, why is this not enforced by the interface by having EC_ProxyPushSupplier take an event rather than a set?

Implements TAO_EC_Filter.

Definition at line 44 of file EC_Masked_Type_Filter.cpp.

00046 {
00047   if (event.length () != 1)
00048     return 0;
00049 
00050   if ((event[0].header.type & this->type_mask_) != this->type_value_
00051       || (event[0].header.source & this->source_mask_) != this->source_value_)
00052     return 0;
00053 
00054   if (this->parent () != 0)
00055     {
00056       this->parent ()->push (event, qos_info);
00057     }
00058   return 1;
00059 }

int TAO_EC_Masked_Type_Filter::filter_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 62 of file EC_Masked_Type_Filter.cpp.

00064 {
00065   if (event.length () != 1)
00066     return 0;
00067 
00068   if ((event[0].header.type & this->type_mask_) != this->type_value_
00069       || (event[0].header.source & this->source_mask_) != this->source_value_)
00070     return 0;
00071 
00072   if (this->parent () != 0)
00073     {
00074       this->parent ()->push_nocopy (event, qos_info);
00075     }
00076   return 1;
00077 }

CORBA::ULong TAO_EC_Masked_Type_Filter::max_event_size ( void   )  const [virtual]

Returns the maximum size of the events pushed by this filter.

Implements TAO_EC_Filter.

Definition at line 97 of file EC_Masked_Type_Filter.cpp.

00098 {
00099   return 1;
00100 }

TAO_EC_Masked_Type_Filter& TAO_EC_Masked_Type_Filter::operator= ( const TAO_EC_Masked_Type_Filter  )  [private]

void TAO_EC_Masked_Type_Filter::push ( const RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

This is called by the children when they accept an event and which to pass it up. Notice that there are two versions of the method, if the event is not const then filter can take ownership of the event.

Implements TAO_EC_Filter.

Definition at line 80 of file EC_Masked_Type_Filter.cpp.

00082 {
00083 }

void TAO_EC_Masked_Type_Filter::push_nocopy ( RtecEventComm::EventSet event,
TAO_EC_QOS_Info qos_info 
) [virtual]

Implements TAO_EC_Filter.

Definition at line 86 of file EC_Masked_Type_Filter.cpp.

00088 {
00089 }

int TAO_EC_Masked_Type_Filter::size ( void   )  const [virtual]

Reimplemented from TAO_EC_Filter.

Definition at line 38 of file EC_Masked_Type_Filter.cpp.

00039 {
00040   return 0;
00041 }


Member Data Documentation

CORBA::ULong TAO_EC_Masked_Type_Filter::source_mask_ [private]

The bitmasks.

Definition at line 77 of file EC_Masked_Type_Filter.h.

CORBA::ULong TAO_EC_Masked_Type_Filter::source_value_ [private]

The values.

Definition at line 81 of file EC_Masked_Type_Filter.h.

CORBA::ULong TAO_EC_Masked_Type_Filter::type_mask_ [private]

Definition at line 78 of file EC_Masked_Type_Filter.h.

CORBA::ULong TAO_EC_Masked_Type_Filter::type_value_ [private]

Definition at line 82 of file EC_Masked_Type_Filter.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:44:30 2010 for TAO_RTEvent by  doxygen 1.4.7