~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to ace/Synch_Options.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// -*- C++ -*-
2
 
 
3
 
//==========================================================================
4
 
/**
5
 
 *  @file   Synch_Options.h
6
 
 *
7
 
 *  Synch_Options.h,v 4.19 2003/07/19 19:04:13 dhinton Exp
8
 
 *
9
 
 *  @author Douglas C. Schmidt <schmidt@uci.edu>
10
 
 */
11
 
//==========================================================================
12
 
 
13
 
#ifndef ACE_SYNCH_OPTIONS_H
14
 
#define ACE_SYNCH_OPTIONS_H
15
 
 
16
 
#include /**/ "ace/pre.h"
17
 
 
18
 
#include "ace/ACE_export.h"
19
 
 
20
 
#if !defined (ACE_LACKS_PRAGMA_ONCE)
21
 
# pragma once
22
 
#endif /* ACE_LACKS_PRAGMA_ONCE */
23
 
 
24
 
#include "ace/Time_Value.h"
25
 
 
26
 
 
27
 
/**
28
 
 * @class ACE_Synch_Options
29
 
 *
30
 
 * @brief Contains the values of options used to determine the
31
 
 * synchronous and asynchronous behavior.
32
 
 *
33
 
 * Values support the following behavior (TV == "timeout"
34
 
 * and UR == "use ACE_Reactor"):
35
 
 *
36
 
 * <CODE>
37
 
 * | Parameters     | Description
38
 
 * |
39
 
 * |TV   |  UR      |
40
 
 * |-----|----------|-------------------------------
41
 
 * |                |
42
 
 * |NULL | yes      | infinite timeout (using ACE_Reactor)
43
 
 * |                |
44
 
 * |time | yes      | try asynch transaction for
45
 
 * |                | the specified time (using ACE_Reactor)
46
 
 * |                |
47
 
 * |0,0  | yes      | poll; try, if EWOULDBLOCK,
48
 
 * |                | then return immediately
49
 
 * |                | (using ACE_Reactor)
50
 
 * |                |
51
 
 * |NULL | no       | block forever (don't use ACE_Reactor)
52
 
 * |                |
53
 
 * |time | no       | do a blocking transaction
54
 
 * |                | for the specified time
55
 
 * |                | (don't use ACE_Reactor)
56
 
 * |                |
57
 
 * |0,0  | no       | poll; but do not initiate a
58
 
 * |                | nonblocking transaction
59
 
 * |                | (don't use ACE_Reactor)
60
 
 * </CODE>
61
 
 */
62
 
class ACE_Export ACE_Synch_Options
63
 
{
64
 
public:
65
 
  /// Options flags for controlling synchronization.
66
 
  /**
67
 
   * Note that these flags can be bit-wise "or'd" together if both
68
 
   * options are desired.
69
 
   */
70
 
  enum
71
 
  {
72
 
    /// Use the Reactor.
73
 
    USE_REACTOR = 01,
74
 
    /// Interprete the Time_Value.
75
 
    USE_TIMEOUT = 02
76
 
  };
77
 
 
78
 
  // = Initialization methods.
79
 
  /// Initialize the Synch_Options based on parameters.
80
 
  ACE_Synch_Options (unsigned long options = 0,
81
 
                     const ACE_Time_Value &timeout = ACE_Time_Value::zero,
82
 
                     const void *arg = 0);
83
 
 
84
 
  /// Default dtor.
85
 
  ~ACE_Synch_Options (void);
86
 
 
87
 
  /// Initialize the Synch_Options based on parameters.
88
 
  void set (unsigned long options = 0,
89
 
            const ACE_Time_Value &timeout = ACE_Time_Value::zero,
90
 
            const void *arg = 0);
91
 
 
92
 
  /// Get method for determining which options are enabled.
93
 
  int operator[] (unsigned long option) const;
94
 
 
95
 
  /// Set method for enabling certain options.
96
 
  void operator= (unsigned long option);
97
 
 
98
 
  /// Returns the "magic cookie" argument.
99
 
  const void *arg (void) const;
100
 
 
101
 
  /// Set the "magic cookie" argument.
102
 
  void arg (const void *);
103
 
 
104
 
  /// Returns a reference to the <Time_Value>.  This value only makes
105
 
  /// sense if (*this)[USE_TIMEOUT] is true.
106
 
  const ACE_Time_Value &timeout (void) const;
107
 
 
108
 
  /// Set the <Time_Value>.
109
 
  void timeout (const ACE_Time_Value &tv);
110
 
 
111
 
  /**
112
 
   * Returns the address of the timeout <Time_Value> if
113
 
   * (*this)[USE_TIMEOUT] is true, else 0.  This should be used with
114
 
   * care, e.g., the timeout pointer should not be stored in a manner
115
 
   * that will lead to dangling pointers...
116
 
   */
117
 
  const ACE_Time_Value *time_value (void) const;
118
 
 
119
 
  // = Static data members (singletons)
120
 
 
121
 
  /// This is the default setting for options, which will block
122
 
  /// synchronously.
123
 
  static ACE_Synch_Options defaults;
124
 
 
125
 
  /// This is the default synchronous setting.
126
 
  static ACE_Synch_Options synch;
127
 
 
128
 
  /// This is the default asynchronous setting.
129
 
  static ACE_Synch_Options asynch;
130
 
 
131
 
  /// Dump the state of an object.
132
 
  void dump (void) const;
133
 
 
134
 
  /// Declare the dynamic allocation hooks.
135
 
  ACE_ALLOC_HOOK_DECLARE;
136
 
 
137
 
private:
138
 
  /// Keeps track of the enabled options.
139
 
  unsigned long options_;
140
 
 
141
 
  /// Amount of time to wait for timeouts.
142
 
  ACE_Time_Value timeout_;
143
 
 
144
 
  /**
145
 
   * "Magic cookie" always passed in as an argument to the ACE_Reactor's
146
 
   * <schedule_timer> method.  Used to communicate values for
147
 
   * asynchronous programming.
148
 
   */
149
 
  const void *arg_;
150
 
};
151
 
 
152
 
#if defined (__ACE_INLINE__)
153
 
#include "ace/Synch_Options.i"
154
 
#endif /* __ACE_INLINE__ */
155
 
 
156
 
#include /**/ "ace/post.h"
157
 
 
158
 
#endif /* ACE_SYNCH_OPTIONS_H */