Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

TAO_Notify_Event_Manager Class Reference

A class that manages the Consumer and Supplier maps. More...

#include <Event_Manager.h>

Inheritance diagram for TAO_Notify_Event_Manager:
Inheritance graph
[legend]
Collaboration diagram for TAO_Notify_Event_Manager:
Collaboration graph
[legend]

List of all members.

Public Types

typedef
TAO_Notify_Refcountable_Guard_T
< TAO_Notify_Event_Manager
Ptr

Public Member Functions

 TAO_Notify_Event_Manager (void)
 Constructor.
virtual ~TAO_Notify_Event_Manager ()
 Destructor.
void release ()
 The release method is called when the refcount reaches 0.
void init (void)
 Init.
void shutdown (void)
 Init.
void connect (TAO_Notify_ProxySupplier *proxy_supplier)
 Connect ProxySupplier.
void disconnect (TAO_Notify_ProxySupplier *proxy_supplier)
 Disconnect ProxySupplier.
void connect (TAO_Notify_ProxyConsumer *proxy_consumer)
 Connect ProxyConsumer.
void disconnect (TAO_Notify_ProxyConsumer *proxy_consumer)
 Disconnect ProxyConsumer.
TAO_Notify_Consumer_Mapconsumer_map (void)
 Map accessors.
TAO_Notify_Supplier_Mapsupplier_map (void)
void offer_change (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
 Offer change received on <proxy_consumer>.
void subscription_change (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &added, const TAO_Notify_EventTypeSeq &removed)
 Subscription change received on <proxy_supplier>.
const TAO_Notify_EventTypeSeqoffered_types (void) const
 What are the types being offered.
const TAO_Notify_EventTypeSeqsubscription_types (void) const
 What are the types being subscribed.

Protected Member Functions

void subscribe (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &new_seq)
 Subscribe <proxy_supplier> to the event type sequence list <seq>.
void un_subscribe (TAO_Notify_ProxySupplier *proxy_supplier, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq)
 Unsubscribe <proxy_supplier> to the event type sequence list <seq>.
void publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &new_seq)
 Subscribe <proxy_consumer> to the event type sequence list <seq>.
void un_publish (TAO_Notify_ProxyConsumer *proxy_consumer, const TAO_Notify_EventTypeSeq &seq, TAO_Notify_EventTypeSeq &last_seq)
 Subscribe <proxy_consumer> to the event type sequence list <seq>.

Private Member Functions

 TAO_Notify_Event_Manager (TAO_Notify_Event_Manager &)
TAO_Notify_Event_Manageroperator= (TAO_Notify_Event_Manager &)

Private Attributes

ACE_Auto_Ptr
< TAO_Notify_Consumer_Map
consumer_map_
 Consumer Map.
ACE_Auto_Ptr
< TAO_Notify_Supplier_Map
supplier_map_
 Supplier Map.

Detailed Description

A class that manages the Consumer and Supplier maps.

Definition at line 58 of file Event_Manager.h.


Member Typedef Documentation

Reimplemented from TAO_Notify_Refcountable.

Definition at line 61 of file Event_Manager.h.


Constructor & Destructor Documentation

TAO_Notify_Event_Manager::TAO_Notify_Event_Manager ( void   ) 

Constructor.

Definition at line 64 of file Event_Manager.cpp.

{
}

TAO_Notify_Event_Manager::~TAO_Notify_Event_Manager (  )  [virtual]

Destructor.

Definition at line 68 of file Event_Manager.cpp.

{
  if (TAO_debug_level > 0)
    {
      ACE_DEBUG ((LM_DEBUG, "destroying consumer/supplier map count = %d/%d,\n",
                  this->consumer_map().proxy_count (), this->supplier_map().proxy_count ()));
    }
}

TAO_Notify_Event_Manager::TAO_Notify_Event_Manager ( TAO_Notify_Event_Manager  )  [private]

Member Function Documentation

void TAO_Notify_Event_Manager::connect ( TAO_Notify_ProxySupplier proxy_supplier  ) 

Connect ProxySupplier.

Definition at line 110 of file Event_Manager.cpp.

{
  this->consumer_map().connect (proxy_supplier);

  // Inform about offered types.
  TAO_Notify_EventTypeSeq removed;
  proxy_supplier->types_changed (this->offered_types (), removed);
}

void TAO_Notify_Event_Manager::connect ( TAO_Notify_ProxyConsumer proxy_consumer  ) 

Connect ProxyConsumer.

Definition at line 126 of file Event_Manager.cpp.

{
  this->supplier_map().connect (proxy_consumer);
  // Inform about subscription types.
  TAO_Notify_EventTypeSeq removed;
  proxy_consumer->types_changed (this->subscription_types (), removed);
}

TAO_Notify_Consumer_Map & TAO_Notify_Event_Manager::consumer_map ( void   ) 

Map accessors.

Definition at line 240 of file Event_Manager.cpp.

{
  ACE_ASSERT( this->consumer_map_.get() != 0 );
  return *this->consumer_map_;
}

void TAO_Notify_Event_Manager::disconnect ( TAO_Notify_ProxySupplier proxy_supplier  ) 

Disconnect ProxySupplier.

Definition at line 120 of file Event_Manager.cpp.

{
  this->consumer_map().disconnect (proxy_supplier);
}

void TAO_Notify_Event_Manager::disconnect ( TAO_Notify_ProxyConsumer proxy_consumer  ) 

Disconnect ProxyConsumer.

Definition at line 135 of file Event_Manager.cpp.

{
  this->supplier_map().disconnect (proxy_consumer);
}

