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

TAO_DLL_ORB Class Reference

Helper class that initializes an ORB when an instance of this class is dynamically loaded. More...

#include <DLL_ORB.h>

Inheritance diagram for TAO_DLL_ORB:

Inheritance graph
[legend]
Collaboration diagram for TAO_DLL_ORB:

Collaboration graph
[legend]
List of all members.

Public Methods

 TAO_DLL_ORB (void)
 Constructor. More...

 ~TAO_DLL_ORB (void)
 Destructor. More...

virtual int init (int argc, ACE_TCHAR *argv[])
 Initializes ORB when dynamic linking occurs. More...

virtual int fini (void)
 Terminates ORB when dynamic unlinking occurs. More...

virtual int svc (void)
 Run by a daemon thread to handle deferred processing. More...

CORBA::ORB_ptr orb (void)
 Returns a duplicate reference to the ORB. More...


Private Attributes

CORBA::ORB_var orb_
 Reference to the ORB. More...


Detailed Description

Helper class that initializes an ORB when an instance of this class is dynamically loaded.

This class is deprecated. While it does demonstrate how to initialize an ORB in a dynamically loaded object, the fact that it is located in the TAO library forces the TAO library to be linked to the application binary. This prevents TAO from being completely decoupled from an application when dynamic loading is used, hence defeating the purpose of dynamically loading the object!

For an example of how to dynamically load an ORB (actually initialize an ORB inside a dynamically loaded object) that is completely decoupled from an application binary see the TAO/tests/DLL_ORB test.

Definition at line 49 of file DLL_ORB.h.


Constructor & Destructor Documentation

TAO_DLL_ORB::TAO_DLL_ORB void   
 

Constructor.

Definition at line 21 of file DLL_ORB.cpp.

00022   : orb_ ()
00023 {
00024   // Nothing
00025 }

TAO_DLL_ORB::~TAO_DLL_ORB void   
 

Destructor.

Definition at line 27 of file DLL_ORB.cpp.

00028 {
00029   // Nothing
00030 }


Member Function Documentation

int TAO_DLL_ORB::fini void    [virtual]
 

Terminates ORB when dynamic unlinking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 109 of file DLL_ORB.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, TAO_Singleton_Manager::fini, TAO_Singleton_Manager::instance, and orb_.

00110 {
00111   ACE_TRY_NEW_ENV
00112     {
00113       this->orb_->destroy (ACE_ENV_SINGLE_ARG_PARAMETER);
00114       ACE_TRY_CHECK;
00115 
00116       if (TAO_Singleton_Manager::instance ()->fini () == -1)
00117         return -1;
00118     }
00119   ACE_CATCHANY
00120     {
00121       if (TAO_debug_level >= 4)
00122         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00123                              "TAO_DLL_ORB::fini");
00124       return -1;
00125     }
00126   ACE_ENDTRY;
00127 
00128   return 0;
00129 }

int TAO_DLL_ORB::init int    argc,
ACE_TCHAR   argv[]
[virtual]
 

Initializes ORB when dynamic linking occurs.

Reimplemented from ACE_Shared_Object.

Definition at line 33 of file DLL_ORB.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_DEBUG, ACE_ENDTRY, ACE_ENV_ARG_PARAMETER, ACE_LIB_TEXT, ACE_PRINT_EXCEPTION, ACE_TCHAR, ACE_TEXT, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, ACE_Task_Base::activate, ACE_ARGV::add, ACE_ARGV::argc, ACE_ARGV::argv, ACE_Argv_Type_Converter::get_argc, ACE_Argv_Type_Converter::get_ASCII_argv, TAO_Singleton_Manager::init, TAO_Singleton_Manager::instance, CORBA::is_nil, LM_WARNING, orb_, and CORBA::ORB_init.

