summaryrefslogtreecommitdiff
path: root/ACE/ace/Notification_Strategy.h
blob: 39453792ded5766c410ccac37a711a222a53f3f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// -*- C++ -*-

//=============================================================================
/**
 *  @file   Notification_Strategy.h
 *
 *  @author Doug Schmidt
 */
//=============================================================================
#ifndef ACE_NOTIFICATION_STRATEGY_H
#define ACE_NOTIFICATION_STRATEGY_H
#include /**/ "ace/pre.h"

#include "ace/Event_Handler.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

ACE_BEGIN_VERSIONED_NAMESPACE_DECL

// Forward decls.
class ACE_Reactor;

/**
 * @class ACE_Notification_Strategy
 *
 * @brief Abstract class used for notifying an interested party
 *
 * A vehicle for extending the behavior of ACE_Message_Queue wrt
 * notification *without subclassing*.  Thus, it's an example of
 * the Bridge/Strategy patterns.
 */
class ACE_Export ACE_Notification_Strategy
{
public:
  /// Constructor.
  ACE_Notification_Strategy (ACE_Event_Handler *eh, ACE_Reactor_Mask mask);

  /// Destructor.
  virtual ~ACE_Notification_Strategy () = default;

  virtual int notify () = 0;
  virtual int notify (ACE_Event_Handler *, ACE_Reactor_Mask mask) = 0;

  /// Get the event handler.
  ACE_Event_Handler *event_handler ();

  /// Set the event handler.
  void event_handler (ACE_Event_Handler *eh);

  /// Get the reactor mask.
  ACE_Reactor_Mask mask () const;

  /// Set the reactor mask.
  void mask (ACE_Reactor_Mask m);

protected:
  /// The event handler.
  ACE_Event_Handler *eh_;

  /// The reactor mask.
  ACE_Reactor_Mask mask_;
};

ACE_END_VERSIONED_NAMESPACE_DECL

#if defined (__ACE_INLINE__)
#include "ace/Notification_Strategy.inl"
#endif /* __ACE_INLINE __ */

#include /**/ "ace/post.h"
#endif /*ACE_NOTIFICATION_STRATEGY_H */