00001
00002
00003 #include "orbsvcs/Event/EC_Bitmask_Filter.h"
00004
00005 ACE_RCSID(Event, EC_Bitmask_Filter, "$Id: EC_Bitmask_Filter.cpp 76589 2007-01-25 18:04:11Z elliott_c $")
00006
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008
00009 TAO_EC_Bitmask_Filter::TAO_EC_Bitmask_Filter (CORBA::ULong source_mask,
00010 CORBA::ULong type_mask,
00011 TAO_EC_Filter* child)
00012 : source_mask_ (source_mask),
00013 type_mask_ (type_mask),
00014 child_ (child)
00015 {
00016 this->adopt_child (this->child_);
00017 }
00018
00019 TAO_EC_Bitmask_Filter::~TAO_EC_Bitmask_Filter (void)
00020 {
00021 delete this->child_;
00022 }
00023
00024 TAO_EC_Filter::ChildrenIterator
00025 TAO_EC_Bitmask_Filter::begin (void) const
00026 {
00027 return const_cast<TAO_EC_Filter**> (&this->child_);
00028 }
00029
00030 TAO_EC_Filter::ChildrenIterator
00031 TAO_EC_Bitmask_Filter::end (void) const
00032 {
00033 return const_cast<TAO_EC_Filter**> (&this->child_) + 1;
00034 }
00035
00036 int
00037 TAO_EC_Bitmask_Filter::size (void) const
00038 {
00039 return 1;
00040 }
00041
00042 int
00043 TAO_EC_Bitmask_Filter::filter (const RtecEventComm::EventSet& event,
00044 TAO_EC_QOS_Info& qos_info)
00045 {
00046 if (event.length () != 1)
00047 return 0;
00048
00049 if ((event[0].header.type & this->type_mask_) == 0
00050 || (event[0].header.source & this->source_mask_) == 0)
00051 return 0;
00052
00053 return this->child_->filter (event, qos_info);
00054 }
00055
00056 int
00057 TAO_EC_Bitmask_Filter::filter_nocopy (RtecEventComm::EventSet& event,
00058 TAO_EC_QOS_Info& qos_info)
00059 {
00060 if (event.length () != 1)
00061 return 0;
00062
00063 if ((event[0].header.type & this->type_mask_) == 0
00064 || (event[0].header.source & this->source_mask_) == 0)
00065 return 0;
00066
00067 return this->child_->filter_nocopy (event, qos_info);
00068 }
00069
00070 void
00071 TAO_EC_Bitmask_Filter::push (const RtecEventComm::EventSet &event,
00072 TAO_EC_QOS_Info &qos_info)
00073 {
00074 if (this->parent () != 0)
00075 this->parent ()->push (event, qos_info);
00076 }
00077
00078 void
00079 TAO_EC_Bitmask_Filter::push_nocopy (RtecEventComm::EventSet &event,
00080 TAO_EC_QOS_Info &qos_info)
00081 {
00082 if (this->parent () != 0)
00083 this->parent ()->push_nocopy (event, qos_info);
00084 }
00085
00086 void
00087 TAO_EC_Bitmask_Filter::clear (void)
00088 {
00089 this->child_->clear ();
00090 }
00091
00092 CORBA::ULong
00093 TAO_EC_Bitmask_Filter::max_event_size (void) const
00094 {
00095 return this->child_->max_event_size ();
00096 }
00097
00098 int
00099 TAO_EC_Bitmask_Filter::can_match (
00100 const RtecEventComm::EventHeader& header) const
00101 {
00102 if ((header.type & this->type_mask_) == 0
00103 || (header.source & this->source_mask_) == 0)
00104 return 0;
00105
00106 return this->child_->can_match (header);
00107 }
00108
00109 int
00110 TAO_EC_Bitmask_Filter::add_dependencies (
00111 const RtecEventComm::EventHeader&,
00112 const TAO_EC_QOS_Info &)
00113 {
00114 return 0;
00115 }
00116
00117 TAO_END_VERSIONED_NAMESPACE_DECL