00001 // -*- C++ -*- 00002 00003 //============================================================================= 00004 /** 00005 * @file CSD_TP_Queue_Visitor.h 00006 * 00007 * $Id: CSD_TP_Queue_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_QUEUE_VISITOR_H 00014 #define TAO_CSD_TP_QUEUE_VISITOR_H 00015 00016 #include /**/ "ace/pre.h" 00017 00018 #include "tao/CSD_ThreadPool/CSD_TP_Export.h" 00019 00020 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00021 # pragma once 00022 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00023 00024 #include "tao/Versioned_Namespace.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 namespace TAO 00029 { 00030 namespace CSD 00031 { 00032 00033 class TP_Request; 00034 00035 00036 /** 00037 * @class TP_Queue_Visitor 00038 * 00039 * @brief Base class for vistors of the elements in the TP_Queue. 00040 * 00041 * Provides a way to perform thread-safe iteration over the 00042 * TP_Request objects contained within a TP_Queue object. 00043 * 00044 * This also provides a means to encapsulate each distinct algorithm 00045 * within a distinct subclass of TP_Queue_Visitor. 00046 * 00047 */ 00048 class TAO_CSD_TP_Export TP_Queue_Visitor 00049 { 00050 public: 00051 00052 /// Virtual Destructor. 00053 virtual ~TP_Queue_Visitor(); 00054 00055 /// Returns true to continue visitation. Return false to stop 00056 /// visitation. Sets the remove_flag to true if the request should 00057 /// be removed from the queue as a result of the visit. Leaves the 00058 /// remove_flag alone otherwise. 00059 virtual bool visit_request(TP_Request* request, bool& remove_flag) = 0; 00060 00061 00062 protected: 00063 00064 /// Default Constructor. 00065 TP_Queue_Visitor(); 00066 }; 00067 00068 } 00069 } 00070 00071 TAO_END_VERSIONED_NAMESPACE_DECL 00072 00073 #if defined (__ACE_INLINE__) 00074 # include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.inl" 00075 #endif /* __ACE_INLINE__ */ 00076 00077 #include /**/ "ace/post.h" 00078 00079 #endif /* TAO_CSD_TP_QUEUE_VISITOR_H */