FilterAdmin interface methods implementation. More...
#include <FilterAdmin.h>


Public Member Functions | |
| TAO_Notify_FilterAdmin (void) | |
| Constructor. | |
| virtual | ~TAO_Notify_FilterAdmin (void) |
| Destructor. | |
| CORBA::Boolean | match (const TAO_Notify_Event::Ptr &event) |
| See if any of the filters match. | |
| CORBA::Boolean | match (const TAO_Notify_Event *event) |
| See if any of the filters match. | |
| virtual CosNotifyFilter::FilterID | add_filter (CosNotifyFilter::Filter_ptr new_filter) |
| virtual void | remove_filter (CosNotifyFilter::FilterID filter) |
| virtual CosNotifyFilter::Filter_ptr | get_filter (CosNotifyFilter::FilterID filter) |
| virtual CosNotifyFilter::FilterIDSeq * | get_all_filters (void) |
| virtual void | remove_all_filters (void) |
| virtual void | save_persistent (TAO_Notify::Topology_Saver &saver) |
| virtual TAO_Notify::Topology_Object * | load_child (const ACE_CString &type, CORBA::Long id, const TAO_Notify::NVPList &attrs) |
| Create a child of the appropriate type and return it. | |
| void | event_channel (TAO_Notify_EventChannel *ec) |
Private Types | |
| typedef ACE_Hash_Map_Manager < CosNotifyFilter::FilterID, CosNotifyFilter::Filter_var, ACE_SYNCH_NULL_MUTEX > | FILTER_LIST |
Private Member Functions | |
| virtual void | release (void) |
Private Attributes | |
| TAO_SYNCH_MUTEX | lock_ |
| Mutex to serialize access to data members. | |
| FILTER_LIST | filter_list_ |
| List of filters. | |
| TAO_Notify_ID_Factory | filter_ids_ |
| Id generator for proxy suppliers. | |
| TAO_Notify_EventChannel::Ptr | ec_ |
FilterAdmin interface methods implementation.
Definition at line 39 of file FilterAdmin.h.
typedef ACE_Hash_Map_Manager<CosNotifyFilter::FilterID, CosNotifyFilter::Filter_var, ACE_SYNCH_NULL_MUTEX> TAO_Notify_FilterAdmin::FILTER_LIST [private] |
Definition at line 78 of file FilterAdmin.h.
| TAO_Notify_FilterAdmin::TAO_Notify_FilterAdmin | ( | void | ) |
| TAO_Notify_FilterAdmin::~TAO_Notify_FilterAdmin | ( | void | ) | [virtual] |
| CosNotifyFilter::FilterID TAO_Notify_FilterAdmin::add_filter | ( | CosNotifyFilter::Filter_ptr | new_filter | ) | [virtual] |
Definition at line 31 of file FilterAdmin.cpp.
{
if (CORBA::is_nil (new_filter))
throw CORBA::BAD_PARAM ();
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
CosNotifyFilter::FilterID new_id = this->filter_ids_.id ();
CosNotifyFilter::Filter_var new_filter_var =
CosNotifyFilter::Filter::_duplicate (new_filter);
if (this->filter_list_.bind (new_id, new_filter_var) == -1)
throw CORBA::INTERNAL ();
else
return new_id;
}
| void TAO_Notify_FilterAdmin::event_channel | ( | TAO_Notify_EventChannel * | ec | ) |
Definition at line 185 of file FilterAdmin.cpp.
| CosNotifyFilter::FilterIDSeq * TAO_Notify_FilterAdmin::get_all_filters | ( | void | ) | [virtual] |
Definition at line 76 of file FilterAdmin.cpp.
{
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
// Figure out the length of the list.
size_t len = this->filter_list_.current_size ();
CosNotifyFilter::FilterIDSeq* list_ptr = 0;
// Allocate the list of <len> length.
ACE_NEW_THROW_EX (list_ptr,
CosNotifyFilter::FilterIDSeq,
CORBA::NO_MEMORY ());
CosNotifyFilter::FilterIDSeq_var list (list_ptr);
list->length (static_cast<CORBA::ULong> (len));
FILTER_LIST::ITERATOR iter (this->filter_list_);
FILTER_LIST::ENTRY *entry;
u_int index;
for (index = 0; iter.next (entry) != 0; iter.advance (), ++index)
{
list[index] = entry->ext_id_;
}
return list._retn ();
}
| CosNotifyFilter::Filter_ptr TAO_Notify_FilterAdmin::get_filter | ( | CosNotifyFilter::FilterID | filter | ) | [virtual] |
Definition at line 61 of file FilterAdmin.cpp.
{
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
CosNotifyFilter::Filter_var filter_var;
if (this->filter_list_.find (filter_id,
filter_var) == -1)
throw CosNotifyFilter::FilterNotFound ();
return filter_var._retn ();
}
| TAO_Notify::Topology_Object * TAO_Notify_FilterAdmin::load_child | ( | const ACE_CString & | type, | |
| CORBA::Long | id, | |||
| const TAO_Notify::NVPList & | attrs | |||
| ) | [virtual] |
Create a child of the appropriate type and return it.
Use "type" as passed in to determine what kind of child (supporting the Topology_Object interface) to create and return. Inform it of its new ID.
Reimplemented from TAO_Notify::Topology_Object.
Definition at line 157 of file FilterAdmin.cpp.
{
if (type == "filter")
{
TAO_Notify_Object::ID mapid = 0;
attrs.load("MapId", mapid);
TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant ();
CosNotifyFilter::Filter_var filter = factory->get_filter (mapid);
if (! CORBA::is_nil(filter.in()))
{
this->filter_ids_.set_last_used(id);
if (this->filter_list_.bind (id, filter) != 0)
throw CORBA::INTERNAL ();
}
}
return this;
}
| CORBA::Boolean TAO_Notify_FilterAdmin::match | ( | const TAO_Notify_Event * | event | ) |
See if any of the filters match.
Definition at line 8 of file FilterAdmin.inl.
{
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
// If no filter is active, match is successfull.
if (this->filter_list_.current_size () == 0)
return 1;
// We want to return true if atleast one constraint matches.
FILTER_LIST::ITERATOR iter (this->filter_list_);
FILTER_LIST::ENTRY *entry = 0;
CORBA::Boolean ret_val = 0;
for (; iter.next (entry); iter.advance ())
{
ret_val = event->do_match (entry->int_id_.in ());
if (ret_val == 1)
return 1;
}
return 0;
}
| CORBA::Boolean TAO_Notify_FilterAdmin::match | ( | const TAO_Notify_Event::Ptr & | event | ) |
See if any of the filters match.
| void TAO_Notify_FilterAdmin::release | ( | void | ) | [private, virtual] |
Definition at line 179 of file FilterAdmin.cpp.
{
delete this;
}
| void TAO_Notify_FilterAdmin::remove_all_filters | ( | void | ) | [virtual] |
Definition at line 109 of file FilterAdmin.cpp.
{
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
this->filter_list_.unbind_all ();
}
| void TAO_Notify_FilterAdmin::remove_filter | ( | CosNotifyFilter::FilterID | filter | ) | [virtual] |
Definition at line 51 of file FilterAdmin.cpp.
{
ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
CORBA::INTERNAL ());
if (this->filter_list_.unbind (filter_id) == -1)
throw CosNotifyFilter::FilterNotFound ();
}
| void TAO_Notify_FilterAdmin::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 118 of file FilterAdmin.cpp.
{
if (this->filter_list_.current_size() == 0)
return;
bool changed = true;
TAO_Notify::NVPList attrs;
bool want_children = saver.begin_object(0, "filter_admin", attrs, changed);
if (want_children)
{
FILTER_LIST::ITERATOR iter (this->filter_list_);
FILTER_LIST::ENTRY* entry;
TAO_Notify_Properties* properties = TAO_Notify_PROPERTIES::instance();
CORBA::ORB_var orb = properties->orb();
ACE_ASSERT(! CORBA::is_nil(orb.in()));
for (; iter.next(entry) != 0; iter.advance())
{
TAO_Notify::NVPList fattrs;
CORBA::Long id = entry->ext_id_;
//TBD: this presume the filter always collocated.
//otherwise we need modify the filter interface to add get_filter_id()
TAO_Notify_FilterFactory* factory = ec_->default_filter_factory_servant ();
TAO_Notify_Object::ID mapid = factory->get_filter_id (entry->int_id_.in ());
fattrs.push_back(TAO_Notify::NVP("MapId", mapid));
saver.begin_object(id, "filter", fattrs, changed);
saver.end_object(id, "filter");
}
}
saver.end_object(0, "filter_admin");
}
Definition at line 91 of file FilterAdmin.h.
Id generator for proxy suppliers.
Definition at line 89 of file FilterAdmin.h.
List of filters.
Definition at line 86 of file FilterAdmin.h.
TAO_SYNCH_MUTEX TAO_Notify_FilterAdmin::lock_ [private] |
Mutex to serialize access to data members.
Definition at line 83 of file FilterAdmin.h.
1.7.0