#include <EC_Type_Filter.h>
Inheritance diagram for TAO_EC_Type_Filter:
Public Member Functions | |
TAO_EC_Type_Filter (const RtecEventComm::EventHeader &header) | |
Constructor. | |
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_Type_Filter (const TAO_EC_Type_Filter &) | |
TAO_EC_Type_Filter & | operator= (const TAO_EC_Type_Filter &) |
int | filter_set (const RtecEventComm::EventSet &event, TAO_EC_QOS_Info &qos_info) |
Filter an EventSet that contains more than one event. | |
Private Attributes | |
RtecEventComm::EventHeader | header_ |
Encapsulate the type/source that we must match. |
This filter only accept events with a predefined type/source, both the source and the type can be wildcards.
Definition at line 37 of file EC_Type_Filter.h.
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_EC_Type_Filter::TAO_EC_Type_Filter | ( | const RtecEventComm::EventHeader & | header | ) |
Constructor.
Definition at line 9 of file EC_Type_Filter.cpp.
00010 : header_ (header) 00011 { 00012 }
TAO_EC_Type_Filter::TAO_EC_Type_Filter | ( | const TAO_EC_Type_Filter & | ) | [private] |
int TAO_EC_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 108 of file EC_Type_Filter.cpp.
References can_match().
00111 { 00112 return this->can_match (header); 00113 }
int TAO_EC_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 72 of file EC_Type_Filter.cpp.
References header_, RtecEventComm::EventHeader::source, and RtecEventComm::EventHeader::type.
Referenced by add_dependencies().
00074 { 00075 if (this->header_.source == 0) 00076 { 00077 if (this->header_.type == 0 || header.type == 0) 00078 return 1; 00079 else 00080 return this->header_.type == header.type; 00081 } 00082 00083 if (this->header_.type == 0) 00084 { 00085 if (header.source == 0) 00086 return 1; 00087 else 00088 return this->header_.source == header.source; 00089 } 00090 00091 if (header.source == 0) 00092 { 00093 if (header.type != 0) 00094 return this->header_.type == header.type; 00095 return 1; 00096 } 00097 00098 if (header.type == 0) 00099 { 00100 return this->header_.source == header.source; 00101 } 00102 00103 return (this->header_.type == header.type 00104 && this->header_.source == header.source); 00105 }
void TAO_EC_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 61 of file EC_Type_Filter.cpp.
int TAO_EC_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.
Implements TAO_EC_Filter.
Definition at line 15 of file EC_Type_Filter.cpp.
00017 { 00018 if (event.length () != 1) 00019 return this->filter_set (event, qos_info); 00020 00021 if (this->can_match (event[0].header)) 00022 { 00023 this->push (event, qos_info); 00024 return 1; 00025 } 00026 return 0; 00027 }
int TAO_EC_Type_Filter::filter_nocopy | ( | RtecEventComm::EventSet & | event, | |
TAO_EC_QOS_Info & | qos_info | |||
) | [virtual] |
Implements TAO_EC_Filter.
Definition at line 30 of file EC_Type_Filter.cpp.
00032 { 00033 if (event.length () != 1) 00034 return this->filter_set (event, qos_info); 00035 00036 if (this->can_match (event[0].header)) 00037 { 00038 this->push_nocopy (event, qos_info); 00039 return 1; 00040 } 00041 return 0; 00042 }
int TAO_EC_Type_Filter::filter_set | ( | const RtecEventComm::EventSet & | event, | |
TAO_EC_QOS_Info & | qos_info | |||
) | [private] |
Filter an EventSet that contains more than one event.
Definition at line 116 of file EC_Type_Filter.cpp.
References push().
00118 { 00119 CORBA::ULong maximum = event.length (); 00120 if (event.maximum () == 0) 00121 return 0; 00122 00123 RtecEventComm::EventSet matched (maximum); 00124 CORBA::ULong next_slot = 0; 00125 for (CORBA::ULong i = 0; i != maximum; ++i) 00126 { 00127 if (!this->can_match (event[i].header)) 00128 continue; 00129 matched.length (next_slot + 1); 00130 matched[next_slot] = event[i]; 00131 next_slot++; 00132 } 00133 if (matched.length () == 0) 00134 return 0; 00135 00136 this->push (matched, qos_info); 00137 00138 return 1; 00139 }
CORBA::ULong TAO_EC_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 66 of file EC_Type_Filter.cpp.
TAO_EC_Type_Filter& TAO_EC_Type_Filter::operator= | ( | const TAO_EC_Type_Filter & | ) | [private] |
void TAO_EC_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 45 of file EC_Type_Filter.cpp.
Referenced by filter_set().
void TAO_EC_Type_Filter::push_nocopy | ( | RtecEventComm::EventSet & | event, | |
TAO_EC_QOS_Info & | qos_info | |||
) | [virtual] |
Implements TAO_EC_Filter.
Definition at line 53 of file EC_Type_Filter.cpp.
00055 { 00056 if (this->parent () != 0) 00057 this->parent ()->push_nocopy (event, qos_info); 00058 }
Encapsulate the type/source that we must match.
Definition at line 69 of file EC_Type_Filter.h.
Referenced by can_match().