Public Member Functions | Protected Member Functions | Private Attributes | Friends

TAO::CSD::TP_Request Class Reference

Base class for "queue-able" requests. More...

#include <CSD_TP_Request.h>

Inheritance diagram for TAO::CSD::TP_Request:
Inheritance graph
[legend]
Collaboration diagram for TAO::CSD::TP_Request:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~TP_Request ()
 Virtual Destructor.
void prepare_for_queue ()
 Prepare the request to be placed into the request queue.
void dispatch ()
 Invoked to dispatch the request to the servant.
void cancel ()
 Invoked to cancel the request.
bool is_ready () const
 Is the target servant ready to accept a request?
void mark_as_busy ()
 Mark the target servant as being busy.
void mark_as_ready ()
 Mark the target servant as being ready (ie, not busy).
bool is_target (PortableServer::Servant servant)

Protected Member Functions

 TP_Request (PortableServer::Servant servant, TP_Servant_State *servant_state)
 Constructor.
PortableServer::Servant servant ()
virtual void prepare_for_queue_i ()
virtual void dispatch_i ()=0
virtual void cancel_i ()=0
 Ask the subclass to perform its duties to carry out the cancellation.

Private Attributes

TP_Requestprev_
 The previous TP_Request object (in the queue).
TP_Requestnext_
 The next TP_Request object (in the queue).
PortableServer::ServantBase_var servant_
 Reference to the servant object.
TP_Servant_State::HandleType servant_state_
 Reference to the servant "state" object (contains the busy flag).

Friends

class TP_Queue

Detailed Description

Base class for "queue-able" requests.

This class serves as the abstract base class for all types of "servant requests" that can be inserted into a TP_Queue object.

Definition at line 51 of file CSD_TP_Request.h.


Constructor & Destructor Documentation

TAO::CSD::TP_Request::~TP_Request (  )  [virtual]

Virtual Destructor.

Definition at line 15 of file CSD_TP_Request.cpp.

{
}

TAO::CSD::TP_Request::TP_Request ( PortableServer::Servant  servant,
TP_Servant_State servant_state 
) [protected]

Constructor.

Definition at line 8 of file CSD_TP_Request.inl.

  : prev_(0),
    next_(0),
    servant_ (servant),
    servant_state_(servant_state, false)
{
  this->servant_->_add_ref ();
}


Member Function Documentation

void TAO::CSD::TP_Request::cancel ( void   ) 

Invoked to cancel the request.

Definition at line 94 of file CSD_TP_Request.inl.

{
  this->cancel_i();
}

virtual void TAO::CSD::TP_Request::cancel_i (  )  [protected, pure virtual]
void TAO::CSD::TP_Request::dispatch ( void   ) 

Invoked to dispatch the request to the servant.

Definition at line 85 of file CSD_TP_Request.inl.

{
  this->dispatch_i();

}

virtual void TAO::CSD::TP_Request::dispatch_i (  )  [protected, pure virtual]
bool TAO::CSD::TP_Request::is_ready (  )  const

Is the target servant ready to accept a request?

Definition at line 38 of file CSD_TP_Request.inl.

{
  if (this->servant_state_.is_nil())
    {
      // This means that the serialization of servants is off.
      // We always answer true here to indicate that the servant is
      // never busy.
      return true;
    }

  return !this->servant_state_->busy_flag();
}

bool TAO::CSD::TP_Request::is_target ( PortableServer::Servant  servant  ) 

This method returns true if this request targets the supplied servant object.

Definition at line 76 of file CSD_TP_Request.inl.

{
  // Compare pointers.  Return true only if these are the exact same object.
  return (servant == this->servant_.in());
}

void TAO::CSD::TP_Request::mark_as_busy (  ) 

Mark the target servant as being busy.

Definition at line 54 of file CSD_TP_Request.inl.

{
  if (!this->servant_state_.is_nil())
    {
      this->servant_state_->busy_flag(true);
    }
}

void TAO::CSD::TP_Request::mark_as_ready (  ) 

Mark the target servant as being ready (ie, not busy).

Definition at line 65 of file CSD_TP_Request.inl.

{
  if (!this->servant_state_.is_nil())
    {
      this->servant_state_->busy_flag(false);
    }
}

void TAO::CSD::TP_Request::prepare_for_queue (  ) 

Prepare the request to be placed into the request queue.

Definition at line 21 of file CSD_TP_Request.inl.

{
  this->prepare_for_queue_i();
}

void TAO::CSD::TP_Request::prepare_for_queue_i (  )  [protected, virtual]

The subclass knows if it needs to do anything in preparation of being placed into the request queue. The default implementation does nothing, so only subclasses that have something to do need to provide their own implementation.

Reimplemented in TAO::CSD::TP_Collocated_Asynch_Request, TAO::CSD::TP_Collocated_Synch_With_Server_Request, and TAO::CSD::TP_Remote_Request.

Definition at line 21 of file CSD_TP_Request.cpp.

{
  // Default implementation is to do nothing.  Subclasses can provide
  // their own implementation if needed.
}

PortableServer::Servant TAO::CSD::TP_Request::servant (  )  [protected]

Accessor for the servant. Does not return a new (ref counted) reference! This is used for chaining.

Definition at line 29 of file CSD_TP_Request.inl.

{
  // Used for chaining so we do not return a new "copy".
  return this->servant_.in();
}


Friends And Related Function Documentation

friend class TP_Queue [friend]

The TP_Queue class is our friend since it needs access to the prev_ and next_ (private) data members.

Definition at line 110 of file CSD_TP_Request.h.


Member Data Documentation

TP_Request* TAO::CSD::TP_Request::next_ [private]

The next TP_Request object (in the queue).

Definition at line 116 of file CSD_TP_Request.h.

TP_Request* TAO::CSD::TP_Request::prev_ [private]

The previous TP_Request object (in the queue).

Definition at line 113 of file CSD_TP_Request.h.

PortableServer::ServantBase_var TAO::CSD::TP_Request::servant_ [private]

Reference to the servant object.

Definition at line 119 of file CSD_TP_Request.h.

TP_Servant_State::HandleType TAO::CSD::TP_Request::servant_state_ [private]

Reference to the servant "state" object (contains the busy flag).

Definition at line 122 of file CSD_TP_Request.h.


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