Merge pull request #1551 from DOCGroup/plm_jira_333
[ACE_TAO.git] / TAO / tao / Flushing_Strategy.h
blob59f3923b4b1d47e778063e3a77e4aa1383089ab3
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Flushing_Strategy.h
7 * @author Carlos O'Ryan <coryan@uci.edu>
8 */
9 //=============================================================================
11 #ifndef TAO_FLUSHING_STRATEGY_H
12 #define TAO_FLUSHING_STRATEGY_H
14 #include /**/ "ace/pre.h"
16 #include "tao/orbconf.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
23 class ACE_Time_Value;
24 ACE_END_VERSIONED_NAMESPACE_DECL
26 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
28 class TAO_Transport;
29 class TAO_Queued_Message;
31 /**
32 * @class TAO_Flushing_Strategy
34 * @brief Define the interface for the flushing strategy, i.e. the
35 * algorithm that controls how does the ORB flush outgoing
36 * data.
38 * Please read the documentation in the TAO_Transport class to find
39 * out more about the design of the outgoing data path.
41 * Some applications can block the current thread whenever they are
42 * sending out data. In those cases they can obtain better
43 * performance by blocking in calls to write() than by participating
44 * in the Leader/Followers protocol to shared the ORB Reactor.
46 * This strategy controls how does the ORB schedule and cancel
47 * reactive I/O, if there is no reactive I/O the strategy is just a
48 * no-op.
50 class TAO_Flushing_Strategy
52 public:
53 /// Destructor
54 virtual ~TAO_Flushing_Strategy (void);
56 enum SCHEDULE_OUTPUT_RETURN { MUST_FLUSH = -2 };
58 /// Schedule the transport argument to be flushed
59 /// If -2 is returned then the caller must call one of
60 /// the flush_* methods.
61 /// If -1 is returned then there was an error.
62 /// If 0 is returned then the flush was scheduled successfully.
63 virtual int schedule_output (TAO_Transport *transport) = 0;
65 /// Cancel all scheduled output for the transport argument
66 virtual int cancel_output (TAO_Transport *transport) = 0;
68 /// Wait until @a msg is sent out. Potentially other messages are
69 /// flushed too, for example, because there are ahead in the queue.
70 virtual int flush_message (TAO_Transport *transport,
71 TAO_Queued_Message *msg,
72 ACE_Time_Value *max_wait_time) = 0;
74 /// Wait until the transport has no messages queued.
75 virtual int flush_transport (TAO_Transport *transport, ACE_Time_Value *max_wait_time) = 0;
78 TAO_END_VERSIONED_NAMESPACE_DECL
80 #include /**/ "ace/post.h"
82 #endif /* TAO_FLUSHING_STRATEGY_H */