Public Member Functions | Private Attributes

TAO::CSD::TP_Dispatchable_Visitor Class Reference

Used to extract the first "dispatchable" request from the queue. More...

#include <CSD_TP_Dispatchable_Visitor.h>

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

List of all members.

Public Member Functions

 TP_Dispatchable_Visitor ()
 Default Constructor.
virtual ~TP_Dispatchable_Visitor ()
 Virtual Destructor.
void reset ()
virtual bool visit_request (TP_Request *request, bool &remove_flag)
TP_Requestrequest ()

Private Attributes

TP_Request_Handle request_
 A handle to the located request.

Detailed Description

Used to extract the first "dispatchable" request from the queue.

An instance of this visitor class is used by one of the worker threads to locate the first "dispatchable" request in the queue. If such a request is visited, then this visitor will save a "copy" of the request, indicate that the request should be removed from the queue, and indicate that visitation should stop.

An method is provided to retrieve a "copy" of the "dispatchable" request that was saved off during visitation. A nil reference (ie, a NULL pointer) will be returned if no dispatchable request was found.

Definition at line 51 of file CSD_TP_Dispatchable_Visitor.h.


Constructor & Destructor Documentation

TAO::CSD::TP_Dispatchable_Visitor::TP_Dispatchable_Visitor (  ) 

Default Constructor.

Definition at line 8 of file CSD_TP_Dispatchable_Visitor.inl.

{
}

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

Virtual Destructor.

Definition at line 15 of file CSD_TP_Dispatchable_Visitor.cpp.

{
}


Member Function Documentation

TAO::CSD::TP_Request * TAO::CSD::TP_Dispatchable_Visitor::request (  ) 

This returns a "copy" of the located request, or 0 if no request was located.

Definition at line 25 of file CSD_TP_Dispatchable_Visitor.inl.

{
  TP_Request_Handle handle(this->request_.in(), false);
  return handle._retn();
}

void TAO::CSD::TP_Dispatchable_Visitor::reset ( void   ) 

Reset this visitor object in order to re-use it for another visitation of the request queue. This sets the vistor's "result" (the TP_Request* data member) to its default value (a nil handle).

Definition at line 15 of file CSD_TP_Dispatchable_Visitor.inl.

{
  // Set the handle to 0 to have it release any request it may currently
  // be referencing.
  this->request_ = 0;
}

bool TAO::CSD::TP_Dispatchable_Visitor::visit_request ( TP_Request request,
bool &  remove_flag 
) [virtual]

Returns true to continue visitation. Returns false to stop visitation. Sets the remove_flag to true if the request should be removed from the queue as a result of the visit. Leaves the remove_flag alone otherwise.

Implements TAO::CSD::TP_Queue_Visitor.

Definition at line 21 of file CSD_TP_Dispatchable_Visitor.cpp.

{
  // Ask the request object if the target servant is "ready" to accept
  // a request being dispatched to it.
  if (request->is_ready())
    {
      // Ok.  This request is a "dispatchable" request.  It is what we were
      // hoping to find.

      // Save a copy of the request in our handle data member.
      request->_add_ref();
      this->request_ = request;

      // Make sure that the queue will extract the request from the queue
      // upon our return.
      remove_flag = true;

      // Mark the target servant as being "busy".
      request->mark_as_busy();

      // Stop the visitation by returning false.
      return false;
    }

  // The target servant object of the request isn't ready, so the request
  // is not considered to be a "dispatchable" request.

  // Return true to visit the next request in the queue (if there is one).
  return true;
}


Member Data Documentation

TP_Request_Handle TAO::CSD::TP_Dispatchable_Visitor::request_ [private]

A handle to the located request.

Definition at line 80 of file CSD_TP_Dispatchable_Visitor.h.


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