Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / CSD_ThreadPool / CSD_TP_Dispatchable_Visitor.h
blob8a4b3a48667082ee386712c5d962fa6e9e79e9a4
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file CSD_TP_Dispatchable_Visitor.h
7 * @author Tim Bradley <bradley_t@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef TAO_CSD_TP_DISPATCHABLE_VISITOR_H
12 #define TAO_CSD_TP_DISPATCHABLE_VISITOR_H
14 #include /**/ "ace/pre.h"
16 #include "tao/CSD_ThreadPool/CSD_TP_Export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "tao/CSD_ThreadPool/CSD_TP_Queue_Visitor.h"
23 #include "tao/CSD_ThreadPool/CSD_TP_Request.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 namespace TAO
29 namespace CSD
31 /**
32 * @class TP_Dispatchable_Visitor
34 * @brief Used to extract the first "dispatchable" request from the queue.
36 * An instance of this visitor class is used by one of the worker
37 * threads to locate the first "dispatchable" request in the queue. If
38 * such a request is visited, then this visitor will save a "copy" of
39 * the request, indicate that the request should be removed from the
40 * queue, and indicate that visitation should stop.
42 * An method is provided to retrieve a "copy" of the "dispatchable"
43 * request that was saved off during visitation. A nil reference
44 * (ie, a NULL pointer) will be returned if no dispatchable request
45 * was found.
48 class TAO_CSD_TP_Export TP_Dispatchable_Visitor : public TP_Queue_Visitor
50 public:
51 /// Default Constructor.
52 TP_Dispatchable_Visitor();
54 /// Virtual Destructor.
55 virtual ~TP_Dispatchable_Visitor();
57 /// Reset this visitor object in order to re-use it for another
58 /// visitation of the request queue. This sets the visitor's "result"
59 /// (the TP_Request* data member) to its default value (a nil handle).
60 void reset();
62 /// Returns true to continue visitation. Returns false to stop
63 /// visitation. Sets the remove_flag to true if the request should
64 /// be removed from the queue as a result of the visit. Leaves the
65 /// remove_flag alone otherwise.
66 virtual bool visit_request(TP_Request* request, bool& remove_flag);
68 /// This returns a "copy" of the located request, or 0 if no request
69 /// was located.
70 TP_Request* request();
73 private:
74 /// A handle to the located request.
75 TP_Request_Handle request_;
80 TAO_END_VERSIONED_NAMESPACE_DECL
82 #if defined (__ACE_INLINE__)
83 # include "tao/CSD_ThreadPool/CSD_TP_Dispatchable_Visitor.inl"
84 #endif /* __ACE_INLINE__ */
86 #include /**/ "ace/post.h"
88 #endif /* TAO_CSD_TP_DISPATCHABLE_VISITOR_H */