Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / Activator_Options.h
blob041d5a17718e5e0f737dc2d9460f7caef6fa85fe
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Activator_Options.h
7 * @brief Definition of the Options class for the Implementation Repository.
9 * @author Darrell Brunsch <brunsch@cs.wustl.edu>
11 //=============================================================================
13 #ifndef ACTIVATOR_OPTIONS_H
14 #define ACTIVATOR_OPTIONS_H
16 #include "activator_export.h"
18 #include "ace/SString.h"
20 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 # pragma once
22 #endif /* ACE_LACKS_PRAGMA_ONCE */
24 /**
25 * @class Options
27 * This is where all the settings for TAO's Implementation Repository are
28 * stored.
30 class Activator_Export Activator_Options
32 public:
33 enum SERVICE_COMMAND {
34 SC_NONE,
35 SC_INSTALL,
36 SC_REMOVE,
37 SC_INSTALL_NO_LOCATOR
40 // This default is based on the value from ACE_Process_Options
41 // however, the real value is protected -- CAE 4/16/2007
42 enum ACTIVATOR_PROCESS
44 ENVIRONMENT_BUFFER = 16 * 1024,
45 ENVIRONMENT_MAX_VARS = 512
48 Activator_Options ();
50 /// Parse the command-line arguments and initialize the options.
51 int init (int argc, ACE_TCHAR *argv[]);
52 /// This version should only be used when run as an nt service.
53 int init_from_registry();
55 /// Service Mode
56 bool service () const;
58 /// Notify the ImR when server processes die.
59 /// @note Currently this only works on Unix.
60 bool notify_imr () const;
62 /// When notifying of child death, pause this number of milliseconds
63 /// to simulate a heavily loaded server.
64 unsigned int induce_delay () const;
66 /// Debug level for the Implementation Repository.
67 unsigned int debug () const;
69 /// Returns the file where the IOR should be stored.
70 const ACE_TString& ior_filename () const;
72 /// The nt service command to run (install/remove)
73 SERVICE_COMMAND service_command() const;
75 /// Save the command line arguments as registry settings. (Windows only)
76 int save_registry_options ();
78 const char* cmdline() const;
80 const ACE_CString& name() const;
82 int env_buf_len () const;
84 int max_env_vars () const;
86 bool detach_child () const;
88 private:
89 /// Parses and pulls out arguments for the ImR
90 int parse_args (int &argc, ACE_TCHAR *argv[]);
92 /// Print the usage information.
93 void print_usage () const;
95 /// Loads options from the registry
96 int load_registry_options ();
98 private:
99 /// Our extra command line arguments
100 ACE_CString cmdline_;
102 /// Debug level.
103 unsigned int debug_;
105 /// File where the IOR of the server object is stored.
106 ACE_TString ior_output_file_;
108 /// Should we run as a service?
109 bool service_;
111 /// Notify the ImR when server processes die.
112 /// @note Currently this only works on Unix.
113 bool notify_imr_;
115 /// When notifying of child death, pause this number of milliseconds
116 /// to simulate a heavily loaded server.
117 unsigned int induce_delay_;
119 /// SC_NONE, SC_INSTALL, SC_REMOVE, ...
120 SERVICE_COMMAND service_command_;
122 ACE_CString name_;
124 /// The default environment buffer length
125 int env_buf_len_;
127 /// Maximum number of environment variables
128 int max_env_vars_;
130 /// Control signal handling related to child processes
131 bool detach_child_;
134 #endif