Activator_Options.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 //=============================================================================
00004 /**
00005  *  @file   Activator_Options.h
00006  *
00007  *  $Id: Activator_Options.h 78066 2007-04-17 12:03:07Z elliott_c $
00008  *
00009  *  @brief  Definition of the Options class for the Implementation Repository.
00010  *
00011  *  @author Darrell Brunsch <brunsch@cs.wustl.edu>
00012  */
00013 //=============================================================================
00014 
00015 #ifndef ACTIVATOR_OPTIONS_H
00016 #define ACTIVATOR_OPTIONS_H
00017 
00018 #include "activator_export.h"
00019 
00020 #include "ace/SString.h"
00021 
00022 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00023 # pragma once
00024 #endif /* ACE_LACKS_PRAGMA_ONCE */
00025 
00026 /**
00027  * @class Options
00028  *
00029  * This is where all the settings for TAO's Implementation Repository are
00030  * stored.
00031  */
00032 class Activator_Export Activator_Options
00033 {
00034 public:
00035 
00036   enum SERVICE_COMMAND {
00037     SC_NONE,
00038     SC_INSTALL,
00039     SC_REMOVE,
00040     SC_INSTALL_NO_LOCATOR
00041   };
00042 
00043   // This default is based on the value from ACE_Process_Options
00044   // however, the real value is protected -- CAE 4/16/2007
00045   enum ACTIVATOR_PROCESS
00046   {
00047     ENVIRONMENT_BUFFER = 16 * 1024
00048   };
00049 
00050   Activator_Options ();
00051 
00052   /// Parse the command-line arguments and initialize the options.
00053   int init (int argc, char *argv[]);
00054   /// This version should only be used when run as an nt service.
00055   int init_from_registry();
00056 
00057   /// Service Mode
00058   bool service (void) const;
00059 
00060   /// Notify the ImR when server processes die.
00061   /// Note : Currently this only works on Unix.
00062   bool notify_imr (void) const;
00063 
00064   /// Debug level for the Implementation Repository.
00065   unsigned int debug (void) const;
00066 
00067   /// Returns the file where the IOR should be stored.
00068   const ACE_CString& ior_filename (void) const;
00069 
00070   /// The nt service command to run (install/remove)
00071   SERVICE_COMMAND service_command(void) const;
00072 
00073   /// Save the command line arguments as registry settings. (Windows only)
00074   int save_registry_options ();
00075 
00076   const char* cmdline(void) const;
00077 
00078   const ACE_CString& name(void) const;
00079 
00080   int env_buf_len (void) const;
00081 
00082 private:
00083   /// Parses and pulls out arguments for the ImR
00084   int parse_args (int &argc, char *argv[]);
00085 
00086   /// Print the usage information.
00087   void print_usage (void) const;
00088 
00089   /// Loads options from the registry
00090   int load_registry_options ();
00091 
00092 private:
00093 
00094   /// Our extra command line arguments
00095   ACE_CString cmdline_;
00096 
00097   /// Debug level.
00098   unsigned int debug_;
00099 
00100   /// File where the IOR of the server object is stored.
00101   ACE_CString ior_output_file_;
00102 
00103   /// Should we run as a service?
00104   bool service_;
00105 
00106   bool notify_imr_;
00107 
00108   /// SC_NONE, SC_INSTALL, SC_REMOVE, ...
00109   SERVICE_COMMAND service_command_;
00110 
00111   ACE_CString name_;
00112 
00113   /// The default environment buffer length
00114   int env_buf_len_;
00115 };
00116 
00117 #endif

Generated on Sun Jan 27 15:54:50 2008 for TAO_Implementation_Repository by doxygen 1.3.6