00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Cancel_Visitor.h 00006 * 00007 * $Id: CSD_TP_Cancel_Visitor.h 71473 2006-03-10 07:19:20Z jtc $ 00008 * 00009 * @author Tim Bradley <bradley_t@ociweb.com> 00010 */ 00011 //============================================================================= 00012 00013 #ifndef TAO_CSD_TP_CANCEL_VISITOR_H 00014 #define TAO_CSD_TP_CANCEL_VISITOR_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 #include "tao/PortableServer/Servant_Base.h" 00020 00021 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00022 # pragma once 00023 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00024 00025 #include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h" 00026 00027 00028 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00029 00030 namespace TAO 00031 { 00032 namespace CSD 00033 { 00034 /** 00035 * @class TP_Cancel_Visitor 00036 * 00037 * @brief Used to extract/cancel request(s) from the queue. 00038 * 00039 * This visitor is used to cancel certain requests in the queue 00040 * as they are visited. 00041 * 00042 * Note that this is currently implemented to cancel *all* 00043 * requests in the queue, or requests that are targeted for a specific 00044 * servant. This could be extended in the future to perhaps 00045 * cancel all requests that have the same operation name, or something 00046 * else. 00047 * 00048 */ 00049 class TAO_CSD_TP_Export TP_Cancel_Visitor : public TP_Queue_Visitor 00050 { 00051 public: 00052 00053 /// Default Constructor - cancel *all* requests. 00054 TP_Cancel_Visitor(); 00055 00056 /// Constructor with provided servant - cancel requests that 00057 /// target the supplied servant. 00058 TP_Cancel_Visitor(PortableServer::Servant servant); 00059 00060 /// Virtual Destructor. 00061 virtual ~TP_Cancel_Visitor(); 00062 00063 /// Returns true to continue visitation. Returns false to stop 00064 /// visitation. Sets the remove_flag to true if the request should 00065 /// be removed from the queue as a result of the visit. Leaves the 00066 /// remove_flag alone otherwise. 00067 virtual bool visit_request(TP_Request* request, bool& remove_flag); 00068 00069 private: 00070 00071 /// Left as nil if we are to cancel all requests, or set to a specific 00072 /// servant if only requests targeting that servant should be cancelled. 00073 PortableServer::ServantBase_var servant_; 00074 }; 00075 00076 } 00077 } 00078 00079 TAO_END_VERSIONED_NAMESPACE_DECL 00080 00081 #if defined (__ACE_INLINE__) 00082 # include "tao/CSD_ThreadPool/CSD_TP_Cancel_Visitor.inl" 00083 #endif /* __ACE_INLINE__ */ 00084 00085 #include /**/ "ace/post.h" 00086 00087 #endif /* TAO_CSD_TP_DISPATCHABLE_VISITOR_H */