Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends

TAO_Notify_ProxySupplier Class Reference

Base class for all the ProxySuppliers. More...

#include <ProxySupplier.h>

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

List of all members.

Public Types

typedef
TAO_Notify_Refcountable_Guard_T
< TAO_Notify_ProxySupplier
Ptr

Public Member Functions

 TAO_Notify_ProxySupplier (void)
 Constructor.
virtual ~TAO_Notify_ProxySupplier ()
 Destructor.
virtual void init (TAO_Notify_ConsumerAdmin *consumer_admin)
 Init.
void connect (TAO_Notify_Consumer *consumer)
 Connect.
void disconnect (void)
 Disconnect.
virtual void deliver (TAO_Notify_Method_Request_Dispatch_No_Copy &request)
 Dispatch Event to consumer.
virtual int shutdown (void)
 Override TAO_Notify_Container_T::shutdown method.
virtual void destroy (void)
 Destroy this object.
void destroy (bool from_timeout)
virtual void qos_changed (const TAO_Notify_QoSProperties &qos_properties)
 Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.
bool is_connected (void) const
 Returns true if connected.
TAO_Notify_Consumerconsumer (void)
 Access the Consumer.
TAO_Notify_ConsumerAdminconsumer_admin (void)
 The CA parent.

Private Member Functions

virtual TAO_Notify_Peerpeer (void)
 Access our Peer.

Private Attributes

TAO_Notify_ConsumerAdmin::Ptr consumer_admin_
TAO_Notify_Consumer::Ptr consumer_
 The Consumer that we're connect to.

Friends

class TAO_Notify_Consumer

Detailed Description

Base class for all the ProxySuppliers.

Definition at line 38 of file ProxySupplier.h.


Member Typedef Documentation

Reimplemented from TAO_Notify_Proxy.

Definition at line 43 of file ProxySupplier.h.


Constructor & Destructor Documentation

TAO_Notify_ProxySupplier::TAO_Notify_ProxySupplier ( void   ) 

Constructor.

Definition at line 22 of file ProxySupplier.cpp.

  : consumer_admin_ (0)
{
}

TAO_Notify_ProxySupplier::~TAO_Notify_ProxySupplier (  )  [virtual]

Destructor.

Definition at line 27 of file ProxySupplier.cpp.

{
}


Member Function Documentation

void TAO_Notify_ProxySupplier::connect ( TAO_Notify_Consumer consumer  ) 

Connect.

Definition at line 60 of file ProxySupplier.cpp.

{
  // Adopt the consumer
  TAO_Notify_Consumer::Ptr auto_consumer (consumer);

  TAO_Notify_Atomic_Property_Long& consumer_count = this->admin_properties().consumers ();
  const TAO_Notify_Property_Long& max_consumers = this->admin_properties().max_consumers ();

  if (max_consumers != 0 && consumer_count >= max_consumers.value ())
  {
    throw CORBA::IMP_LIMIT (); // we've reached the limit of consumers connected.
  }

  {
    ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
                        CORBA::INTERNAL ());

    // if consumer is set and reconnect not allowed we get out.
    if (this->is_connected () && TAO_Notify_PROPERTIES::instance()->allow_reconnect() == false)
      {
          throw CosEventChannelAdmin::AlreadyConnected ();
      }

    // Adopt the consumer
    if (this->consumer_.get() != 0)
      auto_consumer->assume_pending_events (*this->consumer_.get ());
    this->consumer_ = auto_consumer;

    this->consumer_admin_->subscribed_types (this->subscribed_types_); // get the parents subscribed types.
  }

  // Inform QoS values.
  ACE_ASSERT (this->consumer_.get() != 0);
  this->consumer_->qos_changed (this->qos_properties_);

  TAO_Notify_EventTypeSeq removed;

  this->event_manager().subscription_change (this, this->subscribed_types_, removed);

  this->event_manager().connect (this);

  // Increment the global consumer count
  ++consumer_count;
}

TAO_Notify_Consumer * TAO_Notify_ProxySupplier::consumer ( void   ) 

Access the Consumer.

Definition at line 14 of file ProxySupplier.inl.

{
  return this->consumer_.get();
}

