00001 // -*- C++ -*- 00002 00003 /** 00004 * @file EC_Bitmask_Filter.h 00005 * 00006 * $Id: EC_Bitmask_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_BITMASK_FILTER_H 00017 #define TAO_EC_BITMASK_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_Bitmask_Filter 00031 * 00032 * @brief The bitmask filter. 00033 * 00034 * This filter quickly rejects events that do not match a given 00035 * bitmask. 00036 * If the event is not rejected based on the mask then the child 00037 * is consulted to finally accept or reject the event. 00038 * When composed with the Null_Filter it accepts any events that 00039 * satisfy: 00040 * (event.header.type & type_mask) != 0 00041 * && (event.header.type & source_mask) != 0 00042 * 00043 * <H2>Memory Management</H2> 00044 * It assumes ownership of the child. 00045 */ 00046 class TAO_RTEvent_Serv_Export TAO_EC_Bitmask_Filter : public TAO_EC_Filter 00047 { 00048 public: 00049 /** 00050 * Constructor. 00051 * Events that do not satisfy: 00052 * 00053 * (e.header.source & source_mask) != 0 && 00054 * (e.header.type & type_mask) != 0 00055 * 00056 * are immediately rejected, other events are recursively tested 00057 * using the child node. 00058 * It assumes ownership of the child. 00059 */ 00060 TAO_EC_Bitmask_Filter (CORBA::ULong source_mask, 00061 CORBA::ULong type_mask, 00062 TAO_EC_Filter* child); 00063 00064 /// Destructor 00065 virtual ~TAO_EC_Bitmask_Filter (void); 00066 00067 // = The TAO_EC_Filter methods, please check the documentation in 00068 // TAO_EC_Filter. 00069 virtual ChildrenIterator begin (void) const; 00070 virtual ChildrenIterator end (void) const; 00071 virtual int size (void) const; 00072 virtual int filter (const RtecEventComm::EventSet& event, 00073 TAO_EC_QOS_Info& qos_info); 00074 virtual int filter_nocopy (RtecEventComm::EventSet& event, 00075 TAO_EC_QOS_Info& qos_info); 00076 virtual void push (const RtecEventComm::EventSet& event, 00077 TAO_EC_QOS_Info& qos_info); 00078 virtual void push_nocopy (RtecEventComm::EventSet& event, 00079 TAO_EC_QOS_Info& qos_info); 00080 virtual void clear (void); 00081 virtual CORBA::ULong max_event_size (void) const; 00082 virtual int can_match (const RtecEventComm::EventHeader& header) const; 00083 virtual int add_dependencies (const RtecEventComm::EventHeader& header, 00084 const TAO_EC_QOS_Info &qos_info); 00085 00086 private: 00087 TAO_EC_Bitmask_Filter (const TAO_EC_Bitmask_Filter&); 00088 TAO_EC_Bitmask_Filter& operator= (const TAO_EC_Bitmask_Filter&); 00089 00090 private: 00091 /// The bitmasks 00092 CORBA::ULong source_mask_; 00093 CORBA::ULong type_mask_; 00094 00095 /// The children 00096 TAO_EC_Filter* child_; 00097 }; 00098 00099 TAO_END_VERSIONED_NAMESPACE_DECL 00100 00101 #include /**/ "ace/post.h" 00102 #endif /* TAO_EC_BITMASK_FILTER_H */