Used to extract/cancel request(s) from the queue. More...
#include <CSD_TP_Cancel_Visitor.h>
Public Member Functions | |
TP_Cancel_Visitor () | |
Default Constructor - cancel *all* requests. | |
TP_Cancel_Visitor (PortableServer::Servant servant) | |
virtual | ~TP_Cancel_Visitor () |
Virtual Destructor. | |
virtual bool | visit_request (TP_Request *request, bool &remove_flag) |
Private Attributes | |
PortableServer::ServantBase_var | servant_ |
Used to extract/cancel request(s) from the queue.
This visitor is used to cancel certain requests in the queue as they are visited.
Note that this is currently implemented to cancel *all* requests in the queue, or requests that are targeted for a specific servant. This could be extended in the future to perhaps cancel all requests that have the same operation name, or something else.
Definition at line 49 of file CSD_TP_Cancel_Visitor.h.
TAO::CSD::TP_Cancel_Visitor::TP_Cancel_Visitor | ( | ) |
Default Constructor - cancel *all* requests.
Definition at line 8 of file CSD_TP_Cancel_Visitor.inl.
{ }
TAO::CSD::TP_Cancel_Visitor::TP_Cancel_Visitor | ( | PortableServer::Servant | servant | ) |
Constructor with provided servant - cancel requests that target the supplied servant.
Definition at line 14 of file CSD_TP_Cancel_Visitor.inl.
TAO::CSD::TP_Cancel_Visitor::~TP_Cancel_Visitor | ( | ) | [virtual] |
bool TAO::CSD::TP_Cancel_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 23 of file CSD_TP_Cancel_Visitor.cpp.
{ // If our servant_ data member is in the 'nil' state, then // we are supposed to cancel *ALL* requests that we visit. // // Otherwise, if our servant_ data member is not in the 'nil' state, // we are supposed to cancel only requests that target our specific // servant_. if ((this->servant_.in() == 0) || (request->is_target(this->servant_.in()))) { // Set the remove_flag to true so that this request is removed // (and released) from the queue when we finish our visit. remove_flag = true; // Cancel the request request->cancel(); } // Since we are either cancelling requests to any servant or a // specific servant, always continue visitation. return true; }
PortableServer::ServantBase_var TAO::CSD::TP_Cancel_Visitor::servant_ [private] |
Left as nil if we are to cancel all requests, or set to a specific servant if only requests targeting that servant should be cancelled.
Definition at line 73 of file CSD_TP_Cancel_Visitor.h.