Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / CSD_ThreadPool / CSD_TP_Queue.h
blobb4b72e6635a2516ef2d3c56c5286634b7156c35f
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file CSD_TP_Queue.h
7 * @author Tim Bradley <bradley_t@ociweb.com>
8 */
9 //=============================================================================
11 #ifndef TAO_CSD_TP_QUEUE_H
12 #define TAO_CSD_TP_QUEUE_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/Versioned_Namespace.h"
23 #include "tao/orbconf.h"
25 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
27 namespace TAO
29 namespace CSD
31 class TP_Request;
32 class TP_Queue_Visitor;
34 /**
35 * @class TP_Queue
37 * @brief Queue of servant requests that need to be dispatched.
39 * This is the queue of pending servant requests that is "owned"
40 * by a TP_Strategy object. When an ORB thread dispatches
41 * a servant request to the strategy object, it will create the
42 * appropriate (subclass of) TP_Request object to "wrap"
43 * the servant request in a "queue-friendly" wrapper. The ORB thread
44 * will then place the TP_Request object on to the queue. Note that
45 * this scenario pertains to what are being called "remote requests".
46 * There are other scenarios in which other types of requests can
47 * get added to this queue.
49 * The strategy object will employ a set of worker threads that are
50 * responsible for "servicing" the servant requests in the queue.
52 * Note: In the future, support will be added to allow the client
53 * application inject "custom" TP_Request objects into
54 * a TP_Strategy object, causing them to be placed in
55 * the queue.
57 class TAO_CSD_TP_Export TP_Queue
59 public:
60 /// Default Constructor.
61 TP_Queue();
63 /// Destructor.
64 ~TP_Queue();
66 /// Place a request at the end of the queue.
67 void put(TP_Request* request);
69 /// Returns true if the queue is empty. Returns false otherwise.
70 bool is_empty() const;
72 /// Visitors will visit each request in the queue, from front to back,
73 /// and have the ability to stop visiting at any time (ie, before
74 /// visiting every request).
75 void accept_visitor(TP_Queue_Visitor& visitor);
77 private:
78 /// The request at the front of the queue.
79 TP_Request* head_;
81 /// The request at the end of the queue.
82 TP_Request* tail_;
87 TAO_END_VERSIONED_NAMESPACE_DECL
89 #if defined (__ACE_INLINE__)
90 # include "tao/CSD_ThreadPool/CSD_TP_Queue.inl"
91 #endif /* __ACE_INLINE__ */
93 #include /**/ "ace/post.h"
95 #endif /* TAO_CSD_TP_QUEUE_H */