00001 /* -*- C++ -*- */ 00002 /** 00003 * @file EventType.h 00004 * 00005 * $Id: EventType.h 84758 2009-03-09 07:14:54Z dai_y $ 00006 * 00007 * @author Pradeep Gore <pradeep@oomworks.com> 00008 */ 00009 00010 #ifndef TAO_Notify_EVENTTYPE_H 00011 #define TAO_Notify_EVENTTYPE_H 00012 00013 #include /**/ "ace/pre.h" 00014 00015 #include "orbsvcs/Notify/notify_serv_export.h" 00016 00017 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00018 # pragma once 00019 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00020 00021 #include "orbsvcs/CosNotificationC.h" 00022 #include "orbsvcs/Notify/Topology_Object.h" 00023 00024 00025 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00026 00027 /** 00028 * @class TAO_Notify_EventType 00029 * 00030 * @brief 00031 * 00032 * This type is used to compare different event types. 00033 * It is used by the Event Manager as a key to find subscription lists. 00034 * 00035 */ 00036 class TAO_Notify_Serv_Export TAO_Notify_EventType : public TAO_Notify::Topology_Savable 00037 { 00038 public: 00039 /// Constructor 00040 TAO_Notify_EventType (void); 00041 TAO_Notify_EventType (const char* domain_name, const char* type_name); 00042 TAO_Notify_EventType (const CosNotification::EventType& event_type); 00043 // Constructor 00044 00045 /// Destructor 00046 virtual ~TAO_Notify_EventType (); 00047 00048 /// hash value 00049 u_long hash (void) const; 00050 00051 /// Assignment from CosNotification::EventType 00052 TAO_Notify_EventType& operator=(const CosNotification::EventType& event_type); 00053 00054 /// Assignment operator. 00055 TAO_Notify_EventType& operator=(const TAO_Notify_EventType& event_type); 00056 00057 /// == operator 00058 bool operator==(const TAO_Notify_EventType& notify_event_type) const; 00059 00060 /// != operator 00061 bool operator!=(const TAO_Notify_EventType& notify_event_type) const; 00062 00063 /// Return the special event type. 00064 static TAO_Notify_EventType special (void); 00065 00066 /// Is this the special event (accept everything). 00067 CORBA::Boolean is_special (void) const; 00068 00069 /// Get the type underneath us. 00070 const CosNotification::EventType& native (void) const; 00071 00072 /// Helper to print contents. 00073 void dump (void) const; 00074 00075 /// Initialize from an NVPList, return false on failure 00076 bool init(const TAO_Notify::NVPList& attrs); 00077 00078 // TAO_Notify::Topology_Object 00079 00080 virtual void save_persistent (TAO_Notify::Topology_Saver& saver); 00081 00082 protected: 00083 00084 friend class TAO_Notify_Constraint_Interpreter; 00085 00086 /// Init this object. 00087 void init_i (const char* domain_name, const char* type_name); 00088 00089 /// Recompute the hash value. 00090 void recompute_hash (void); 00091 00092 bool domain_is_wildcard (const char* domain) const; 00093 bool type_is_wildcard (const char* type) const; 00094 00095 // = Data Members 00096 /// The event_type that we're decorating. 00097 CosNotification::EventType event_type_; 00098 00099 /// The hash value computed. 00100 u_long hash_value_; 00101 }; 00102 00103 TAO_END_VERSIONED_NAMESPACE_DECL 00104 00105 #if defined (__ACE_INLINE__) 00106 #include "orbsvcs/Notify/EventType.inl" 00107 #endif /* __ACE_INLINE__ */ 00108 00109 #include /**/ "ace/post.h" 00110 00111 #endif /* TAO_Notify_EVENTTYPE_H */