Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / TAO / orbsvcs / ImplRepo_Service / Activator_Options.h
blobe68d48075fcc22d0c98656d9837df902e97a3bed
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:
34 enum SERVICE_COMMAND {
35 SC_NONE,
36 SC_INSTALL,
37 SC_REMOVE,
38 SC_INSTALL_NO_LOCATOR
41 // This default is based on the value from ACE_Process_Options
42 // however, the real value is protected -- CAE 4/16/2007
43 enum ACTIVATOR_PROCESS
45 ENVIRONMENT_BUFFER = 16 * 1024,
46 ENVIRONMENT_MAX_VARS = 512
49 Activator_Options ();
51 /// Parse the command-line arguments and initialize the options.
52 int init (int argc, ACE_TCHAR *argv[]);
53 /// This version should only be used when run as an nt service.
54 int init_from_registry();
56 /// Service Mode
57 bool service (void) const;
59 /// Notify the ImR when server processes die.
60 /// @note Currently this only works on Unix.
61 bool notify_imr (void) const;
63 /// When notifying of child death, pause this number of milliseconds
64 /// to simulate a heavily loaded server.
65 unsigned int induce_delay (void) const;
67 /// Debug level for the Implementation Repository.
68 unsigned int debug (void) const;
70 /// Returns the file where the IOR should be stored.
71 const ACE_TString& ior_filename (void) const;
73 /// The nt service command to run (install/remove)
74 SERVICE_COMMAND service_command(void) const;
76 /// Save the command line arguments as registry settings. (Windows only)
77 int save_registry_options ();
79 const char* cmdline(void) const;
81 const ACE_CString& name(void) const;
83 int env_buf_len (void) const;
85 int max_env_vars (void) const;
87 bool detach_child (void) const;
89 private:
90 /// Parses and pulls out arguments for the ImR
91 int parse_args (int &argc, ACE_TCHAR *argv[]);
93 /// Print the usage information.
94 void print_usage (void) const;
96 /// Loads options from the registry
97 int load_registry_options ();
99 private:
101 /// Our extra command line arguments
102 ACE_CString cmdline_;
104 /// Debug level.
105 unsigned int debug_;
107 /// File where the IOR of the server object is stored.
108 ACE_TString ior_output_file_;
110 /// Should we run as a service?
111 bool service_;
113 /// Notify the ImR when server processes die.
114 /// @note Currently this only works on Unix.
115 bool notify_imr_;
117 /// When notifying of child death, pause this number of milliseconds
118 /// to simulate a heavily loaded server.
119 unsigned int induce_delay_;
121 /// SC_NONE, SC_INSTALL, SC_REMOVE, ...
122 SERVICE_COMMAND service_command_;
124 ACE_CString name_;
126 /// The default environment buffer length
127 int env_buf_len_;
129 /// Maximum number of environment variables
130 int max_env_vars_;
132 /// Control signal handling related to child processes
133 bool detach_child_;
136 #endif