Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

ImR_Activator.cpp File Reference

#include "Options.h"
#include "ImR_Activator_i.h"
#include "NT_Service.h"

Include dependency graph for ImR_Activator.cpp:

Include dependency graph

Go to the source code of this file.

Functions

int run_standalone (void)
 ACE_NT_SERVICE_DEFINE (service, ImR_NT_Service, IMR_SERVICE_NAME)
int run_service (void)
int main (int argc, char *argv[])


Function Documentation

ACE_NT_SERVICE_DEFINE service   ,
ImR_NT_Service   ,
IMR_SERVICE_NAME   
 

int main int    argc,
char *    argv[]
 

Definition at line 83 of file ImR_Activator.cpp.

References ACE_Singleton::instance, run_service, and run_standalone.

00084 {
00085   int result = OPTIONS::instance ()->init (argc, argv);
00086 
00087   if (result < 0)
00088     return 1;  // Error parsing args
00089   else if (result > 0)
00090     return 0;  // No error, but we should exit anyway.
00091 
00092   if (OPTIONS::instance ()->service () == 1)
00093     return run_service ();
00094 
00095   return run_standalone ();
00096 }

int run_service void   
 

Definition at line 63 of file ImR_Activator.cpp.

References ACE_ERROR, ACE_NT_SERVICE_RUN, and LM_ERROR.

Referenced by main.

00064 {
00065 #if defined (ACE_WIN32)
00066   // @todo: Update me
00067 
00068   // If we get here, we either run the app in debug mode (-d) or are
00069   // being called from the service manager to start the service.
00070 
00071   ACE_NT_SERVICE_RUN (service, SERVICE::instance (), ret);
00072 
00073   if (ret == 0)
00074     ACE_ERROR ((LM_ERROR, "%p\n", "Couldn't start service"));
00075 
00076   return ret;
00077 #else /* ACE_WIN32 */
00078   return 1;
00079 #endif /* ACE_WIN32 */
00080 }

int run_standalone void   
 

Definition at line 9 of file ImR_Activator.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCH, ACE_CATCHANY, ACE_DECLARE_NEW_CORBA_ENV, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY, ACE_TRY_CHECK, ImR_Activator_i::fini, ImR_Activator_i::init, and ImR_Activator_i::run.

Referenced by main.

00010 {
00011   ImR_Activator_i server;
00012 
00013   ACE_DECLARE_NEW_CORBA_ENV;
00014   ACE_TRY
00015     {
00016       // Initialize the ImR_Activator_i server.
00017       int status = server.init (ACE_ENV_SINGLE_ARG_PARAMETER);
00018       ACE_TRY_CHECK;
00019 
00020       if (status == -1)
00021         {
00022           return 1;
00023         }
00024       else
00025         {
00026           // Run the server if it is initialized correctly.
00027           server.run (ACE_ENV_SINGLE_ARG_PARAMETER);
00028           ACE_TRY_CHECK;
00029 
00030           // End the server after its work is done.
00031           status = server.fini (ACE_ENV_SINGLE_ARG_PARAMETER);
00032           ACE_TRY_CHECK;
00033 
00034           if (status == -1)
00035             return 1;
00036         }
00037     }
00038   ACE_CATCH (CORBA::SystemException, sysex)
00039     {
00040       ACE_PRINT_EXCEPTION (sysex, "System Exception");
00041       return 1;
00042     }
00043   ACE_CATCH (CORBA::UserException, userex)
00044     {
00045       ACE_PRINT_EXCEPTION (userex, "User Exception");
00046       return 1;
00047     }
00048   ACE_CATCHANY
00049     {
00050       ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION, "Unknown Exception");
00051       return 1;
00052     }
00053   ACE_ENDTRY;
00054 
00055   return 0;
00056 }


Generated on Mon Jun 16 20:01:56 2003 for TAO_Implementation_Repository by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002