void TAO_Notify_Event_Manager::init ( void   ) 

Init.

Definition at line 83 of file Event_Manager.cpp.

{
  ACE_ASSERT (this->consumer_map_.get() == 0);

  TAO_Notify_Consumer_Map* consumer_map = 0;
  ACE_NEW_THROW_EX (consumer_map,
                    TAO_Notify_Consumer_Map (),
                    CORBA::NO_MEMORY ());
  this->consumer_map_.reset( consumer_map );

  this->consumer_map().init ();

  TAO_Notify_Supplier_Map* supplier_map = 0;
  ACE_NEW_THROW_EX (supplier_map,
                    TAO_Notify_Supplier_Map (),
                    CORBA::NO_MEMORY ());
  this->supplier_map_.reset( supplier_map );

  this->supplier_map_->init ();
}

void TAO_Notify_Event_Manager::offer_change ( TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed 
)

Offer change received on <proxy_consumer>.

Definition at line 141 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq new_added, last_removed;

  this->publish (proxy_consumer, added, new_added);

  this->un_publish (proxy_consumer, removed, last_removed);

  TAO_Notify_Consumer_Map::ENTRY::COLLECTION* updates_collection = this->consumer_map().updates_collection ();

  TAO_Notify_ProxySupplier_Update_Worker worker (new_added, last_removed);

  if (updates_collection != 0)
    updates_collection->for_each (&worker);
}

const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::offered_types ( void   )  const

What are the types being offered.

Definition at line 254 of file Event_Manager.cpp.

{
  return this->supplier_map_->event_types ();
}

TAO_Notify_Event_Manager& TAO_Notify_Event_Manager::operator= ( TAO_Notify_Event_Manager  )  [private]
void TAO_Notify_Event_Manager::publish ( TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq new_seq 
) [protected]

Subscribe <proxy_consumer> to the event type sequence list <seq>.

Definition at line 208 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);

  TAO_Notify_EventType* event_type = 0;

  for (iter.first (); iter.next (event_type) != 0; iter.advance ())
    {
      int result = supplier_map().insert (proxy_consumer, *event_type);

      if (result == 1)
        new_seq.insert (*event_type);
    }
}

void TAO_Notify_Event_Manager::release (  )  [virtual]

The release method is called when the refcount reaches 0.

Implements TAO_Notify_Refcountable.

Definition at line 77 of file Event_Manager.cpp.

{
  delete this;
}

void TAO_Notify_Event_Manager::shutdown ( void   ) 

Init.

Definition at line 105 of file Event_Manager.cpp.

{
}

void TAO_Notify_Event_Manager::subscribe ( TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq new_seq 
) [protected]

Subscribe <proxy_supplier> to the event type sequence list <seq>.

Definition at line 176 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);

  TAO_Notify_EventType* event_type;

  for (iter.first (); iter.next (event_type) != 0; iter.advance ())
    {
      int result = this->consumer_map().insert (proxy_supplier, *event_type);

      if (result == 1)
        new_seq.insert (*event_type);
    }
}

void TAO_Notify_Event_Manager::subscription_change ( TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq added,
const TAO_Notify_EventTypeSeq removed 
)

Subscription change received on <proxy_supplier>.

Definition at line 158 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq new_added, last_removed;

  this->subscribe (proxy_supplier, added, new_added);
  this->un_subscribe (proxy_supplier, removed, last_removed);

  TAO_Notify_Supplier_Map::ENTRY::COLLECTION* updates_collection = this->supplier_map().updates_collection ();

  TAO_Notify_ProxyConsumer_Update_Worker worker (new_added, last_removed);

  if (updates_collection != 0)
    {
      updates_collection->for_each (&worker);
    }
}

const TAO_Notify_EventTypeSeq & TAO_Notify_Event_Manager::subscription_types ( void   )  const

What are the types being subscribed.

Definition at line 260 of file Event_Manager.cpp.

{
  return this->consumer_map_->event_types ();
}

TAO_Notify_Supplier_Map & TAO_Notify_Event_Manager::supplier_map ( void   ) 

Definition at line 247 of file Event_Manager.cpp.

{
  ACE_ASSERT( this->supplier_map_.get() != 0 );
  return *this->supplier_map_;
}

void TAO_Notify_Event_Manager::un_publish ( TAO_Notify_ProxyConsumer proxy_consumer,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq last_seq 
) [protected]

Subscribe <proxy_consumer> to the event type sequence list <seq>.

Definition at line 224 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);

  TAO_Notify_EventType* event_type = 0;

  for (iter.first (); iter.next (event_type) != 0; iter.advance ())
    {
      int result = supplier_map().remove (proxy_consumer, *event_type);

      if (result == 1)
        last_seq.insert (*event_type);
    }
}

void TAO_Notify_Event_Manager::un_subscribe ( TAO_Notify_ProxySupplier proxy_supplier,
const TAO_Notify_EventTypeSeq seq,
TAO_Notify_EventTypeSeq last_seq 
) [protected]

Unsubscribe <proxy_supplier> to the event type sequence list <seq>.

Definition at line 192 of file Event_Manager.cpp.

{
  TAO_Notify_EventTypeSeq::CONST_ITERATOR iter (seq);

  TAO_Notify_EventType* event_type = 0;

  for (iter.first (); iter.next (event_type) != 0; iter.advance ())
    {
      int result = this->consumer_map().remove (proxy_supplier, *event_type);

      if (result == 1)
        last_seq.insert (*event_type);
    }
}


Member Data Documentation

Consumer Map.

Definition at line 126 of file Event_Manager.h.

Supplier Map.

Definition at line 129 of file Event_Manager.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines