#include CORBA_CLIENT_HEADER(DSC_Engines)
#include CORBA_CLIENT_HEADER(SALOME_Registry)
#include CORBA_CLIENT_HEADER(SALOMEDS)
+#include CORBA_CLIENT_HEADER(Logger)
#include "SALOME_ContainerManager.hxx"
#include "SALOME_Component_i.hxx"
Registry::Components_var registry = Registry::Components::_narrow(objR);
if ( !CORBA::is_nil(registry) && ( pid != registry->getPID() ) )
registry->Shutdown();
+
+ // 6) Logger
+ int argc = 0;
+ char *xargv = (char*)"";
+ char **argv = &xargv;
+ CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
+
+ CORBA::Object_var objLog = CORBA::Object::_nil();
+ CosNaming::NamingContext_var inc;
+ CORBA::Object_var theObj = CORBA::Object::_nil();
+ std::string stdname = "Logger";
+ CosNaming::Name name;
+ name.length(1);
+ name[0].id = CORBA::string_dup(stdname.c_str());
+ try
+ {
+ if(!CORBA::is_nil(orb))
+ theObj = orb->resolve_initial_references("NameService");
+ if (!CORBA::is_nil(theObj))
+ inc = CosNaming::NamingContext::_narrow(theObj);
+ }
+ catch(...)
+ {
+ }
+ if(!CORBA::is_nil(inc)) {
+ try
+ {
+ objLog = inc->resolve(name);
+ SALOME_Logger::Logger_var logger = SALOME_Logger::Logger::_narrow(objLog);
+ if ( !CORBA::is_nil(logger) )
+ logger->shutdown();
+ }
+ catch(...)
+ {
+ }
+ }
}
//=============================================================================
//put message into one special place for all servers
void putMessage(const char* message);
void ping();
+ void SetOrb( CORBA::ORB_ptr orb ) { _orb = CORBA::ORB::_duplicate(orb); return; }
+ void shutdown() { if(!CORBA::is_nil(_orb)) _orb->shutdown(0); };
private:
//if m_putIntoFile is true all messages will be put into special
//otherwise all messages will be put into terminal via cout
std::ofstream m_outputFile;
//synchronisation object
static omni_mutex myLock;
+ CORBA::ORB_ptr _orb;
};
#endif // !defined(SALOME_Logger_Server_include)