summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/Notify/Notify_Signal_Property_T.h
blob: 925ad33185d4c075a5ab012b33be733b2b21a75a (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
74
75
76
77
78
79
80
81
82
83
84
//=============================================================================
/**
 *  @file   Notify_Signal_Property_T.h
 *
 *  $Id$
 *
 * Template class to allow conditional waits on changes of values.
 * It implements an extremely small subset of ACE_Atomic_Op<>.
 *
 *
 *  @author Chad Elliott <elliott_c@ociweb.com>
 */
//=============================================================================

#ifndef TAO_NOTIFY_SIGNAL_PROPERTY_T_H
#define TAO_NOTIFY_SIGNAL_PROPERTY_T_H
#include "ace/pre.h"

#include "ace/Synch_T.h"
#include "ace/Atomic_Op.h"

#if defined (_MSC_VER)
#if (_MSC_VER >= 1200)
#pragma warning (push)
#endif /* _MSC_VER >= 1200 */
#pragma warning (disable:4250)
#endif /* _MSC_VER */

template <class ACE_LOCK, class TYPE>
class TAO_Notify_Signal_Property
{
public:
  // = Initialization methods.

  /// Initialize <value_> to 0.
  TAO_Notify_Signal_Property (void);

  /// Initialize <value_> to c.
  TAO_Notify_Signal_Property (const TYPE &c);

  // Destructor
  virtual ~TAO_Notify_Signal_Property (void);

  // = Accessors.

  /// Atomically post-increment <value_>.
  TYPE operator++ (int);

  /// Atomically post-decrement <value_>.
  TYPE operator-- (int);

  /// Explicitly return <value_>.
  TYPE value (void) const;

  /// Wait for the value_ to change
  virtual int wait_for_change (const ACE_Time_Value* abstime);

private:
  ACE_UNIMPLEMENTED_FUNC (
    TAO_Notify_Signal_Property (
         const TAO_Notify_Signal_Property<ACE_LOCK, TYPE> &rhs))
  ACE_UNIMPLEMENTED_FUNC (
    TAO_Notify_Signal_Property& operator= (
         const TAO_Notify_Signal_Property<ACE_LOCK, TYPE> &rhs))


  ACE_Atomic_Op <ACE_LOCK, TYPE> value_;
  ACE_SYNCH_CONDITION changed_;
};

#if defined (ACE_TEMPLATES_REQUIRE_SOURCE)
#include "Notify_Signal_Property_T.cpp"
#endif /* ACE_TEMPLATES_REQUIRE_SOURCE */

#if defined (ACE_TEMPLATES_REQUIRE_PRAGMA)
#pragma implementation ("Notify_Signal_Property_T.cpp")
#endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */

#if defined (_MSC_VER) && (_MSC_VER >= 1200)
#pragma warning (pop)
#endif /* _MSC_VER */

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