00034 {
00035   // This class is deprecated.  See the class documentation in
00036   // DLL_ORB.h for details explaining why this is so.
00037   if (TAO_debug_level > 0)
00038     ACE_DEBUG ((LM_WARNING,
00039                 ACE_LIB_TEXT ("TAO (%P|%t) - The TAO_DLL_ORB class is ")
00040                 ACE_LIB_TEXT ("deprecated.  See the class documentation\n")
00041                 ACE_LIB_TEXT ("TAO (%P|%t) - `tao/DLL_ORB.h' for details ")
00042                 ACE_LIB_TEXT ("explaining why this is so.\n")));
00043 
00044 
00045   // Make sure TAO's singleton manager is initialized, and set to not
00046   // register itself with the ACE_Object_Manager since it is under the
00047   // control of the Service Configurator.
00048   int register_with_object_manager = 0;
00049 
00050   if (TAO_Singleton_Manager::instance ()->init (
00051         register_with_object_manager) == -1)
00052     return -1;  // No exceptions yet.
00053 
00054   ACE_TRY_NEW_ENV
00055     {
00056       ACE_ARGV new_argv;
00057 
00058       if (new_argv.add (ACE_TEXT ("dummy")) == -1
00059           || new_argv.add (argv) == -1)
00060         return -1;
00061 
00062       int new_argc = new_argv.argc ();
00063 
00064 #if defined (ACE_HAS_WINCE)
00065       {
00066           // Copy command line parameter from new_argv.
00067           ACE_Argv_Type_Converter command_line(new_argc, new_argv.argv());
00068 
00069           // Initialize the ORB.
00070           this->orb_ = CORBA::ORB_init (command_line.get_argc(),
00071                                         command_line.get_ASCII_argv(),
00072                                         ""
00073                                          ACE_ENV_ARG_PARAMETER);
00074           // command_line will be destroyed here and new_argv will be updated if necessary
00075       }
00076 #else
00077       // Initialize the ORB.
00078       this->orb_ = CORBA::ORB_init (new_argc,
00079                                     new_argv.argv (),
00080                                     ""
00081                                      ACE_ENV_ARG_PARAMETER);
00082 #endif  // ACE_HAS_WINCE
00083 
00084       ACE_TRY_CHECK;
00085 
00086       if (CORBA::is_nil (this->orb_.in ()))
00087         return -1;
00088     }
00089   ACE_CATCHANY
00090     {
00091       if (TAO_debug_level >= 4)
00092         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00093                              "TAO_DLL_ORB::init");
00094 
00095       return -1;
00096     }
00097   ACE_ENDTRY;
00098 
00099 #if defined (ACE_HAS_THREADS)
00100       // Become an Active Object so that the ORB
00101       // will execute in a separate thread.
00102       return this->activate ();
00103 #else
00104       return 0;
00105 #endif /* ACE_HAS_THREADS */
00106 }

ACE_INLINE CORBA::ORB_ptr TAO_DLL_ORB::orb void   
 

Returns a duplicate reference to the ORB.

Definition at line 7 of file DLL_ORB.inl.

00008 {
00009   return CORBA::ORB::_duplicate (this->orb_.in());
00010 }

int TAO_DLL_ORB::svc void    [virtual]
 

Run by a daemon thread to handle deferred processing.

Reimplemented from ACE_Task_Base.

Definition at line 132 of file DLL_ORB.cpp.

References ACE_ANY_EXCEPTION, ACE_CATCHANY, ACE_ENDTRY, ACE_ENV_SINGLE_ARG_PARAMETER, ACE_PRINT_EXCEPTION, ACE_TRY_CHECK, ACE_TRY_NEW_ENV, and orb_.

00133 {
00134   ACE_TRY_NEW_ENV
00135     {
00136       // Run the ORB event loop in its own thread.
00137       this->orb_->run (ACE_ENV_SINGLE_ARG_PARAMETER);
00138       ACE_TRY_CHECK;
00139     }
00140   ACE_CATCHANY
00141     {
00142       if (TAO_debug_level >= 4)
00143         ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
00144                              "TAO_DLL_ORB::svc");
00145       return -1;
00146     }
00147   ACE_ENDTRY;
00148 
00149   return 0;
00150 }


Member Data Documentation

CORBA::ORB_var TAO_DLL_ORB::orb_ [private]
 

Reference to the ORB.

Definition at line 75 of file DLL_ORB.h.

Referenced by fini, init, and svc.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 15:14:35 2003 for TAO by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002