Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / Gateway / Peer / Options.h
blob987a69c75b410a2aa6c1737220b0c6b46795dc1a
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Options.h
7 * @author Douglas C. Schmidt
8 */
9 //=============================================================================
12 #ifndef OPTIONS_H
13 #define OPTIONS_H
15 #include "../Gateway/Event.h"
16 #include "ace/svc_export.h"
18 /**
19 * @class Options
21 * @brief Singleton that consolidates all Options for a peerd.
23 class ACE_Svc_Export Options
25 public:
26 // = Options that can be enabled/disabled.
27 enum
29 VERBOSE = 01,
30 SUPPLIER_ACCEPTOR = 02,
31 CONSUMER_ACCEPTOR = 04,
32 SUPPLIER_CONNECTOR = 010,
33 CONSUMER_CONNECTOR = 020
36 /// Return Singleton.
37 static Options *instance ();
39 /// Parse the arguments and set the options.
40 void parse_args (int argc, ACE_TCHAR *argv[]);
42 // = Accessor methods.
43 /// Determine if an option is enabled.
44 int enabled (int option) const;
46 /**
47 * Our acceptor port number, i.e., the one that we passively listen
48 * on for connections to arrive from a gatewayd and create a
49 * Supplier.
51 u_short supplier_acceptor_port () const;
53 /**
54 * Our acceptor port number, i.e., the one that we passively listen
55 * on for connections to arrive from a gatewayd and create a
56 * Consumer.
58 u_short consumer_acceptor_port () const;
60 /// The connector port number, i.e., the one that we use to actively
61 /// establish connections with a gatewayd and create a Supplier.
62 u_short supplier_connector_port () const;
64 /// The connector port number, i.e., the one that we use to actively
65 /// establish connections with a gatewayd and create a Consumer.
66 u_short consumer_connector_port () const;
68 /// Our connector port host, i.e., the host running the gatewayd
69 /// process.
70 const ACE_TCHAR *connector_host () const;
72 /// Duration between disconnects.
73 long timeout () const;
75 /// The maximum size of the queue.
76 long max_queue_size () const;
78 /// Returns a reference to the connection id.
79 CONNECTION_ID &connection_id ();
81 private:
82 enum
84 MAX_QUEUE_SIZE = 1024 * 1024 * 16,
85 // We'll allow up to 16 megabytes to be queued per-output
86 // channel!!!! This is clearly a policy in search of
87 // refinement...
89 DEFAULT_TIMEOUT = 60
90 // By default, disconnect the peer every minute.
93 /// Ensure Singleton.
94 Options ();
96 /// Explain usage and exit.
97 void print_usage_and_die ();
99 /// Singleton.
100 static Options *instance_;
102 /// Flag to indicate if we want verbose diagnostics.
103 u_long options_;
106 * The acceptor port number, i.e., the one that we passively listen
107 * on for connections to arrive from a gatewayd and create a
108 * Supplier.
110 u_short supplier_acceptor_port_;
113 * The acceptor port number, i.e., the one that we passively listen
114 * on for connections to arrive from a gatewayd and create a
115 * Consumer.
117 u_short consumer_acceptor_port_;
119 /// The connector port number, i.e., the one that we use to actively
120 /// establish connections with a gatewayd and create a Supplier.
121 u_short supplier_connector_port_;
123 /// The connector port number, i.e., the one that we use to actively
124 /// establish connections with a gatewayd and create a Consumer.
125 u_short consumer_connector_port_;
127 /// Our connector host, i.e., where the gatewayd process is running.
128 const ACE_TCHAR *connector_host_;
130 /// The amount of time to wait before disconnecting from the Peerd.
131 long timeout_;
133 /// The maximum size that the queue can grow to.
134 long max_queue_size_;
136 /// The connection id.
137 CONNECTION_ID connection_id_;
140 #endif /* OPTIONS_H */