EC_Conjunction_Filter.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /**
00004  *  @file   EC_Conjunction_Filter.h
00005  *
00006  *  $Id: EC_Conjunction_Filter.h 76589 2007-01-25 18:04:11Z elliott_c $
00007  *
00008  *  @author Carlos O'Ryan (coryan@cs.wustl.edu)
00009  *
00010  * Based on previous work by Tim Harrison (harrison@cs.wustl.edu) and
00011  * other members of the DOC group. More details can be found in:
00012  *
00013  * http://doc.ece.uci.edu/~coryan/EC/index.html
00014  */
00015 
00016 #ifndef TAO_EC_CONJUNCTION_FILTER_H
00017 #define TAO_EC_CONJUNCTION_FILTER_H
00018 #include /**/ "ace/pre.h"
00019 
00020 #include "orbsvcs/Event/EC_Filter.h"
00021 #include /**/ "orbsvcs/Event/event_serv_export.h"
00022 
00023 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00024 # pragma once
00025 #endif /* ACE_LACKS_PRAGMA_ONCE */
00026 
00027 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00028 
00029 /**
00030  * @class TAO_EC_Conjunction_Filter
00031  *
00032  * @brief The conjunction filter.
00033  *
00034  * This filter waits until each one of its children has accepted
00035  * at least one event.  Only in that case it accepts and publishes
00036  * the sequence formed by all the children events.
00037  *
00038  * <H2>Memory Management</H2>
00039  * It assumes ownership of the children.
00040  */
00041 class TAO_RTEvent_Serv_Export TAO_EC_Conjunction_Filter : public TAO_EC_Filter
00042 {
00043 public:
00044   /// Constructor. It assumes ownership of both the array and the
00045   /// children.
00046   TAO_EC_Conjunction_Filter (TAO_EC_Filter* children[],
00047                              size_t n);
00048 
00049   /// Destructor
00050   virtual ~TAO_EC_Conjunction_Filter (void);
00051 
00052   // = The TAO_EC_Filter methods, please check the documentation in
00053   // TAO_EC_Filter.
00054   virtual ChildrenIterator begin (void) const;
00055   virtual ChildrenIterator end (void) const;
00056   virtual int size (void) const;
00057   virtual int filter (const RtecEventComm::EventSet& event,
00058                       TAO_EC_QOS_Info& qos_info);
00059   virtual int filter_nocopy (RtecEventComm::EventSet& event,
00060                              TAO_EC_QOS_Info& qos_info);
00061   virtual void push (const RtecEventComm::EventSet& event,
00062                      TAO_EC_QOS_Info& qos_info);
00063   virtual void push_nocopy (RtecEventComm::EventSet& event,
00064                             TAO_EC_QOS_Info& qos_info);
00065   virtual void clear (void);
00066   virtual CORBA::ULong max_event_size (void) const;
00067   virtual int can_match (const RtecEventComm::EventHeader& header) const;
00068   virtual int add_dependencies (const RtecEventComm::EventHeader& header,
00069                                 const TAO_EC_QOS_Info &qos_info);
00070 
00071   typedef unsigned int Word;
00072 
00073 private:
00074   /// Determine if all the children have received their events.
00075   int all_received (void) const;
00076 
00077   TAO_EC_Conjunction_Filter (const TAO_EC_Conjunction_Filter&);
00078   TAO_EC_Conjunction_Filter& operator= (const TAO_EC_Conjunction_Filter&);
00079 
00080 private:
00081   /// The children
00082   TAO_EC_Filter** children_;
00083 
00084   /// The number of children.
00085   size_t n_;
00086 
00087   /// The event we send up (once all the children have pushed theirs).
00088   RtecEventComm::EventSet event_;
00089 
00090   /**
00091    * The number of words in the bit vector
00092    */
00093   size_t nwords_;
00094 
00095   /**
00096    * The bit vector to keep track of the children that have received
00097    * their events.
00098    */
00099   Word* bitvec_;
00100 
00101   /// The current child in the iteration, used in the push() method...
00102   ChildrenIterator current_child_;
00103 };
00104 
00105 TAO_END_VERSIONED_NAMESPACE_DECL
00106 
00107 #include /**/ "ace/post.h"
00108 #endif /* TAO_EC_CONJUNCTION_FILTER_H */

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