#include <ETCL_FilterFactory.h>
Public Member Functions | |
TAO_Notify_ETCL_FilterFactory (void) | |
Constructor. | |
virtual | ~TAO_Notify_ETCL_FilterFactory () |
Destructor. | |
virtual CosNotifyFilter::FilterFactory_ptr | create (PortableServer::POA_ptr filter_poa) |
= TAO_Notify_FilterFactory methods. | |
virtual void | destroy (void) |
virtual CosNotifyFilter::Filter_ptr | create_filter (const char *constraint_grammar) |
= CosNotifyFilter::FilterFactory methods | |
virtual CosNotifyFilter::MappingFilter_ptr | create_mapping_filter (const char *constraint_grammar, const CORBA::Any &default_value) |
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. | |
virtual TAO_Notify_Object::ID | get_filter_id (CosNotifyFilter::Filter_ptr filter) |
virtual CosNotifyFilter::Filter_ptr | get_filter (const TAO_Notify_Object::ID &id) |
Protected Types | |
typedef ACE_Hash_Map_Manager < TAO_Notify_Object::ID, TAO_Notify_ETCL_Filter *, TAO_SYNCH_MUTEX > | FILTERMAP |
Protected Member Functions | |
CosNotifyFilter::Filter_ptr | create_filter (const char *constraint_grammar, const TAO_Notify_Object::ID &id, TAO_Notify_ETCL_Filter *&filter) |
virtual void | release (void) |
Release this object. | |
Protected Attributes | |
PortableServer::POA_var | filter_poa_ |
The POA in which to activate the Filters. | |
TAO_Notify_ID_Factory | filter_ids_ |
Id generator for proxy suppliers. | |
FILTERMAP | filters_ |
Definition at line 44 of file ETCL_FilterFactory.h.
typedef ACE_Hash_Map_Manager<TAO_Notify_Object::ID, TAO_Notify_ETCL_Filter*, TAO_SYNCH_MUTEX> TAO_Notify_ETCL_FilterFactory::FILTERMAP [protected] |
Definition at line 101 of file ETCL_FilterFactory.h.
TAO_Notify_ETCL_FilterFactory::TAO_Notify_ETCL_FilterFactory | ( | void | ) |
Constructor.
Definition at line 20 of file ETCL_FilterFactory.cpp.
: filter_poa_ (PortableServer::POA::_nil ()) { }
TAO_Notify_ETCL_FilterFactory::~TAO_Notify_ETCL_FilterFactory | ( | ) | [virtual] |
Destructor.
Definition at line 25 of file ETCL_FilterFactory.cpp.
{ FILTERMAP::ITERATOR iterator (this->filters_); for (FILTERMAP::ENTRY *entry = 0; iterator.next (entry) != 0; iterator.advance ()) { delete entry->int_id_; entry->int_id_ = 0; } this->filters_.unbind_all (); }
CosNotifyFilter::FilterFactory_ptr TAO_Notify_ETCL_FilterFactory::create | ( | PortableServer::POA_ptr | filter_poa | ) | [virtual] |
= TAO_Notify_FilterFactory methods.
Implements TAO_Notify_FilterFactory.
Definition at line 42 of file ETCL_FilterFactory.cpp.
{ this->filter_poa_ = PortableServer::POA::_duplicate(filter_poa); CORBA::Object_var object = CORBA::Object::_nil(); try { PortableServer::ObjectId_var id = filter_poa->activate_object (this); object = filter_poa->id_to_reference (id.in()); } catch (PortableServer::POA::ServantAlreadyActive&) { try { object = filter_poa->servant_to_reference (this); } catch (CORBA::Exception& ) { return CosNotifyFilter::FilterFactory::_nil(); } } return CosNotifyFilter::FilterFactory::_narrow (object.in ()); }
CosNotifyFilter::Filter_ptr TAO_Notify_ETCL_FilterFactory::create_filter | ( | const char * | constraint_grammar, | |
const TAO_Notify_Object::ID & | id, | |||
TAO_Notify_ETCL_Filter *& | filter | |||
) | [protected] |
Definition at line 101 of file ETCL_FilterFactory.cpp.
{ // Create the RefCounted servant. filter = 0; ACE_NEW_THROW_EX (filter, TAO_Notify_ETCL_Filter (this->filter_poa_.in (), constraint_grammar, id), CORBA::NO_MEMORY ()); if (filters_.bind (id, filter) == -1) { throw CORBA::INTERNAL (); return 0; } PortableServer::ObjectId_var oid; try { oid = this->filter_poa_->activate_object (filter); } catch (PortableServer::POA::ServantAlreadyActive&) { try { oid = this->filter_poa_->servant_to_id (filter); } catch (CORBA::Exception& ) { throw CORBA::INTERNAL (); return 0; } } CORBA::Object_var obj = this->filter_poa_->id_to_reference (oid.in ()); return CosNotifyFilter::Filter::_narrow (obj.in ()); }
CosNotifyFilter::Filter_ptr TAO_Notify_ETCL_FilterFactory::create_filter | ( | const char * | constraint_grammar | ) | [virtual] |
= CosNotifyFilter::FilterFactory methods
Definition at line 86 of file ETCL_FilterFactory.cpp.
{ // @@: change to "ExTCL" later. if (ACE_OS::strcmp (constraint_grammar, "TCL") != 0 && ACE_OS::strcmp (constraint_grammar, "ETCL") != 0 && ACE_OS::strcmp (constraint_grammar, "EXTENDED_TCL") != 0) throw CosNotifyFilter::InvalidGrammar (); TAO_Notify_Object::ID id = filter_ids_.id (); TAO_Notify_ETCL_Filter* filter = 0; return this->create_filter (constraint_grammar, id, filter); }
CosNotifyFilter::MappingFilter_ptr TAO_Notify_ETCL_FilterFactory::create_mapping_filter | ( | const char * | constraint_grammar, | |
const CORBA::Any & | default_value | |||
) | [virtual] |
Definition at line 145 of file ETCL_FilterFactory.cpp.
{
throw CORBA::NO_IMPLEMENT ();
}
void TAO_Notify_ETCL_FilterFactory::destroy | ( | void | ) | [virtual] |
Implements TAO_Notify_FilterFactory.
Definition at line 68 of file ETCL_FilterFactory.cpp.
{ if (CORBA::is_nil(this->filter_poa_.in ())) return; PortableServer::ServantBase_var guard(this); try { PortableServer::ObjectId_var id = this->filter_poa_->servant_to_id (this); this->filter_poa_->deactivate_object (id.in()); } catch (CORBA::Exception&) { } }
CosNotifyFilter::Filter_ptr TAO_Notify_ETCL_FilterFactory::get_filter | ( | const TAO_Notify_Object::ID & | id | ) | [virtual] |
Implements TAO_Notify_FilterFactory.
Definition at line 240 of file ETCL_FilterFactory.cpp.
{ TAO_Notify_ETCL_Filter* filter = 0; if (filters_.find (id, filter) == -1) return CosNotifyFilter::Filter::_nil (); else { CORBA::Object_var obj = this->filter_poa_->servant_to_reference (filter); CosNotifyFilter::Filter_var filter = CosNotifyFilter::Filter::_narrow (obj.in ()); return filter._retn (); } }
TAO_Notify_Object::ID TAO_Notify_ETCL_FilterFactory::get_filter_id | ( | CosNotifyFilter::Filter_ptr | filter | ) | [virtual] |
Implements TAO_Notify_FilterFactory.
Definition at line 219 of file ETCL_FilterFactory.cpp.
{ ::PortableServer::Servant svt = this->filter_poa_->reference_to_servant (filter); FILTERMAP::ITERATOR iterator (this->filters_); for (FILTERMAP::ENTRY *entry = 0; iterator.next (entry) != 0; iterator.advance ()) { if (svt == entry->int_id_) return entry->ext_id_; } throw CORBA::INTERNAL (); return 0; }
TAO_Notify::Topology_Object * TAO_Notify_ETCL_FilterFactory::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 179 of file ETCL_FilterFactory.cpp.
{ ACE_UNUSED_ARG (id); TAO_Notify::Topology_Object* result = this; if (type == "filter") { const char* value = 0; if (attrs.find ("FilterId", value)) { TAO_Notify_Object::ID const id = ACE_OS::atoi (value); if (DEBUG_LEVEL) ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%P|%t) reload filter %d\n"), static_cast<int> (id) )); filter_ids_.set_last_used (id); TAO_Notify_ETCL_Filter* filter = 0; this->create_filter (0, id, filter); filter->load_attrs (attrs); return filter; } } return result; }
void TAO_Notify_ETCL_FilterFactory::release | ( | void | ) | [protected, virtual] |
Release this object.
Definition at line 211 of file ETCL_FilterFactory.cpp.
{ delete this; //@@ inform factory }
void TAO_Notify_ETCL_FilterFactory::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 ETCL_FilterFactory.cpp.
{ bool changed = true; TAO_Notify::NVPList attrs; // ECF has no attributes saver.begin_object(0, "filter_factory", attrs, changed); if (this->filters_.current_size () > 0) { int index = 0; FILTERMAP::ITERATOR iterator (this->filters_); for (FILTERMAP::ENTRY *entry = 0; iterator.next (entry) != 0; iterator.advance (), ++index) { entry->int_id_->save_persistent (saver); } } saver.end_object(0, "filter_factory"); }
Id generator for proxy suppliers.
Definition at line 97 of file ETCL_FilterFactory.h.
The POA in which to activate the Filters.
Definition at line 94 of file ETCL_FilterFactory.h.
FILTERMAP TAO_Notify_ETCL_FilterFactory::filters_ [protected] |
Definition at line 103 of file ETCL_FilterFactory.h.