#include <EventType.h>
Inheritance diagram for TAO_Notify_EventType:
Public Member Functions | |
TAO_Notify_EventType (void) | |
Constructor. | |
TAO_Notify_EventType (const char *domain_name, const char *type_name) | |
TAO_Notify_EventType (const CosNotification::EventType &event_type) | |
virtual | ~TAO_Notify_EventType () |
Destructor. | |
u_long | hash (void) const |
hash value | |
TAO_Notify_EventType & | operator= (const CosNotification::EventType &event_type) |
Assignment from CosNotification::EventType. | |
TAO_Notify_EventType & | operator= (const TAO_Notify_EventType &event_type) |
Assignment operator. | |
bool | operator== (const TAO_Notify_EventType ¬ify_event_type) const |
== operator | |
bool | operator!= (const TAO_Notify_EventType ¬ify_event_type) const |
!= operator | |
CORBA::Boolean | is_special (void) const |
Is this the special event (accept everything). | |
const CosNotification::EventType & | native (void) const |
Get the type underneath us. | |
void | dump (void) const |
Helper to print contents. | |
bool | init (const TAO_Notify::NVPList &attrs) |
Initialize from an NVPList, return false on failure. | |
virtual void | save_persistent (TAO_Notify::Topology_Saver &saver) |
Static Public Member Functions | |
static TAO_Notify_EventType | special (void) |
Return the special event type. | |
Protected Member Functions | |
void | init_i (const char *domain_name, const char *type_name) |
Init this object. | |
void | recompute_hash (void) |
Recompute the hash value. | |
bool | domain_is_wildcard (const char *domain) const |
bool | type_is_wildcard (const char *type) const |
Protected Attributes | |
CosNotification::EventType | event_type_ |
The event_type that we're decorating. | |
u_long | hash_value_ |
The hash value computed. |
Definition at line 36 of file EventType.h.
TAO_Notify_EventType::TAO_Notify_EventType | ( | void | ) |
TAO_Notify_EventType::TAO_Notify_EventType | ( | const char * | domain_name, | |
const char * | type_name | |||
) |
Definition at line 46 of file EventType.cpp.
References init_i().
00048 { 00049 this->init_i (domain_name, type_name); 00050 }
TAO_Notify_EventType::TAO_Notify_EventType | ( | const CosNotification::EventType & | event_type | ) |
Definition at line 52 of file EventType.cpp.
References init_i().
00055 { 00056 this->init_i (event_type.domain_name.in (), event_type.type_name.in ()); 00057 }
TAO_Notify_EventType::~TAO_Notify_EventType | ( | ) | [virtual] |
ACE_INLINE bool TAO_Notify_EventType::domain_is_wildcard | ( | const char * | domain | ) | const [protected] |
Definition at line 20 of file EventType.inl.
References ACE_OS::strcmp().
Referenced by operator==().
00021 { 00022 return (domain == 0 || ACE_OS::strcmp (domain, "") == 0 || 00023 ACE_OS::strcmp (domain, "*") == 0); 00024 }
void TAO_Notify_EventType::dump | ( | void | ) | const |
Helper to print contents.
Definition at line 128 of file EventType.cpp.
References ACE_DEBUG, event_type_, and LM_DEBUG.
Referenced by TAO_Notify_EventTypeSeq::dump().
00129 { 00130 ACE_DEBUG ((LM_DEBUG, 00131 "(%s,%s)", 00132 this->event_type_.domain_name.in (), 00133 this->event_type_.type_name.in ())); 00134 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE u_long TAO_Notify_EventType::hash | ( | void | ) | const |
hash value
Definition at line 8 of file EventType.inl.
References hash_value_.
00009 { 00010 return this->hash_value_; 00011 }
bool TAO_Notify_EventType::init | ( | const TAO_Notify::NVPList & | attrs | ) |
Initialize from an NVPList, return false on failure.
Definition at line 137 of file EventType.cpp.
References ACE_String_Base< CHAR >::c_str(), and TAO_Notify::NVPList::load().
Referenced by TAO_Notify_EventTypeSeq::load_child().
00138 { 00139 bool result = false; 00140 00141 ACE_CString domain; 00142 ACE_CString type; 00143 if (attrs.load("Domain", domain) && attrs.load("Type", type)) 00144 { 00145 this->init_i(domain.c_str(), type.c_str()); 00146 result = true; 00147 } 00148 return result; 00149 00150 }
void TAO_Notify_EventType::init_i | ( | const char * | domain_name, | |
const char * | type_name | |||
) | [protected] |
Init this object.
Definition at line 32 of file EventType.cpp.
References event_type_, recompute_hash(), and CORBA::string_dup().
Referenced by operator=(), and TAO_Notify_EventType().
00033 { 00034 this->event_type_.domain_name = domain_name; 00035 this->event_type_.type_name = type_name; 00036 00037 if (this->is_special () == 1) 00038 { 00039 this->event_type_.domain_name = CORBA::string_dup ("*"); 00040 this->event_type_.type_name = CORBA::string_dup ("%ALL"); 00041 } 00042 00043 this->recompute_hash (); 00044 }
CORBA::Boolean TAO_Notify_EventType::is_special | ( | void | ) | const |
Is this the special event (accept everything).
Definition at line 121 of file EventType.cpp.
References type_is_wildcard().
Referenced by TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::insert(), TAO_Notify_EventTypeSeq::populate_no_special(), and TAO_Notify_Event_Map_T< PROXY, ACE_LOCK >::remove().
00122 { 00123 return (this->domain_is_wildcard (this->event_type_.domain_name) && 00124 this->type_is_wildcard (this->event_type_.type_name)); 00125 }
ACE_INLINE const CosNotification::EventType & TAO_Notify_EventType::native | ( | void | ) | const |
Get the type underneath us.
Definition at line 14 of file EventType.inl.
References event_type_.
Referenced by TAO_Notify_EventTypeSeq::populate(), and TAO_Notify_EventTypeSeq::populate_no_special().
00015 { 00016 return event_type_; 00017 }
bool TAO_Notify_EventType::operator!= | ( | const TAO_Notify_EventType & | notify_event_type | ) | const |
TAO_Notify_EventType & TAO_Notify_EventType::operator= | ( | const TAO_Notify_EventType & | event_type | ) |
Assignment operator.
Definition at line 91 of file EventType.cpp.
References event_type_, and init_i().
00092 { 00093 if (this == &event_type) 00094 return *this; 00095 00096 this->init_i (event_type.event_type_.domain_name.in (),event_type.event_type_.type_name.in ()); 00097 00098 return *this; 00099 }
TAO_Notify_EventType & TAO_Notify_EventType::operator= | ( | const CosNotification::EventType & | event_type | ) |
Assignment from CosNotification::EventType.
Definition at line 83 of file EventType.cpp.
References init_i().
00084 { 00085 this->init_i (event_type.domain_name.in (),event_type.type_name.in ()); 00086 00087 return *this; 00088 }
bool TAO_Notify_EventType::operator== | ( | const TAO_Notify_EventType & | notify_event_type | ) | const |
== operator
Definition at line 102 of file EventType.cpp.
References domain_is_wildcard(), event_type_, ACE_OS::strcmp(), and type_is_wildcard().
00103 { 00104 return (ACE_OS::strcmp (this->event_type_.domain_name, 00105 event_type.event_type_.domain_name) == 0 || 00106 this->domain_is_wildcard (this->event_type_.domain_name) || 00107 this->domain_is_wildcard (event_type.event_type_.type_name)) && 00108 (ACE_OS::strcmp (this->event_type_.type_name, 00109 event_type.event_type_.type_name) == 0 || 00110 this->type_is_wildcard (this->event_type_.type_name) || 00111 this->type_is_wildcard (event_type.event_type_.type_name)); 00112 }
void TAO_Notify_EventType::recompute_hash | ( | void | ) | [protected] |
Recompute the hash value.
Definition at line 64 of file EventType.cpp.
References ACE::hash_pjw(), hash_value_, ACE_OS::strcat(), and ACE_OS::strcpy().
Referenced by init_i().
00065 { 00066 // @@ Pradeep: this code is bound to crash someday if the strings 00067 // are too long.... See if the hash_pjw () function can be modified 00068 // to take accumulate multiple strings, as in: 00069 // hash = ACE::hash_pjw_accummulate (0, str1); 00070 // hash = ACE::hash_pjw_accummulate (hash, str2); 00071 // 00072 // @@ Or use grow the buffer when needed, or just add the two hash 00073 // values or something, but fix this code! 00074 // 00075 char buffer[BUFSIZ]; 00076 ACE_OS::strcpy (buffer, this->event_type_.domain_name.in ()); 00077 ACE_OS::strcat (buffer, this->event_type_.type_name.in ()); 00078 00079 this->hash_value_ = ACE::hash_pjw (buffer); 00080 }
void TAO_Notify_EventType::save_persistent | ( | TAO_Notify::Topology_Saver & | saver | ) | [virtual] |
Save our state to a Topology_Saver.
Use the methods of a Topology_Saver to store all information we want persisted. This function is called by our parent, which gives us a saver to use. In turn, we must call this function on all of our children. The implementation should look like: bool change = this->self_changed_; this->self_changed_ = false; this->children_changed_ = false; if (is_persistent ()) { bool want_all_children = saver.begin_object( this->id(), type, attrs, change); for all children { if (want_all_children || child.is_changed()) { child.save_persistent(saver); } } for all deleted children { saver.delete_child(child_type, child_id); } saver.end_object(this->id(), type); )
Implements TAO_Notify::Topology_Savable.
Definition at line 155 of file EventType.cpp.
References TAO_Notify::Topology_Saver::begin_object(), TAO_Notify::Topology_Saver::end_object(), and TAO_Notify::NVPList::push_back().
Referenced by TAO_Notify_EventTypeSeq::save_persistent().
00156 { 00157 TAO_Notify::NVPList attrs; 00158 bool changed = true; 00159 00160 attrs.push_back(TAO_Notify::NVP("Domain", this->event_type_.domain_name.in())); 00161 attrs.push_back(TAO_Notify::NVP("Type", this->event_type_.type_name.in())); 00162 saver.begin_object(0, "subscription", attrs, changed); 00163 00164 saver.end_object(0, "subscription"); 00165 }
TAO_BEGIN_VERSIONED_NAMESPACE_DECL TAO_Notify_EventType TAO_Notify_EventType::special | ( | void | ) | [static] |
Return the special event type.
Definition at line 22 of file EventType.cpp.
Referenced by TAO_Notify_EventTypeSeq::add_and_remove(), TAO_Notify_Peer::dispatch_updates(), TAO_Notify_EventTypeSeq::populate_no_special(), TAO_Notify_Admin::TAO_Notify_Admin(), and TAO_Notify_Builder::TAO_Notify_Builder().
00023 { 00024 return TAO_Notify_EventType ("*", "%ALL"); 00025 }
ACE_INLINE bool TAO_Notify_EventType::type_is_wildcard | ( | const char * | type | ) | const [protected] |
Definition at line 27 of file EventType.inl.
References ACE_OS::strcmp().
Referenced by is_special(), and operator==().
00028 { 00029 return (type == 0 || ACE_OS::strcmp (type, "") == 0 || 00030 ACE_OS::strcmp (type, "*") == 0 || 00031 ACE_OS::strcmp (type, "%ALL") == 0); 00032 }
CosNotification::EventType TAO_Notify_EventType::event_type_ [protected] |
The event_type that we're decorating.
Definition at line 94 of file EventType.h.
Referenced by dump(), init_i(), native(), operator=(), and operator==().
u_long TAO_Notify_EventType::hash_value_ [protected] |
The hash value computed.
Definition at line 97 of file EventType.h.
Referenced by hash(), and recompute_hash().