Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / Monitor / Monitor.cpp
blob65e54c5ada960a92afa7f7b6a50638ab53c618d9
1 // -*- C++ -*-
2 #include "tao/Monitor/Monitor.h"
3 #include "tao/Monitor/Monitor_Impl.h"
5 #if defined (TAO_HAS_MONITOR_FRAMEWORK) && (TAO_HAS_MONITOR_FRAMEWORK == 1)
7 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
9 TAO_Monitor_Init::TAO_Monitor_Init ()
13 CORBA::Object_ptr
14 TAO_Monitor_Init::create_object (CORBA::ORB_ptr orb,
15 int,
16 ACE_TCHAR *[])
18 try
20 CORBA::Object_var obj =
21 orb->resolve_initial_references ("RootPOA");
23 PortableServer::POA_var poa =
24 PortableServer::POA::_narrow (obj.in ());
26 PortableServer::POAManager_var mgr =
27 poa->the_POAManager ();
29 mgr->activate ();
31 Monitor_Impl *servant = 0;
32 ACE_NEW_RETURN (servant,
33 Monitor_Impl (orb),
34 CORBA::Object::_nil ());
36 PortableServer::ObjectId_var id =
37 poa->activate_object (servant);
39 PortableServer::ServantBase_var safe_servant = servant;
40 obj = servant->_this ();
42 return obj._retn ();
44 catch (const CORBA::Exception&)
48 return CORBA::Object::_nil ();
51 // This initializer is very similar to the ORBInitializer_Registry::init.
52 // This one is used during static initialization while the other is used
53 // when Monitor is a shared library.
54 int
55 TAO_Monitor_Init::Initializer ()
57 return ACE_Service_Config::process_directive (ace_svc_desc_TAO_Monitor_Init);
61 ACE_STATIC_SVC_DEFINE (TAO_Monitor_Init,
62 ACE_TEXT ("Monitor_Init"),
63 ACE_SVC_OBJ_T,
64 &ACE_SVC_NAME (TAO_Monitor_Init),
65 ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
67 ACE_FACTORY_DEFINE (TAO_Monitor, TAO_Monitor_Init)
69 TAO_END_VERSIONED_NAMESPACE_DECL
71 #endif /* TAO_HAS_MONITOR_FRAMEWORK==1 */