summaryrefslogtreecommitdiff
path: root/examples/ASX/Event_Server/Event_Server/Options.h
blob: fbde9aa1c3425531a1c52c6ff35cb124f0c06cb8 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/* -*- C++ -*- */
// $Id$

#ifndef OPTIONS_H
#define OPTIONS_H

#include "ace/OS.h"

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

#include "ace/Profile_Timer.h"

class Options
{
  // = TITLE
  //     Option Singleton for Event Server.
public:
  static Options *instance (void);
  // Singleton access point.

  void parse_args (int argc, char *argv[]);
  // Parse the command-line arguments and set the options.

  // = Timer management.
  void stop_timer (void);
  void start_timer (void);

  // = Set/get the number of threads.
  void thr_count (size_t count);
  size_t thr_count (void);

  // = Set/get the size of the queue.
  void initial_queue_length (size_t length);
  size_t initial_queue_length (void);

  // = Set/get the high water mark.
  void high_water_mark (size_t size);
  size_t high_water_mark (void);

  // = Set/get the high water mark.
  void low_water_mark (size_t size);
  size_t low_water_mark (void);

  // = Set/get the size of a message.
  void message_size (size_t size);
  size_t message_size (void);

  // = Set/get the number of iterations.
  void iterations (size_t n);
  size_t iterations (void);

  // Set/get threading flags.
  void t_flags (long flag);
  long t_flags (void);

  // Set/get supplier port number.
  void supplier_port (u_short port);
  u_short supplier_port (void);

  // Set/get consumer port number.
  void consumer_port (u_short port);
  u_short consumer_port (void);

  // Enabled if we're in debugging mode.
  int debug (void);

  // Enabled if we're in verbose mode.
  int verbose (void);

  // Print the results to the STDERR.
  void print_results (void);

private:
  // = Ensure we're a Singleton.
  Options (void);
  ~Options (void);

  ACE_Profile_Timer itimer_;
  // Time the process.

  size_t thr_count_;
  // Number of threads to spawn.

  long t_flags_;
  // Flags to <thr_create>.

  size_t high_water_mark_;
  // ACE_Task high water mark.

  size_t low_water_mark_;
  // ACE_Task low water mark.

  size_t message_size_;
  // Size of a message.

  size_t initial_queue_length_;
  // Initial number of items in the queue.

  size_t iterations_;
  // Number of iterations to run the test program.

  int debugging_;
  // Extra debugging info.

  int verbosity_;
  // Extra verbose messages.

  u_short consumer_port_;
  // Port that the Consumer_Router is using.

  u_short supplier_port_;
  // Port that the Supplier_Router is using.

  static Options *instance_;
  // Static Singleton.

  friend class ACE_Shutup_GPlusPlus;
  // Turn off g++ warning...
};

#include "Options.i"
#endif /* OPTIONS_H */