EC_And_Filter.cpp

Go to the documentation of this file.
00001 // $Id: EC_And_Filter.cpp 76589 2007-01-25 18:04:11Z elliott_c $
00002 
00003 #include "orbsvcs/Event/EC_And_Filter.h"
00004 
00005 ACE_RCSID(Event, EC_And_Filter, "$Id: EC_And_Filter.cpp 76589 2007-01-25 18:04:11Z elliott_c $")
00006 
00007 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00008 
00009 TAO_EC_And_Filter::TAO_EC_And_Filter (TAO_EC_Filter* children[],
00010                                       size_t n)
00011   :  children_ (children),
00012      n_ (n)
00013 {
00014   ChildrenIterator end = this->end ();
00015   for (ChildrenIterator i = this->begin ();
00016        i != end;
00017        ++i)
00018     {
00019       this->adopt_child (*i);
00020     }
00021 }
00022 
00023 TAO_EC_And_Filter::~TAO_EC_And_Filter (void)
00024 {
00025   TAO_EC_Filter** end = this->children_ + this->n_;
00026   for (TAO_EC_Filter** i = this->children_;
00027        i != end;
00028        ++i)
00029     {
00030       delete *i;
00031       *i = 0;
00032     }
00033   delete[] this->children_;
00034   this->children_ = 0;
00035   this->n_ = 0;
00036 }
00037 
00038 TAO_EC_Filter::ChildrenIterator
00039 TAO_EC_And_Filter::begin (void) const
00040 {
00041   return this->children_;
00042 }
00043 
00044 TAO_EC_Filter::ChildrenIterator
00045 TAO_EC_And_Filter::end (void) const
00046 {
00047   return this->children_ + this->n_;
00048 }
00049 
00050 int
00051 TAO_EC_And_Filter::size (void) const
00052 {
00053   return static_cast<CORBA::ULong> (this->n_);
00054 }
00055 
00056 int
00057 TAO_EC_And_Filter::filter (const RtecEventComm::EventSet& event,
00058                            TAO_EC_QOS_Info& qos_info)
00059 {
00060   ChildrenIterator end = this->end ();
00061   for (ChildrenIterator i = this->begin (); i != end; ++i)
00062     {
00063       int n = (*i)->filter (event, qos_info);
00064       if (n == 0)
00065         return 0;
00066     }
00067 
00068   // All children accepted the event, push up...
00069   if (this->parent () != 0)
00070     {
00071       this->parent ()->push (event, qos_info);
00072     }
00073 
00074   return 1;
00075 }
00076 
00077 int
00078 TAO_EC_And_Filter::filter_nocopy (RtecEventComm::EventSet& event,
00079                                   TAO_EC_QOS_Info& qos_info)
00080 {
00081   ChildrenIterator end = this->end ();
00082   for (ChildrenIterator i = this->begin (); i != end; ++i)
00083     {
00084       int n = (*i)->filter_nocopy (event, qos_info);
00085       if (n == 0)
00086         return 0;
00087     }
00088 
00089   // All children accepted the event, push up...
00090   if (this->parent () != 0)
00091     {
00092       this->parent ()->push (event, qos_info);
00093     }
00094 
00095   return 1;
00096 }
00097 
00098 void
00099 TAO_EC_And_Filter::push (const RtecEventComm::EventSet&,
00100                          TAO_EC_QOS_Info&)
00101 {
00102 }
00103 
00104 void
00105 TAO_EC_And_Filter::push_nocopy (RtecEventComm::EventSet&,
00106                                 TAO_EC_QOS_Info&)
00107 {
00108 }
00109 
00110 void
00111 TAO_EC_And_Filter::clear (void)
00112 {
00113   ChildrenIterator end = this->end ();
00114   for (ChildrenIterator i = this->begin ();
00115        i != end;
00116        ++i)
00117     {
00118       (*i)->clear ();
00119     }
00120 }
00121 
00122 CORBA::ULong
00123 TAO_EC_And_Filter::max_event_size (void) const
00124 {
00125   CORBA::ULong n = 0;
00126   ChildrenIterator end = this->end ();
00127   for (ChildrenIterator i = this->begin ();
00128        i != end;
00129        ++i)
00130     {
00131       CORBA::ULong c = (*i)->max_event_size ();
00132       if (n < c)
00133         n = c;
00134     }
00135   return n;
00136 }
00137 
00138 int
00139 TAO_EC_And_Filter::can_match (
00140       const RtecEventComm::EventHeader& header) const
00141 {
00142   ChildrenIterator end = this->end ();
00143   for (ChildrenIterator i = this->begin ();
00144        i != end;
00145        ++i)
00146     {
00147       if ((*i)->can_match (header) == 0)
00148         return 0;
00149     }
00150   return 1;
00151 }
00152 
00153 int
00154 TAO_EC_And_Filter::add_dependencies (
00155       const RtecEventComm::EventHeader&,
00156       const TAO_EC_QOS_Info&)
00157 {
00158   return 0;
00159 }
00160 
00161 TAO_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:44:05 2010 for TAO_RTEvent by  doxygen 1.4.7