TAO_Notify_ConsumerAdmin & TAO_Notify_ProxySupplier::consumer_admin ( void   ) 

The CA parent.

Definition at line 20 of file ProxySupplier.inl.

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

void TAO_Notify_ProxySupplier::deliver ( TAO_Notify_Method_Request_Dispatch_No_Copy request  )  [virtual]

Dispatch Event to consumer.

Reimplemented in TAO_Notify_RT_StructuredProxyPushSupplier.

Definition at line 151 of file ProxySupplier.cpp.

{
  this->execute_task (request);
}

void TAO_Notify_ProxySupplier::destroy ( void   )  [virtual]

Destroy this object.

Implements TAO_Notify_Proxy.

Definition at line 135 of file ProxySupplier.cpp.

{
  this->destroy (false);
}

void TAO_Notify_ProxySupplier::destroy ( bool  from_timeout  ) 

Destroy this object, but also indicate if it is due to a timeout or not.

Definition at line 141 of file ProxySupplier.cpp.

{
  this->shutdown ();
  this->consumer_admin_->cleanup_proxy (this, true, from_timeout);

  // Do not reset this->consumer_.
  // It is not safe to delete the non-refcounted consumer here.
}

void TAO_Notify_ProxySupplier::disconnect ( void   ) 

Disconnect.

Definition at line 106 of file ProxySupplier.cpp.

{
  TAO_Notify_EventTypeSeq added;

  this->event_manager().subscription_change (this, added, this->subscribed_types_);

  this->event_manager().disconnect (this);

  // Decrement the global consumer count
  this->admin_properties().consumers ()--;
}

void TAO_Notify_ProxySupplier::init ( TAO_Notify_ConsumerAdmin consumer_admin  )  [virtual]

Init.

Definition at line 32 of file ProxySupplier.cpp.

{
  ACE_ASSERT (consumer_admin != 0 && this->consumer_admin_.get() == 0);

  TAO_Notify_Proxy::initialize (consumer_admin);

  this->consumer_admin_.reset (consumer_admin);

  this->filter_admin_.event_channel (
    this->consumer_admin_->event_channel());

  const CosNotification::QoSProperties &default_ps_qos =
    TAO_Notify_PROPERTIES::instance ()->default_proxy_supplier_qos_properties ();

  {
    ACE_GUARD_THROW_EX (TAO_SYNCH_MUTEX, ace_mon, this->lock_,
                          CORBA::INTERNAL ());
    this->TAO_Notify_Object::set_qos (default_ps_qos);
  }
}

bool TAO_Notify_ProxySupplier::is_connected ( void   )  const

Returns true if connected.

Definition at line 8 of file ProxySupplier.inl.

{
  return ( this->consumer_.get() != 0 );
}

TAO_Notify_Peer * TAO_Notify_ProxySupplier::peer ( void   )  [private, virtual]

Access our Peer.

Implements TAO_Notify_Proxy.

Definition at line 54 of file ProxySupplier.cpp.

{
  return this->consumer ();
}

void TAO_Notify_ProxySupplier::qos_changed ( const TAO_Notify_QoSProperties qos_properties  )  [virtual]

Override, TAO_Notify_Proxy::qos_changed to apply MaxEventssPerConsumer QoS.

Reimplemented from TAO_Notify_Proxy.

Definition at line 157 of file ProxySupplier.cpp.

{
  TAO_Notify_Proxy::qos_changed (qos_properties);
}

int TAO_Notify_ProxySupplier::shutdown ( void   )  [virtual]

Override TAO_Notify_Container_T::shutdown method.

Definition at line 119 of file ProxySupplier.cpp.

{
  if (this->TAO_Notify_Object::shutdown () == 1)
    return 1;


  this->disconnect ();

  if (this->consumer_.get() != 0)
  {
    this->consumer_->shutdown ();
  }
  return 0;
}


Friends And Related Function Documentation

friend class TAO_Notify_Consumer [friend]

Definition at line 40 of file ProxySupplier.h.


Member Data Documentation

The Consumer that we're connect to.

Definition at line 89 of file ProxySupplier.h.

= Data Members. The CA parent.

Definition at line 86 of file ProxySupplier.h.


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