From 29b4af83576e1179b3a6170055a670d5fe943910 Mon Sep 17 00:00:00 2001 From: prascle Date: Wed, 14 Jan 2004 16:04:02 +0000 Subject: [PATCH] PR: mergefrom_PRAS_br2_14Jan04 --- bin/runSalome.py | 23 +- idl/SALOMEDS_Attributes.idl | 40 +++ src/Container/Makefile.in | 2 +- src/Container/SALOME_Container.cxx | 290 +++++++++-------- src/DataTypeCatalog/Makefile.in | 2 +- .../SALOME_DataTypeCatalog_Server.cxx | 196 +++++------ src/LifeCycleCORBA/Makefile.in | 2 +- src/Loader/Makefile.in | 2 +- src/Loader/SALOME_Session_Loader.cxx | 1 + src/Makefile.in | 15 +- src/ModuleCatalog/Makefile.in | 2 +- .../SALOME_ModuleCatalog_Server.cxx | 218 +++++++------ src/Notification/Makefile.in | 2 +- src/Registry/Makefile.in | 2 +- src/Registry/SALOME_Registry_Server.cxx | 308 +++++++++--------- src/RessourcesCatalog/Makefile.in | 2 +- .../SALOME_RessourcesCatalog_Server.cxx | 183 ++++++----- .../Handle_SALOMEDS_ExternalFileDef.hxx | 85 +++++ src/SALOMEDS/Handle_SALOMEDS_FileType.hxx | 85 +++++ src/SALOMEDS/Makefile.in | 6 +- src/SALOMEDS/README_attributes | 46 +++ .../SALOMEDS_AttributeExternalFileDef_i.cxx | 48 +++ .../SALOMEDS_AttributeExternalFileDef_i.hxx | 56 ++++ src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx | 48 +++ src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx | 56 ++++ src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl | 76 +++++ src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx | 114 +++++++ src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx | 108 ++++++ src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx | 73 +++++ src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx | 18 + src/SALOMEDS/SALOMEDS_FileType.cdl | 76 +++++ src/SALOMEDS/SALOMEDS_FileType.cxx | 114 +++++++ src/SALOMEDS/SALOMEDS_FileType.hxx | 108 ++++++ src/SALOMEDS/SALOMEDS_FileType.ixx | 73 +++++ src/SALOMEDS/SALOMEDS_FileType.jxx | 18 + src/SALOMEDS/SALOMEDS_SObject_i.cxx | 24 ++ src/SALOMEDS/SALOMEDS_Server.cxx | 244 +++++++------- src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx | 32 ++ src/SALOMELocalTrace/Makefile.in | 49 +++ src/SALOMELocalTrace/SALOME_Log.cxx | 57 ++++ src/SALOMELocalTrace/SALOME_Log.hxx | 85 +++++ src/SALOMELogger/Makefile.in | 50 +++ src/SALOMELogger/SALOME_LoggerClient.cxx | 154 +++++++++ src/Session/Makefile.in | 2 +- src/Session/SALOME_Session_Server.cxx | 181 +++++----- src/TOOLSDS/Makefile.in | 2 +- src/TestContainer/Makefile.in | 2 +- src/TestContainer/TestContainer.cxx | 139 ++++---- src/Utils/Makefile.in | 2 +- src/Utils/Utils_SALOME_Exception.cxx | 2 +- src/Utils/utilities.h | 130 +++----- 51 files changed, 2709 insertions(+), 944 deletions(-) create mode 100644 src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx create mode 100644 src/SALOMEDS/Handle_SALOMEDS_FileType.hxx create mode 100644 src/SALOMEDS/README_attributes create mode 100644 src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx create mode 100644 src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx create mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl create mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx create mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx create mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx create mode 100644 src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx create mode 100644 src/SALOMEDS/SALOMEDS_FileType.cdl create mode 100644 src/SALOMEDS/SALOMEDS_FileType.cxx create mode 100644 src/SALOMEDS/SALOMEDS_FileType.hxx create mode 100644 src/SALOMEDS/SALOMEDS_FileType.ixx create mode 100644 src/SALOMEDS/SALOMEDS_FileType.jxx create mode 100644 src/SALOMELocalTrace/Makefile.in create mode 100644 src/SALOMELocalTrace/SALOME_Log.cxx create mode 100644 src/SALOMELocalTrace/SALOME_Log.hxx create mode 100644 src/SALOMELogger/Makefile.in create mode 100644 src/SALOMELogger/SALOME_LoggerClient.cxx diff --git a/bin/runSalome.py b/bin/runSalome.py index d7c7a496c..d4a702a52 100755 --- a/bin/runSalome.py +++ b/bin/runSalome.py @@ -255,6 +255,20 @@ add_path(os.path.join(kernel_root_dir,"bin","salome")) for module in liste_modules: module_root_dir=modules_root_dir[module] add_ld_library_path(os.path.join(module_root_dir,"lib","salome")) + +if with_logger: + locdir=os.environ['PWD'] + libtracedir=os.path.join(locdir,"libSalomeTrace") + libtrace = os.path.join(kernel_root_dir,"lib","salome","libSALOMELoggerClient.so.0.0.0") + libtraceln = os.path.join(libtracedir,"libSALOMELocalTrace.so") + aCommand = 'rm -rf ' + libtracedir + "; " + aCommand += 'mkdir ' + libtracedir + "; " + aCommand += 'ln -s ' + libtrace + " " + libtraceln + "; " + aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0; " + aCommand += 'ln -s ' + libtrace + " " + libtraceln + ".0.0.0; " + os.system(aCommand) + add_ld_library_path(libtracedir) + #print "LD_LIBRARY_PATH=",os.environ["LD_LIBRARY_PATH"] # @@ -376,6 +390,11 @@ def startSalome(): import SALOME session=clt.waitNS("/Kernel/Session",SALOME.Session) + + theComputer = os.getenv("HOSTNAME") + computerSplitName = theComputer.split('.') + theComputer = computerSplitName[0] + # # Lancement Container C++ local # @@ -386,10 +405,6 @@ def startSalome(): # Attente de la disponibilité du Container C++ local dans le Naming Service # - theComputer = os.getenv("HOSTNAME") - computerSplitName = theComputer.split('.') - theComputer = computerSplitName[0] - clt.waitNS("/Containers/" + theComputer + "/FactoryServer") # diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index b47f39bea..fca28960a 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -275,6 +275,46 @@ module SALOMEDS void SetValue(in string value); }; + //========================================================================== +/*! \brief External File definition + + This attribute stores a path to an External File. +*/ + //========================================================================== + interface AttributeExternalFileDef: GenericAttribute + { +/*! + Returns the value of this attribute +
See also an example of this method usage in batchmode of %SALOME application. +*/ + string Value(); +/*! + Sets the value of this attribute +
See also an example of this method usage in batchmode of %SALOME application. +*/ + void SetValue(in string value); + }; + + //========================================================================== +/*! \brief File Type definition + + This attribute stores an external File Type (see ExternalFileDef attribute). +*/ + //========================================================================== + interface AttributeFileType: GenericAttribute + { +/*! + Returns the value of this attribute +
See also an example of this method usage in batchmode of %SALOME application. +*/ + string Value(); +/*! + Sets the value of this attribute +
See also an example of this method usage in batchmode of %SALOME application. +*/ + void SetValue(in string value); + }; + //========================================================================== //Below the list of presentation attributes for display study tree in browser //========================================================================== diff --git a/src/Container/Makefile.in b/src/Container/Makefile.in index fdf28da44..87f372867 100644 --- a/src/Container/Makefile.in +++ b/src/Container/Makefile.in @@ -53,7 +53,7 @@ BIN_SERVER_IDL = SALOME_Component.idl CPPFLAGS+= $(PYTHON_INCLUDES) -LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSalomeLoggerServer +LDFLAGS+= -lSalomeNS -lRegistry -lOpUtil -lSalomeNotification -lSALOMELocalTrace LIBS += -Xlinker -export-dynamic $(PYTHON_LIBS) diff --git a/src/Container/SALOME_Container.cxx b/src/Container/SALOME_Container.cxx index ce8c05628..77a06b9de 100644 --- a/src/Container/SALOME_Container.cxx +++ b/src/Container/SALOME_Container.cxx @@ -26,194 +26,202 @@ // Module : SALOME // $Header$ -using namespace std; -using namespace std; #include -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" #include "SALOME_Container_i.hxx" #include #include #include "utilities.h" +using namespace std; -//#define CHECKTIME #ifdef CHECKTIME #include #endif #include -static PyMethodDef MethodPyVoidMethod[] = { - { NULL, NULL } -}; +static PyMethodDef MethodPyVoidMethod[] = + { + { NULL, NULL } + }; int main(int argc, char* argv[]) { INFOS_COMPILATION; BEGIN_OF(argv[0]) - Py_Initialize() ; + Py_Initialize() ; PySys_SetArgv( argc , argv ) ; Py_InitModule( "InitPyRunMethod" , MethodPyVoidMethod ) ; - try { + try + { - // Initialise the ORB. -// CORBA::ORB_var orb = CORBA::ORB_init(argc, argv); - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - CORBA::ORB_var &orb = init( argc , argv ) ; + // Initialise the ORB. + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init( argc , argv ) ; - // Obtain a reference to the root POA. - // obtain the root poa manager - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var root_poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - int CONTAINER=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var pman; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - root_poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(root_poa)) - pman = root_poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)) - inc = CosNaming::NamingContext::_narrow(theObj); - } - catch( CORBA::COMM_FAILURE& ) + // Obtain a reference to the root POA. + // obtain the root poa manager + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var root_poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int CONTAINER=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var pman; + for (int i = 1; i<=NumberOfTries; i++) { - MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + root_poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(root_poa)) + pman = root_poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Container: Naming Service was found" ) - if(EnvL==1){ - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name); - } - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Container: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Container: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Container: Logger Server was found" ) - log->ping(); - CONTAINER=1; - break; - } - }} - } - if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Container: Naming Service was found" ); + if(EnvL==1) + { + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Container: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Container: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Container: Logger Server was found" ); + CONTAINER=1; + break; + } + } + } + } + if ((CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) break; - } + } - // - // define policy objects - PortableServer::ImplicitActivationPolicy_var implicitActivation = - root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ; + // define policy objects + PortableServer::ImplicitActivationPolicy_var implicitActivation = + root_poa->create_implicit_activation_policy(PortableServer::NO_IMPLICIT_ACTIVATION) ; - // default = NO_IMPLICIT_ACTIVATION - PortableServer::ThreadPolicy_var threadPolicy = - root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ; - // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL + // default = NO_IMPLICIT_ACTIVATION + PortableServer::ThreadPolicy_var threadPolicy = + root_poa->create_thread_policy(PortableServer::ORB_CTRL_MODEL) ; + // default = ORB_CTRL_MODEL, other choice SINGLE_THREAD_MODEL - // create policy list - CORBA::PolicyList policyList; - policyList.length(2); - policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ; - policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ; - - // create the child POA - PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ; - PortableServer::POA_var factory_poa = - root_poa->create_POA("factory_poa", pman, policyList) ; + // create policy list + CORBA::PolicyList policyList; + policyList.length(2); + policyList[0] = PortableServer::ImplicitActivationPolicy::_duplicate(implicitActivation) ; + policyList[1] = PortableServer::ThreadPolicy::_duplicate(threadPolicy) ; + + // create the child POA + PortableServer::POAManager_var nil_mgr = PortableServer::POAManager::_nil() ; + PortableServer::POA_var factory_poa = + root_poa->create_POA("factory_poa", pman, policyList) ; //with nil_mgr instead of pman, a new POA manager is created with the new POA - // destroy policy objects - implicitActivation->destroy() ; - threadPolicy->destroy() ; + // destroy policy objects + implicitActivation->destroy() ; + threadPolicy->destroy() ; - char *containerName = ""; - if (argc >1) - { - containerName = argv[1] ; - } + char *containerName = ""; + if (argc >1) + { + containerName = argv[1] ; + } - Engines_Container_i * myContainer - = new Engines_Container_i(orb, factory_poa, containerName , argc , argv ); + Engines_Container_i * myContainer + = new Engines_Container_i(orb, factory_poa, containerName , argc , argv ); -// Engines_Container_i * myContainer -// = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa); + // Engines_Container_i * myContainer + // = new Engines_Container_i(string(argv[1]),string(argv[2]), orb, factory_poa); - // use naming service -// myContainer->_NS.init_orb(orb); -// Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this()); -// myContainer->_NS.Register(pCont, argv[2]); + // use naming service + // myContainer->_NS.init_orb(orb); + // Engines::Container_ptr pCont = Engines::Container::_narrow(myContainer->_this()); + // myContainer->_NS.Register(pCont, argv[2]); - pman->activate(); + pman->activate(); #ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); - timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); - timer.ShowAbsolute(); + Utils_Timer timer; + timer.Start(); + timer.Stop(); + MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); + timer.ShowAbsolute(); #endif - orb->run(); + orb->run(); - orb->destroy(); - } + orb->destroy(); + } catch(CORBA::SystemException&) - { - INFOS("Caught CORBA::SystemException.") - } + { + INFOS("Caught CORBA::SystemException.") + } catch(PortableServer::POA::WrongPolicy&) - { - INFOS("Caught CORBA::WrongPolicyException.") - } + { + INFOS("Caught CORBA::WrongPolicyException.") + } catch(PortableServer::POA::ServantAlreadyActive&) - { - INFOS("Caught CORBA::ServantAlreadyActiveException") - } + { + INFOS("Caught CORBA::ServantAlreadyActiveException") + } catch(CORBA::Exception&) - { - INFOS("Caught CORBA::Exception.") - } + { + INFOS("Caught CORBA::Exception.") + } catch(...) - { - INFOS("Caught unknown exception.") - } + { + INFOS("Caught unknown exception.") + } END_OF(argv[0]); } diff --git a/src/DataTypeCatalog/Makefile.in b/src/DataTypeCatalog/Makefile.in index 1017cafe0..5759b3b46 100644 --- a/src/DataTypeCatalog/Makefile.in +++ b/src/DataTypeCatalog/Makefile.in @@ -54,6 +54,6 @@ BIN_SERVER_IDL = SALOME_DataTypeCatalog.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= -LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx index 95c4ce6a1..a29401c51 100644 --- a/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx +++ b/src/DataTypeCatalog/SALOME_DataTypeCatalog_Server.cxx @@ -26,120 +26,132 @@ // Module : SALOME // $Header$ -using namespace std; #include #include "SALOME_NamingService.hxx" #include "SALOME_DataTypeCatalog_impl.hxx" #include "utilities.h" -# include "Utils_SINGLETON.hxx" +#include "Utils_SINGLETON.hxx" +using namespace std; + int main(int argc,char **argv) { - try { - CosNaming::NamingContext_var _rootContext, catalogContext; - // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - // initialize POA - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - int DATA_TYPE_CATALOG=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var mgr; + try + { + CosNaming::NamingContext_var _rootContext, catalogContext; + // initialize the ORB + CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); + // initialize POA + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + int DATA_TYPE_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - mgr = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)) - inc = CosNaming::NamingContext::_narrow(theObj);} - catch( CORBA::COMM_FAILURE& ) - { - MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) - } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Data Type Catalog: Naming Service was found" ) - if(EnvL==1){ - CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; - SALOME_NamingService &NS = *SINGLETON_::Instance() ; - NS.init_orb( orb1 ) ; - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name);} - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Data Type Catalog: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Data Type Catalog: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Data Type Catalog: Logger Server was found" ) - log->ping(); - DATA_TYPE_CATALOG=1; - break; + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj);} + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Data Type Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); } + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Data Type Catalog: Naming Service was found" ); + if(EnvL==1) + { + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Data Type Catalog: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Data Type Catalog: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Data Type Catalog: Logger Server was found" ); + DATA_TYPE_CATALOG=1; + break; + } - }} - } - if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) - break; + } + } } + if ((DATA_TYPE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } - // - // Active catalog + // Active catalog - SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv); - poa->activate_object (Catalogue_i); + SALOME_DataTypeCatalogImpl* Catalogue_i = new SALOME_DataTypeCatalogImpl(argc, argv); + poa->activate_object (Catalogue_i); - mgr->activate(); + mgr->activate(); - CORBA::Object_ptr myCata = Catalogue_i->_this(); + CORBA::Object_ptr myCata = Catalogue_i->_this(); - // initialise Naming Service - SALOME_NamingService *_NS; - _NS = new SALOME_NamingService(orb); - // register Catalog in Naming Service - _NS->Register(myCata ,"/Kernel/DataTypeCatalog"); + // initialise Naming Service + SALOME_NamingService *_NS; + _NS = new SALOME_NamingService(orb); + // register Catalog in Naming Service + _NS->Register(myCata ,"/Kernel/DataTypeCatalog"); - MESSAGE("Running DataType Catalog Server.") + MESSAGE("Running DataType Catalog Server.") - orb->run(); + orb->run(); - poa->destroy(1,1); + poa->destroy(1,1); - } - catch(CORBA::SystemException&) { + } + catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException.") - } - catch(CORBA::Exception&) { + } + catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception.") - } + } return 0; } diff --git a/src/LifeCycleCORBA/Makefile.in b/src/LifeCycleCORBA/Makefile.in index 6f4a461ea..33ee1ac81 100644 --- a/src/LifeCycleCORBA/Makefile.in +++ b/src/LifeCycleCORBA/Makefile.in @@ -51,7 +51,7 @@ BIN_SRC = BIN_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl \ SALOME_ModuleCatalog.idl -LDFLAGS += -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS += -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/Loader/Makefile.in b/src/Loader/Makefile.in index dd736d4ed..6caf10e2c 100644 --- a/src/Loader/Makefile.in +++ b/src/Loader/Makefile.in @@ -31,7 +31,7 @@ BIN_CLIENT_IDL = SALOME_Session.idl \ CPPFLAGS+=$(QT_MT_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/Loader/SALOME_Session_Loader.cxx b/src/Loader/SALOME_Session_Loader.cxx index acd0ea377..3aff04564 100644 --- a/src/Loader/SALOME_Session_Loader.cxx +++ b/src/Loader/SALOME_Session_Loader.cxx @@ -13,6 +13,7 @@ using namespace std; #include #include CORBA_CLIENT_HEADER(SALOME_Session) +#include CORBA_CLIENT_HEADER(Logger) #include "Utils_ORB_INIT.hxx" #include "Utils_SINGLETON.hxx" diff --git a/src/Makefile.in b/src/Makefile.in index ed8d2f4ec..89f82d775 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -32,10 +32,17 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = MSG2QM Logger Utils PatchQt NamingService Registry ModuleCatalog DataTypeCatalog \ - RessourcesCatalog Notification NOTIFICATION_SWIG Container TestContainer LifeCycleCORBA \ - HDFPersist VTKFilter OBJECT TOOLSDS SALOMEDS SALOMEGUI Plot2d VTKViewer OCCViewer SUPERVGraph \ - Session SALOME_SWIG TOOLSGUI SALOME_PY RegistryDisplay ModuleGenerator SALOME_PYQT Loader +SUBDIRS = MSG2QM SALOMELocalTrace Logger SALOMELogger Utils PatchQt \ + NamingService Registry \ + ModuleCatalog DataTypeCatalog RessourcesCatalog \ + Notification NOTIFICATION_SWIG \ + Container TestContainer LifeCycleCORBA HDFPersist \ + VTKFilter OBJECT \ + TOOLSDS SALOMEDS \ + SALOMEGUI Plot2d VTKViewer OCCViewer \ + SUPERVGraph \ + Session SALOME_SWIG TOOLSGUI SALOME_PY \ + RegistryDisplay ModuleGenerator SALOME_PYQT Loader ifeq (@WITHMPICH@,yes) SUBDIRS+= MPIContainer diff --git a/src/ModuleCatalog/Makefile.in b/src/ModuleCatalog/Makefile.in index c61ad8487..97a1d9816 100644 --- a/src/ModuleCatalog/Makefile.in +++ b/src/ModuleCatalog/Makefile.in @@ -57,6 +57,6 @@ BIN_SERVER_IDL = SALOME_ModuleCatalog.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= -ftemplate-depth-42 -LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS+= $(QT_MT_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx index 65d7566b5..c206cc846 100644 --- a/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx +++ b/src/ModuleCatalog/SALOME_ModuleCatalog_Server.cxx @@ -24,141 +24,147 @@ // File : SALOME_ModuleCatalog_Server.cxx // Module : SALOME -using namespace std; /* $Header$ */ + #include #include "SALOME_NamingService.hxx" #include "SALOME_ModuleCatalog_impl.hxx" #include "utilities.h" -# include "Utils_SINGLETON.hxx" +#include "Utils_SINGLETON.hxx" -//#define CHECKTIME -#ifdef CHECKTIME -#include -#endif - -//#define CHECKTIME #ifdef CHECKTIME #include #endif +using namespace std; int main(int argc,char **argv) { - try { - CosNaming::NamingContext_var _rootContext, catalogContext; + try + { + CosNaming::NamingContext_var _rootContext, catalogContext; - // initialize the ORB + // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - // initialize POA - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - int MODULE_CATALOG=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var mgr; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - mgr = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - } - catch( CORBA::COMM_FAILURE& ) - { - MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) - } - if (!CORBA::is_nil(theObj)){ - inc = CosNaming::NamingContext::_narrow(theObj); - if(!CORBA::is_nil(inc)) { - MESSAGE( "Module Catalog Server: Naming Service was found" ) - if(EnvL==1){ - CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; - SALOME_NamingService &NS = *SINGLETON_::Instance() ; - NS.init_orb( orb1 ) ; - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name);} - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Module Catalog Server: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Module Catalog Server: Logger Server was found" ) - log->ping(); - MODULE_CATALOG=1; - break; - } - }} - }} - if ((MODULE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) - break; - } + // initialize POA + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + int MODULE_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + } + if (!CORBA::is_nil(theObj)) + { + inc = CosNaming::NamingContext::_narrow(theObj); + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Module Catalog Server: Naming Service was found" ); + if(EnvL==1) + { + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name);} + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Module Catalog Server: Unknown exception" ) ; + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Module Catalog Server: Logger Server was found" ); + MODULE_CATALOG=1; + break; + } + } + } + } + } + if ((MODULE_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } - // - // Active catalog + // Active catalog - SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv); - poa->activate_object (Catalogue_i); + SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv); + poa->activate_object (Catalogue_i); - mgr->activate(); + mgr->activate(); - CORBA::Object_ptr myCata = Catalogue_i->_this(); + CORBA::Object_ptr myCata = Catalogue_i->_this(); - // initialise Naming Service - SALOME_NamingService *_NS; - _NS = new SALOME_NamingService(orb); - // register Catalog in Naming Service - _NS->Register(myCata ,"/Kernel/ModulCatalog"); + // initialise Naming Service + SALOME_NamingService *_NS; + _NS = new SALOME_NamingService(orb); + // register Catalog in Naming Service + _NS->Register(myCata ,"/Kernel/ModulCatalog"); - MESSAGE("Running CatalogServer."); + MESSAGE("Running CatalogServer."); #ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); - timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); - timer.ShowAbsolute(); + Utils_Timer timer; + timer.Start(); + timer.Stop(); + MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); + timer.ShowAbsolute(); #endif - orb->run(); + orb->run(); - poa->destroy(1,1); + poa->destroy(1,1); - } - catch(CORBA::SystemException&) { + } + catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException.") - } - catch(CORBA::Exception&) { + } + catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception.") - } + } return 0; } diff --git a/src/Notification/Makefile.in b/src/Notification/Makefile.in index 0da007a70..4d43c67a5 100644 --- a/src/Notification/Makefile.in +++ b/src/Notification/Makefile.in @@ -47,7 +47,7 @@ LIB_SRC = NOTIFICATION.cxx \ NOTIFICATION_Supplier.cxx \ NOTIFICATION_Consumer.cxx -LDFLAGS+= -lOpUtil +LDFLAGS+= -lOpUtil -lSALOMELocalTrace OMNIORB_IDLCXXFLAGS+= -Wbtp @CONCLUDE@ diff --git a/src/Registry/Makefile.in b/src/Registry/Makefile.in index 823ac6241..5ff83cb1d 100644 --- a/src/Registry/Makefile.in +++ b/src/Registry/Makefile.in @@ -50,6 +50,6 @@ BIN = SALOME_Registry_Server BIN_SRC = RegistryService.cxx BIN_SERVER_IDL = SALOME_Registry.idl -LDFLAGS+= -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS+= -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/Registry/SALOME_Registry_Server.cxx b/src/Registry/SALOME_Registry_Server.cxx index e4aee0f7d..3e5a5b636 100644 --- a/src/Registry/SALOME_Registry_Server.cxx +++ b/src/Registry/SALOME_Registry_Server.cxx @@ -26,181 +26,189 @@ // Module : SALOME // $Header$ -using namespace std; -# include -# include -# include +#include +#include +#include extern "C" { # include } -# include "utilities.h" -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" -# include "Utils_SALOME_Exception.hxx" -# include "Utils_CommException.hxx" -# include "ServiceUnreachable.hxx" -# include "SALOME_NamingService.hxx" -# include "RegistryService.hxx" +#include "utilities.h" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "Utils_CommException.hxx" +#include "ServiceUnreachable.hxx" +#include "SALOME_NamingService.hxx" +#include "RegistryService.hxx" -//#define CHECKTIME #ifdef CHECKTIME #include #endif +using namespace std; int main( int argc , char **argv ) { - BEGIN_OF( argv[0] ) - INFOS_COMPILATION - SCRUTE(argc) - if( argc<3 ) + BEGIN_OF( argv[0] ) + INFOS_COMPILATION + SCRUTE(argc) + if( argc<3 ) + { + MESSAGE("you must provide the Salome session name when you call SALOME_Registry_Server") ; + throw CommException("you must provide the Salome session name when you call SALOME_Registry_Server") ; + } + const char *ptrSessionName=0 ; + + int k=0 ; + for ( k=1 ; k0) ; + const char *registryName = "Registry" ; + ORB_INIT &init = *SINGLETON_::Instance() ; + CORBA::ORB_var &orb = init( argc , argv ) ; + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + Registry::Components_var varComponents; + int REGISTRY=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var manager; + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + manager = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) { - if( strcmp(argv[k],"--salome_session")==0 ) - { - ptrSessionName=argv[k+1] ; - break ; - } + MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); } - ASSERT(ptrSessionName) ; - ASSERT(strlen( ptrSessionName )>0) ; - const char *registryName = "Registry" ; - ORB_INIT &init = *SINGLETON_::Instance() ; - CORBA::ORB_var &orb = init( argc , argv ) ; - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - Registry::Components_var varComponents; - int REGISTRY=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var manager; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - manager = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)) - inc = CosNaming::NamingContext::_narrow(theObj); - } - catch( CORBA::COMM_FAILURE& ) + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Registry Server: Naming Service was found" ); + if(EnvL==1) { - MESSAGE( "Registry Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) - } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Registry Server: Naming Service was found" ) - if(EnvL==1){ - for(int j=1; j<=NumberOfTries; j++){ + for(int j=1; j<=NumberOfTries; j++) + { if (j!=1) a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name); - } - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Registry Server: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Registry Server: Unknown exception" ) } - + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Registry Server: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Registry Server: Unknown exception" ); + } if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Registry Server: Logger Server was found" ) - log->ping(); - REGISTRY=1; - break; - } - }} - } - if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) - break; - } - // - try - { - naming.init_orb( orb ) ; - RegistryService *ptrRegistry = SINGLETON_::Instance() ; - ptrRegistry->SessionName( ptrSessionName ) ; - varComponents = ptrRegistry->_this() ; - // The RegistryService must not already exist. + { + MESSAGE( "Module Catalog Server: Logger Server was found" ); + REGISTRY=1; + break; + } + } + } + } + if ((REGISTRY==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } + + try + { + naming.init_orb( orb ) ; + RegistryService *ptrRegistry = SINGLETON_::Instance() ; + ptrRegistry->SessionName( ptrSessionName ) ; + varComponents = ptrRegistry->_this() ; + // The RegistryService must not already exist. - try - { - CORBA::Object_var pipo = naming.Resolve( registryName ) ; - if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ; - MESSAGE("RegistryService servant already existing" ) ; - exit( EXIT_FAILURE ) ; - } - catch( const ServiceUnreachable &ex ) - { - } - catch( const CORBA::Exception &exx ) - { - } - string absoluteName = string("/") + registryName; - naming.Register( varComponents , absoluteName.c_str() ) ; - MESSAGE("On attend les requetes des clients") ; - try - { - // Activation du POA - MESSAGE("Activation du POA") ; - manager->activate() ; + try + { + CORBA::Object_var pipo = naming.Resolve( registryName ) ; + if (CORBA::is_nil(pipo) ) throw ServiceUnreachable() ; + MESSAGE("RegistryService servant already existing" ) ; + exit( EXIT_FAILURE ) ; + } + catch( const ServiceUnreachable &ex ) + { + } + catch( const CORBA::Exception &exx ) + { + } + string absoluteName = string("/") + registryName; + naming.Register( varComponents , absoluteName.c_str() ) ; + MESSAGE("On attend les requetes des clients") ; + try + { + // Activation du POA + MESSAGE("Activation du POA") ; + manager->activate() ; - // Lancement de l'ORB - MESSAGE("Lancement de l'ORB") ; + // Lancement de l'ORB + MESSAGE("Lancement de l'ORB") ; #ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); - timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); - timer.ShowAbsolute(); + Utils_Timer timer; + timer.Start(); + timer.Stop(); + MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); + timer.ShowAbsolute(); #endif - orb->run() ; - } - catch( const CORBA::Exception &ex ) - { - MESSAGE("Erreur systeme") ; - return EXIT_FAILURE ; - } + orb->run() ; + } + catch( const CORBA::Exception &ex ) + { + MESSAGE("Erreur systeme") ; + return EXIT_FAILURE ; + } - } - catch( const SALOME_Exception &ex ) - { - MESSAGE( "Communication Error : " << ex.what() ) - return EXIT_FAILURE ; - } + } + catch( const SALOME_Exception &ex ) + { + MESSAGE( "Communication Error : " << ex.what() ) + return EXIT_FAILURE ; + } - END_OF( argv[0] ) ; - return 0 ; + END_OF( argv[0] ) ; + return 0 ; } diff --git a/src/RessourcesCatalog/Makefile.in b/src/RessourcesCatalog/Makefile.in index a98eab8bf..c129dad04 100644 --- a/src/RessourcesCatalog/Makefile.in +++ b/src/RessourcesCatalog/Makefile.in @@ -54,7 +54,7 @@ BIN_SERVER_IDL = SALOME_RessourcesCatalog.idl CPPFLAGS+= $(QT_MT_INCLUDES) CXXFLAGS+= -LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSalomeLoggerServer +LDFLAGS+= $(QT_MT_LIBS) $(OGL_LIBS) -lSalomeNS -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx index 827efd482..e9a16146c 100644 --- a/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx +++ b/src/RessourcesCatalog/SALOME_RessourcesCatalog_Server.cxx @@ -26,117 +26,128 @@ // Module : SALOME // $Header$ -using namespace std; #include #include "SALOME_NamingService.hxx" #include "SALOME_RessourcesCatalog_impl.hxx" #include "utilities.h" -# include "Utils_SINGLETON.hxx" +#include "Utils_SINGLETON.hxx" +using namespace std; + int main(int argc,char **argv) { - try { - CosNaming::NamingContext_var _rootContext, catalogContext; + try + { + CosNaming::NamingContext_var _rootContext, catalogContext; - // initialize the ORB + // initialize the ORB - CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); + CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv); - // initialize POA - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - int RESSOURCES_CATALOG=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var mgr; - for (int i = 1; i<=NumberOfTries; i++){ + // initialize POA + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int RESSOURCES_CATALOG=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var mgr; + for (int i = 1; i<=NumberOfTries; i++) + { if (i!=1) a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - mgr = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)) - inc = CosNaming::NamingContext::_narrow(theObj); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + mgr = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); } catch( CORBA::COMM_FAILURE& ) { - MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + MESSAGE( "Ressources Catalog: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + } + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Ressources Catalog: Naming Service was found" ); + if(EnvL==1) + { + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try{ + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Ressources Catalog: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Ressources Catalog: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Ressources Catalog: Loger Server was found" ); + RESSOURCES_CATALOG=1; + break; + } + } } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Ressources Catalog: Naming Service was found" ) - if(EnvL==1){ - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name); - } - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Ressources Catalog: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Ressources Catalog: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Ressources Catalog: Loger Server was found" ) - log->ping(); - RESSOURCES_CATALOG=1; - break; - } - }} - } + } if ((RESSOURCES_CATALOG==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) break; - } - // - // Active catalog + } + + // Active catalog - SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv); - poa->activate_object (Catalogue_i); - mgr->activate(); - CORBA::Object_ptr myCata = Catalogue_i->_this(); + SALOME_RessourcesCatalogImpl* Catalogue_i = new SALOME_RessourcesCatalogImpl(argc, argv); + poa->activate_object (Catalogue_i); + mgr->activate(); + CORBA::Object_ptr myCata = Catalogue_i->_this(); - // initialise Naming Service - SALOME_NamingService *_NS; - _NS = new SALOME_NamingService(orb); - // register Catalog in Naming Service - _NS->Register(myCata ,"/Kernel/RessourcesCatalog"); + // initialise Naming Service + SALOME_NamingService *_NS; + _NS = new SALOME_NamingService(orb); + // register Catalog in Naming Service + _NS->Register(myCata ,"/Kernel/RessourcesCatalog"); - MESSAGE("Running Ressources Catalog Server.") + MESSAGE("Running Ressources Catalog Server.") - orb->run(); + orb->run(); - poa->destroy(1,1); + poa->destroy(1,1); - } - catch(CORBA::SystemException&) { + } + catch(CORBA::SystemException&) { INFOS("Caught CORBA::SystemException.") - } - catch(CORBA::Exception&) { + } + catch(CORBA::Exception&) { INFOS("Caught CORBA::Exception.") - } + } return 0; } diff --git a/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx new file mode 100644 index 000000000..124e721c3 --- /dev/null +++ b/src/SALOMEDS/Handle_SALOMEDS_ExternalFileDef.hxx @@ -0,0 +1,85 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile +#define _Handle_SALOMEDS_ExternalFileDef_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TDataStd_Comment_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TDataStd_Comment); +class SALOMEDS_ExternalFileDef; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_ExternalFileDef); + +class Handle(SALOMEDS_ExternalFileDef) : public Handle(TDataStd_Comment) { + public: + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + Handle(SALOMEDS_ExternalFileDef)():Handle(TDataStd_Comment)() {} + Handle(SALOMEDS_ExternalFileDef)(const Handle(SALOMEDS_ExternalFileDef)& aHandle) : Handle(TDataStd_Comment)(aHandle) + { + } + + Handle(SALOMEDS_ExternalFileDef)(const SALOMEDS_ExternalFileDef* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) + { + } + + Handle(SALOMEDS_ExternalFileDef)& operator=(const Handle(SALOMEDS_ExternalFileDef)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SALOMEDS_ExternalFileDef)& operator=(const SALOMEDS_ExternalFileDef* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SALOMEDS_ExternalFileDef* operator->() + { + return (SALOMEDS_ExternalFileDef *)ControlAccess(); + } + + SALOMEDS_ExternalFileDef* operator->() const + { + return (SALOMEDS_ExternalFileDef *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SALOMEDS_ExternalFileDef)(); + + Standard_EXPORT static const Handle(SALOMEDS_ExternalFileDef) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx b/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx new file mode 100644 index 000000000..24b684f29 --- /dev/null +++ b/src/SALOMEDS/Handle_SALOMEDS_FileType.hxx @@ -0,0 +1,85 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. + +#ifndef _Handle_SALOMEDS_FileType_HeaderFile +#define _Handle_SALOMEDS_FileType_HeaderFile + +#ifndef _Standard_Macro_HeaderFile +#include +#endif +#ifndef _Standard_HeaderFile +#include +#endif + +#ifndef _Handle_TDataStd_Comment_HeaderFile +#include +#endif + +class Standard_Transient; +class Handle_Standard_Type; +class Handle(TDataStd_Comment); +class SALOMEDS_FileType; +Standard_EXPORT Handle_Standard_Type& STANDARD_TYPE(SALOMEDS_FileType); + +class Handle(SALOMEDS_FileType) : public Handle(TDataStd_Comment) { + public: + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + Handle(SALOMEDS_FileType)():Handle(TDataStd_Comment)() {} + Handle(SALOMEDS_FileType)(const Handle(SALOMEDS_FileType)& aHandle) : Handle(TDataStd_Comment)(aHandle) + { + } + + Handle(SALOMEDS_FileType)(const SALOMEDS_FileType* anItem) : Handle(TDataStd_Comment)((TDataStd_Comment *)anItem) + { + } + + Handle(SALOMEDS_FileType)& operator=(const Handle(SALOMEDS_FileType)& aHandle) + { + Assign(aHandle.Access()); + return *this; + } + + Handle(SALOMEDS_FileType)& operator=(const SALOMEDS_FileType* anItem) + { + Assign((Standard_Transient *)anItem); + return *this; + } + + SALOMEDS_FileType* operator->() + { + return (SALOMEDS_FileType *)ControlAccess(); + } + + SALOMEDS_FileType* operator->() const + { + return (SALOMEDS_FileType *)ControlAccess(); + } + + Standard_EXPORT ~Handle(SALOMEDS_FileType)(); + + Standard_EXPORT static const Handle(SALOMEDS_FileType) DownCast(const Handle(Standard_Transient)& AnObject); +}; +#endif diff --git a/src/SALOMEDS/Makefile.in b/src/SALOMEDS/Makefile.in index 873929b80..394cd98d9 100644 --- a/src/SALOMEDS/Makefile.in +++ b/src/SALOMEDS/Makefile.in @@ -50,8 +50,12 @@ LIB_SRC = \ SALOMEDS_OCAFApplication.cxx \ SALOMEDS_GenericAttribute_i.cxx \ SALOMEDS_IORAttribute.cxx \ + SALOMEDS_ExternalFileDef.cxx \ + SALOMEDS_FileType.cxx \ SALOMEDS_PersRefAttribute.cxx \ SALOMEDS_AttributeComment_i.cxx \ + SALOMEDS_AttributeExternalFileDef_i.cxx \ + SALOMEDS_AttributeFileType_i.cxx \ SALOMEDS_AttributeIOR_i.cxx \ SALOMEDS_AttributeInteger_i.cxx \ SALOMEDS_AttributeName_i.cxx \ @@ -107,7 +111,7 @@ BIN_CLIENT_IDL = CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKCAF +LDFLAGS+= $(HDF5_LIBS) -lTOOLSDS -lSalomeNS -lSalomeHDFPersist -lOpUtil -lSALOMELocalTrace $(CAS_LDPATH) -lTKCAF @CONCLUDE@ diff --git a/src/SALOMEDS/README_attributes b/src/SALOMEDS/README_attributes new file mode 100644 index 000000000..b0c4ff789 --- /dev/null +++ b/src/SALOMEDS/README_attributes @@ -0,0 +1,46 @@ + +$Header$ + +How to add a new attribute (without WOK): +----------------------------------------- + +This works only for simple types (ex: string) + +example: add attribute FileType (string) + +# new files (copied from files specific to ExternalFileDef attribute = string): + +? src/SALOMEDS/Handle_SALOMEDS_FileType.hxx <--- Handle_SALOMEDS_ExternalFileDef.hxx +? src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx <--- SALOMEDS_AttributeExternalFileDef_i.cxx +? src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx <--- SALOMEDS_AttributeExternalFileDef_i.hxx +? src/SALOMEDS/SALOMEDS_FileType.cdl <--- SALOMEDS_ExternalFileDef.cdl +? src/SALOMEDS/SALOMEDS_FileType.cxx <--- SALOMEDS_ExternalFileDef.cxx +? src/SALOMEDS/SALOMEDS_FileType.hxx <--- SALOMEDS_ExternalFileDef.hxx +? src/SALOMEDS/SALOMEDS_FileType.ixx <--- SALOMEDS_ExternalFileDef.ixx +? src/SALOMEDS/SALOMEDS_FileType.jxx <--- SALOMEDS_ExternalFileDef.jxx + +# files modified: + +M idl/SALOMEDS_Attributes.idl +M src/SALOMEDS/Makefile.in +M src/SALOMEDS/SALOMEDS_SObject_i.cxx +M src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx + +# detailled modifications: + +- in new files, +change ExternalFileDef in FileType everywhere +- in SALOMEDS_FileType.cxx, +Standard_GUID (Global Universal IDentifier) must be changed. +To obtain a new GUID, it is possible to use guidgen.exe on windows (with visual C++). + +- in src/SALOMEDS/Makefile.in, +add under LIB_SRC = \ + SALOMEDS_FileType.cxx \ + SALOMEDS_AttributeExternalFileDef_i.cxx \ + +- in src/SALOMEDS/SALOMEDS_SObject_i.cxx, +- in src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx, +- in idl/SALOMEDS_Attributes.idl, +find portions of code containing ExternalFileDef, duplicate and replace + diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx new file mode 100644 index 000000000..94e2a313d --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.cxx @@ -0,0 +1,48 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_AttributeExternalFileDef_i.cxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header$ + +using namespace std; +#include "SALOMEDS_AttributeExternalFileDef_i.hxx" + +#include +#include "SALOMEDS_SObject_i.hxx" + +char* SALOMEDS_AttributeExternalFileDef_i::Value() +{ + TCollection_ExtendedString S = Handle(SALOMEDS_ExternalFileDef)::DownCast(_myAttr)->Get(); + CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + return c_s._retn(); +} + +void SALOMEDS_AttributeExternalFileDef_i::SetValue(const char* value) +{ + CheckLocked(); + CORBA::String_var Str = CORBA::string_dup(value); + // Handle(SALOMEDS_ExternalFileDef)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); + Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx new file mode 100644 index 000000000..b6d5244a7 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeExternalFileDef_i.hxx @@ -0,0 +1,56 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_AttributeExternalFileDef_i.hxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header$ + +#ifndef SALOMEDS_AttributeExternalFileDef_i_HeaderFile +#define SALOMEDS_AttributeExternalFileDef_i_HeaderFile + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_ExternalFileDef.hxx" + +class SALOMEDS_AttributeExternalFileDef_i: public virtual POA_SALOMEDS::AttributeExternalFileDef, + public virtual SALOMEDS_GenericAttribute_i { +public: + + SALOMEDS_AttributeExternalFileDef_i(const Handle(SALOMEDS_ExternalFileDef)& theCommentAttr, CORBA::ORB_ptr orb) + { + _myOrb = CORBA::ORB::_duplicate(orb); + _myAttr = theCommentAttr; + } + ~SALOMEDS_AttributeExternalFileDef_i() {}; + + char* Value(); + void SetValue(const char* value); + +}; + + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx new file mode 100644 index 000000000..d40a53f43 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.cxx @@ -0,0 +1,48 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_AttributeFileType_i.cxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header$ + +using namespace std; +#include "SALOMEDS_AttributeFileType_i.hxx" + +#include +#include "SALOMEDS_SObject_i.hxx" + +char* SALOMEDS_AttributeFileType_i::Value() +{ + TCollection_ExtendedString S = Handle(SALOMEDS_FileType)::DownCast(_myAttr)->Get(); + CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(S).ToCString()); + return c_s._retn(); +} + +void SALOMEDS_AttributeFileType_i::SetValue(const char* value) +{ + CheckLocked(); + CORBA::String_var Str = CORBA::string_dup(value); + // Handle(SALOMEDS_FileType)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); + Handle(TDataStd_Comment)::DownCast(_myAttr)->Set(TCollection_ExtendedString(Str)); +} diff --git a/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx new file mode 100644 index 000000000..324c5cb9a --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_AttributeFileType_i.hxx @@ -0,0 +1,56 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_AttributeFileType_i.hxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header$ + +#ifndef SALOMEDS_AttributeFileType_i_HeaderFile +#define SALOMEDS_AttributeFileType_i_HeaderFile + +// IDL headers +#include +#include CORBA_SERVER_HEADER(SALOMEDS_Attributes) +#include "SALOMEDS_GenericAttribute_i.hxx" +#include "SALOMEDS_FileType.hxx" + +class SALOMEDS_AttributeFileType_i: public virtual POA_SALOMEDS::AttributeFileType, + public virtual SALOMEDS_GenericAttribute_i { +public: + + SALOMEDS_AttributeFileType_i(const Handle(SALOMEDS_FileType)& theCommentAttr, CORBA::ORB_ptr orb) + { + _myOrb = CORBA::ORB::_duplicate(orb); + _myAttr = theCommentAttr; + } + ~SALOMEDS_AttributeFileType_i() {}; + + char* Value(); + void SetValue(const char* value); + +}; + + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl new file mode 100644 index 000000000..a5ab6d282 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cdl @@ -0,0 +1,76 @@ +-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : SALOMEDS_ExternalFileDef.cdl +-- Author : Yves FRICAUD +-- Module : SALOME + +class ExternalFileDef from SALOMEDS inherits Comment from TDataStd + + ---Purpose: + + +uses Attribute from TDF, + Label from TDF, + GUID from Standard, + ExtendedString from TCollection, + DataSet from TDF, + RelocationTable from TDF, + AttributeSequence from TDF, + Data from TDF, + Comment from TDataStd + + +is + + + ---Purpose: class methods + -- ============= + + GetID (myclass) + ---C++: return const & + returns GUID from Standard; + + Set (myclass; label : Label from TDF; + Name : ExtendedString from TCollection) + returns ExternalFileDef from SALOMEDS; + + ---Purpose: Comment methods + -- ============ + + Create + returns mutable ExternalFileDef from SALOMEDS; + + ID (me) + ---C++: return const & + returns GUID from Standard; + + Restore (me: mutable; with : Attribute from TDF); + + NewEmpty (me) + returns mutable Attribute from TDF; + + Paste (me; into : mutable Attribute from TDF; + RT : mutable RelocationTable from TDF); + +end ExternalFileDef; diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx new file mode 100644 index 000000000..2e07b0106 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ExternalFileDef.cxx @@ -0,0 +1,114 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_ExternalFileDef.cxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header: + +#include "SALOMEDS_ExternalFileDef.ixx" +#include +#include +using namespace std; + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= + +const Standard_GUID& SALOMEDS_ExternalFileDef::GetID () +{ + static Standard_GUID SALOMEDS_ExternalFileDefID ("7123AD4C-ACDB-4e3a-8FDC-70EA164D2CBE"); + return SALOMEDS_ExternalFileDefID; +} + + + +//======================================================================= +//function : Set +//purpose : +//======================================================================= + +Handle(SALOMEDS_ExternalFileDef) SALOMEDS_ExternalFileDef::Set (const TDF_Label& L, + const TCollection_ExtendedString& S) +{ + + Handle(SALOMEDS_ExternalFileDef) A; + if (!L.FindAttribute(SALOMEDS_ExternalFileDef::GetID(),A)) { + A = new SALOMEDS_ExternalFileDef(); + L.AddAttribute(A); + } + + (Handle(TDataStd_Comment)::DownCast(A))->Set (S); + return A; +} + + +//======================================================================= +//function : constructor +//purpose : +//======================================================================= +SALOMEDS_ExternalFileDef::SALOMEDS_ExternalFileDef() +{} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= + +const Standard_GUID& SALOMEDS_ExternalFileDef::ID () const { return GetID(); } + + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= + +Handle(TDF_Attribute) SALOMEDS_ExternalFileDef::NewEmpty () const +{ + return new SALOMEDS_ExternalFileDef(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= + +void SALOMEDS_ExternalFileDef::Restore(const Handle(TDF_Attribute)& with) +{ + TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); + TDataStd_Comment::Set(s); + return; +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void SALOMEDS_ExternalFileDef::Paste (const Handle(TDF_Attribute)& into, + const Handle(TDF_RelocationTable)& RT) const +{ + Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); +} + diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx new file mode 100644 index 000000000..5abb1838f --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ExternalFileDef.hxx @@ -0,0 +1,108 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SALOMEDS_ExternalFileDef_HeaderFile +#define _SALOMEDS_ExternalFileDef_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SALOMEDS_ExternalFileDef_HeaderFile +#include +#endif + +#ifndef _TDataStd_Comment_HeaderFile +#include +#endif +#ifndef _Handle_TDF_Attribute_HeaderFile +#include +#endif +#ifndef _Handle_TDF_RelocationTable_HeaderFile +#include +#endif +class Standard_GUID; +class TDF_Label; +class TCollection_ExtendedString; +class TDF_Attribute; +class TDF_RelocationTable; + + +class SALOMEDS_ExternalFileDef : public TDataStd_Comment { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static Handle_SALOMEDS_ExternalFileDef Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; +Standard_EXPORT SALOMEDS_ExternalFileDef(); +Standard_EXPORT const Standard_GUID& ID() const; +Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; +Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; +Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT ~SALOMEDS_ExternalFileDef(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx new file mode 100644 index 000000000..2235302e0 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ExternalFileDef.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SALOMEDS_ExternalFileDef::~SALOMEDS_ExternalFileDef() {} + + + +Standard_EXPORT Handle_Standard_Type& SALOMEDS_ExternalFileDef_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); + static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_ExternalFileDef", + sizeof(SALOMEDS_ExternalFileDef), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SALOMEDS_ExternalFileDef) Handle(SALOMEDS_ExternalFileDef)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SALOMEDS_ExternalFileDef) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_ExternalFileDef))) { + _anOtherObject = Handle(SALOMEDS_ExternalFileDef)((Handle(SALOMEDS_ExternalFileDef)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SALOMEDS_ExternalFileDef::DynamicType() const +{ + return STANDARD_TYPE(SALOMEDS_ExternalFileDef) ; +} +Standard_Boolean SALOMEDS_ExternalFileDef::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SALOMEDS_ExternalFileDef) == AType || TDataStd_Comment::IsKind(AType)); +} +Handle_SALOMEDS_ExternalFileDef::~Handle_SALOMEDS_ExternalFileDef() {} + diff --git a/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx b/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx new file mode 100644 index 000000000..32adbec66 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_ExternalFileDef.jxx @@ -0,0 +1,18 @@ +#ifndef _Standard_GUID_HeaderFile +#include +#endif +#ifndef _TDF_Label_HeaderFile +#include +#endif +#ifndef _TCollection_ExtendedString_HeaderFile +#include +#endif +#ifndef _TDF_Attribute_HeaderFile +#include +#endif +#ifndef _TDF_RelocationTable_HeaderFile +#include +#endif +#ifndef _SALOMEDS_ExternalFileDef_HeaderFile +#include +#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.cdl b/src/SALOMEDS/SALOMEDS_FileType.cdl new file mode 100644 index 000000000..d9e43f29c --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_FileType.cdl @@ -0,0 +1,76 @@ +-- SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +-- +-- Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +-- CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +-- +-- This library is free software; you can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public +-- License as published by the Free Software Foundation; either +-- version 2.1 of the License. +-- +-- This library is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +-- Lesser General Public License for more details. +-- +-- You should have received a copy of the GNU Lesser General Public +-- License along with this library; if not, write to the Free Software +-- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +-- +-- See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +-- +-- +-- +-- File : SALOMEDS_FileType.cdl +-- Author : Yves FRICAUD +-- Module : SALOME + +class FileType from SALOMEDS inherits Comment from TDataStd + + ---Purpose: + + +uses Attribute from TDF, + Label from TDF, + GUID from Standard, + ExtendedString from TCollection, + DataSet from TDF, + RelocationTable from TDF, + AttributeSequence from TDF, + Data from TDF, + Comment from TDataStd + + +is + + + ---Purpose: class methods + -- ============= + + GetID (myclass) + ---C++: return const & + returns GUID from Standard; + + Set (myclass; label : Label from TDF; + Name : ExtendedString from TCollection) + returns FileType from SALOMEDS; + + ---Purpose: Comment methods + -- ============ + + Create + returns mutable FileType from SALOMEDS; + + ID (me) + ---C++: return const & + returns GUID from Standard; + + Restore (me: mutable; with : Attribute from TDF); + + NewEmpty (me) + returns mutable Attribute from TDF; + + Paste (me; into : mutable Attribute from TDF; + RT : mutable RelocationTable from TDF); + +end FileType; diff --git a/src/SALOMEDS/SALOMEDS_FileType.cxx b/src/SALOMEDS/SALOMEDS_FileType.cxx new file mode 100644 index 000000000..515bbc551 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_FileType.cxx @@ -0,0 +1,114 @@ +// SALOME SALOMEDS : data structure of SALOME and sources of Salome data server +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOMEDS_FileType.cxx +// Author : Yves FRICAUD +// Module : SALOME +// $Header: + +#include "SALOMEDS_FileType.ixx" +#include +#include +using namespace std; + +//======================================================================= +//function : GetID +//purpose : +//======================================================================= + +const Standard_GUID& SALOMEDS_FileType::GetID () +{ + static Standard_GUID SALOMEDS_FileTypeID ("0181B525-3F15-4ab2-9DE3-5E2F54B5F340"); + return SALOMEDS_FileTypeID; +} + + + +//======================================================================= +//function : Set +//purpose : +//======================================================================= + +Handle(SALOMEDS_FileType) SALOMEDS_FileType::Set (const TDF_Label& L, + const TCollection_ExtendedString& S) +{ + + Handle(SALOMEDS_FileType) A; + if (!L.FindAttribute(SALOMEDS_FileType::GetID(),A)) { + A = new SALOMEDS_FileType(); + L.AddAttribute(A); + } + + (Handle(TDataStd_Comment)::DownCast(A))->Set (S); + return A; +} + + +//======================================================================= +//function : constructor +//purpose : +//======================================================================= +SALOMEDS_FileType::SALOMEDS_FileType() +{} + +//======================================================================= +//function : ID +//purpose : +//======================================================================= + +const Standard_GUID& SALOMEDS_FileType::ID () const { return GetID(); } + + +//======================================================================= +//function : NewEmpty +//purpose : +//======================================================================= + +Handle(TDF_Attribute) SALOMEDS_FileType::NewEmpty () const +{ + return new SALOMEDS_FileType(); +} + +//======================================================================= +//function : Restore +//purpose : +//======================================================================= + +void SALOMEDS_FileType::Restore(const Handle(TDF_Attribute)& with) +{ + TCollection_ExtendedString s = Handle(TDataStd_Comment)::DownCast (with)->Get (); + TDataStd_Comment::Set(s); + return; +} + +//======================================================================= +//function : Paste +//purpose : +//======================================================================= + +void SALOMEDS_FileType::Paste (const Handle(TDF_Attribute)& into, + const Handle(TDF_RelocationTable)& RT) const +{ + Handle(TDataStd_Comment)::DownCast (into)->Set (Get()); +} + diff --git a/src/SALOMEDS/SALOMEDS_FileType.hxx b/src/SALOMEDS/SALOMEDS_FileType.hxx new file mode 100644 index 000000000..d912aaafc --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_FileType.hxx @@ -0,0 +1,108 @@ +// File generated by CPPExt (Transient) +// +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#ifndef _SALOMEDS_FileType_HeaderFile +#define _SALOMEDS_FileType_HeaderFile + +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Handle_SALOMEDS_FileType_HeaderFile +#include +#endif + +#ifndef _TDataStd_Comment_HeaderFile +#include +#endif +#ifndef _Handle_TDF_Attribute_HeaderFile +#include +#endif +#ifndef _Handle_TDF_RelocationTable_HeaderFile +#include +#endif +class Standard_GUID; +class TDF_Label; +class TCollection_ExtendedString; +class TDF_Attribute; +class TDF_RelocationTable; + + +class SALOMEDS_FileType : public TDataStd_Comment { + +public: + + void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + // Methods PUBLIC + // +Standard_EXPORT static const Standard_GUID& GetID() ; +Standard_EXPORT static Handle_SALOMEDS_FileType Set(const TDF_Label& label,const TCollection_ExtendedString& Name) ; +Standard_EXPORT SALOMEDS_FileType(); +Standard_EXPORT const Standard_GUID& ID() const; +Standard_EXPORT void Restore(const Handle(TDF_Attribute)& with) ; +Standard_EXPORT Handle_TDF_Attribute NewEmpty() const; +Standard_EXPORT void Paste(const Handle(TDF_Attribute)& into,const Handle(TDF_RelocationTable)& RT) const; +Standard_EXPORT ~SALOMEDS_FileType(); + + + + + // Type management + // + Standard_EXPORT friend Handle_Standard_Type& SALOMEDS_FileType_Type_(); + Standard_EXPORT const Handle(Standard_Type)& DynamicType() const; + Standard_EXPORT Standard_Boolean IsKind(const Handle(Standard_Type)&) const; + +protected: + + // Methods PROTECTED + // + + + // Fields PROTECTED + // + + +private: + + // Methods PRIVATE + // + + + // Fields PRIVATE + // + + +}; + + + + + +// other Inline functions and methods (like "C++: function call" methods) +// + + +#endif diff --git a/src/SALOMEDS/SALOMEDS_FileType.ixx b/src/SALOMEDS/SALOMEDS_FileType.ixx new file mode 100644 index 000000000..505e39dab --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_FileType.ixx @@ -0,0 +1,73 @@ +// File generated by CPPExt (Transient) +// Copyright (C) 1991,1995 by +// +// MATRA DATAVISION, FRANCE +// +// This software is furnished in accordance with the terms and conditions +// of the contract and with the inclusion of the above copyright notice. +// This software or any other copy thereof may not be provided or otherwise +// be made available to any other person. No title to an ownership of the +// software is hereby transferred. +// +// At the termination of the contract, the software and all copies of this +// software must be deleted. +// +#include + +#ifndef _Standard_TypeMismatch_HeaderFile +#include +#endif + +SALOMEDS_FileType::~SALOMEDS_FileType() {} + + + +Standard_EXPORT Handle_Standard_Type& SALOMEDS_FileType_Type_() +{ + + static Handle_Standard_Type aType1 = STANDARD_TYPE(TDataStd_Comment); + if ( aType1.IsNull()) aType1 = STANDARD_TYPE(TDataStd_Comment); + static Handle_Standard_Type aType2 = STANDARD_TYPE(TDF_Attribute); + if ( aType2.IsNull()) aType2 = STANDARD_TYPE(TDF_Attribute); + static Handle_Standard_Type aType3 = STANDARD_TYPE(MMgt_TShared); + if ( aType3.IsNull()) aType3 = STANDARD_TYPE(MMgt_TShared); + static Handle_Standard_Type aType4 = STANDARD_TYPE(Standard_Transient); + if ( aType4.IsNull()) aType4 = STANDARD_TYPE(Standard_Transient); + + + static Handle_Standard_Transient _Ancestors[]= {aType1,aType2,aType3,aType4,NULL}; + static Handle_Standard_Type _aType = new Standard_Type("SALOMEDS_FileType", + sizeof(SALOMEDS_FileType), + 1, + (Standard_Address)_Ancestors, + (Standard_Address)NULL); + + return _aType; +} + + +// DownCast method +// allow safe downcasting +// +const Handle(SALOMEDS_FileType) Handle(SALOMEDS_FileType)::DownCast(const Handle(Standard_Transient)& AnObject) +{ + Handle(SALOMEDS_FileType) _anOtherObject; + + if (!AnObject.IsNull()) { + if (AnObject->IsKind(STANDARD_TYPE(SALOMEDS_FileType))) { + _anOtherObject = Handle(SALOMEDS_FileType)((Handle(SALOMEDS_FileType)&)AnObject); + } + } + + return _anOtherObject ; +} +const Handle(Standard_Type)& SALOMEDS_FileType::DynamicType() const +{ + return STANDARD_TYPE(SALOMEDS_FileType) ; +} +Standard_Boolean SALOMEDS_FileType::IsKind(const Handle(Standard_Type)& AType) const +{ + return (STANDARD_TYPE(SALOMEDS_FileType) == AType || TDataStd_Comment::IsKind(AType)); +} +Handle_SALOMEDS_FileType::~Handle_SALOMEDS_FileType() {} + diff --git a/src/SALOMEDS/SALOMEDS_FileType.jxx b/src/SALOMEDS/SALOMEDS_FileType.jxx new file mode 100644 index 000000000..0d838e429 --- /dev/null +++ b/src/SALOMEDS/SALOMEDS_FileType.jxx @@ -0,0 +1,18 @@ +#ifndef _Standard_GUID_HeaderFile +#include +#endif +#ifndef _TDF_Label_HeaderFile +#include +#endif +#ifndef _TCollection_ExtendedString_HeaderFile +#include +#endif +#ifndef _TDF_Attribute_HeaderFile +#include +#endif +#ifndef _TDF_RelocationTable_HeaderFile +#include +#endif +#ifndef _SALOMEDS_FileType_HeaderFile +#include +#endif diff --git a/src/SALOMEDS/SALOMEDS_SObject_i.cxx b/src/SALOMEDS/SALOMEDS_SObject_i.cxx index f9c00984e..e10791ded 100644 --- a/src/SALOMEDS/SALOMEDS_SObject_i.cxx +++ b/src/SALOMEDS/SALOMEDS_SObject_i.cxx @@ -44,6 +44,8 @@ using namespace std; #include "SALOMEDS_AttributePersistentRef_i.hxx" #include "SALOMEDS_AttributeIOR_i.hxx" #include "SALOMEDS_AttributeComment_i.hxx" +#include "SALOMEDS_AttributeExternalFileDef_i.hxx" +#include "SALOMEDS_AttributeFileType_i.hxx" #include "SALOMEDS_AttributeName_i.hxx" #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" #include "SALOMEDS_AttributeSequenceOfReal_i.hxx" @@ -84,6 +86,8 @@ SALOMEDS_SObject_i::ReturnGUIDForAttribute(const char* aTypeOfAttribute) else if (strcmp(aTypeOfAttribute, "AttributeSequenceOfInteger") == 0 ) return SALOMEDS_SequenceOfIntegerAttribute::GetID(); else if (strcmp(aTypeOfAttribute, "AttributeName") == 0 ) return TDataStd_Name::GetID(); else if (strcmp(aTypeOfAttribute, "AttributeComment") == 0 ) return TDataStd_Comment::GetID(); + else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) return SALOMEDS_ExternalFileDef::GetID(); + else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) return SALOMEDS_FileType::GetID(); else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) return SALOMEDS_IORAttribute::GetID(); else if (strcmp(aTypeOfAttribute, "AttributePersistentRef") == 0 ) return SALOMEDS_PersRefAttribute::GetID(); else if (strcmp(aTypeOfAttribute, "AttributeDrawable") == 0 ) return SALOMEDS_DrawableAttribute::GetID(); @@ -121,6 +125,8 @@ char* SALOMEDS_SObject_i::AttributeIDToType(Standard_GUID ID) { if (ID == TDataStd_Name::GetID()) return "AttributeName"; else if (ID == TDataStd_Comment::GetID()) return "AttributeComment"; + else if (ID == SALOMEDS_ExternalFileDef::GetID()) return "AttributeExternalFileDef"; + else if (ID == SALOMEDS_FileType::GetID()) return "AttributeFileType"; else if (ID == SALOMEDS_IORAttribute::GetID()) return "AttributeIOR"; else if (ID == SALOMEDS_PersRefAttribute::GetID()) return "AttributePersistentRef"; else if (ID == TDataStd_Real::GetID()) return "AttributeReal"; @@ -283,6 +289,16 @@ CORBA::Boolean SALOMEDS_SObject_i::FindAttribute (SALOMEDS::GenericAttribute_out anAttribute = Attr->AttributeComment::_this(); return Standard_True; } + else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) { + SALOMEDS_AttributeExternalFileDef_i* Attr = new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeExternalFileDef::_this(); + return Standard_True; + } + else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) { + SALOMEDS_AttributeFileType_i* Attr = new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeFileType::_this(); + return Standard_True; + } else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) { SALOMEDS_AttributeIOR_i* Attr = new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb); anAttribute = Attr->AttributeIOR::_this(); @@ -416,6 +432,14 @@ SALOMEDS::ListOfAttributes* SALOMEDS_SObject_i::GetAllAttributes() SALOMEDS_AttributeComment_i* Attr= new SALOMEDS_AttributeComment_i(Handle(TDataStd_Comment)::DownCast(anAttr), _orb); anAttribute = Attr->AttributeComment::_this(); } + else if (ReturnGUIDForAttribute("AttributeExternalFileDef") == anAttr->ID()) { + SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeExternalFileDef::_this(); + } + else if (ReturnGUIDForAttribute("AttributeFileType") == anAttr->ID()) { + SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeFileType::_this(); + } else if (ReturnGUIDForAttribute("AttributeIOR") == anAttr->ID()) { SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb); anAttribute = Attr->AttributeIOR::_this(); diff --git a/src/SALOMEDS/SALOMEDS_Server.cxx b/src/SALOMEDS/SALOMEDS_Server.cxx index 238dd2450..11be22065 100644 --- a/src/SALOMEDS/SALOMEDS_Server.cxx +++ b/src/SALOMEDS/SALOMEDS_Server.cxx @@ -26,17 +26,17 @@ // Module : SALOME // $Header$ -using namespace std; #include #include CORBA_SERVER_HEADER(SALOMEDS) #include "SALOMEDS_StudyManager_i.hxx" #include "utilities.h" -# include "Utils_SINGLETON.hxx" +#include "Utils_SINGLETON.hxx" #include "SALOME_NamingService.hxx" -//#define CHECKTIME + #ifdef CHECKTIME #include #endif +using namespace std; // extern "C" // { // for ccmalloc memory debug @@ -47,126 +47,142 @@ using namespace std; ////////////////////////////////////////////////////////////////////////// int main(int argc, char** argv) { -// ccmalloc_static_initialization(); + // ccmalloc_static_initialization(); MESSAGE("SALOMEDS_Server - main"); - try { - // Initialise the ORB. - CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); - omniORB::MaxMessageSize(100 * 1024 * 1024); - // Obtain a reference to the root POA. - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - int SALOMEDS=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var pman; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - pman = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)){ - inc = CosNaming::NamingContext::_narrow(theObj); - if(!CORBA::is_nil(inc)) { - MESSAGE( "SalomeDS Server: Naming Service was found" ) - if(EnvL==1){ - CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; - SALOME_NamingService &NS = *SINGLETON_::Instance() ; - NS.init_orb( orb1 ) ; - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name);} - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "SalomeDS Server: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "SalomeDS Server: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "SalomeDS Server: Logger Server was found" ) - log->ping(); - SALOMEDS=1; - break; - } - }} - }} - - } - catch( const SALOME_Exception &ex ) + try + { + // Initialise the ORB. + CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3"); + omniORB::MaxMessageSize(100 * 1024 * 1024); + // Obtain a reference to the root POA. + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + int SALOMEDS=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var pman; + for (int i = 1; i<=NumberOfTries; i++) { - MESSAGE( "Communication Error : " << ex.what() ) - return EXIT_FAILURE ; + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + pman = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)){ + inc = CosNaming::NamingContext::_narrow(theObj); + if(!CORBA::is_nil(inc)) + { + MESSAGE( "SalomeDS Server: Naming Service was found" ); + if(EnvL==1) + { + CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ; + SALOME_NamingService &NS = *SINGLETON_::Instance() ; + NS.init_orb( orb1 ) ; + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "SalomeDS Server: Logger Server wasn't found" ); } + + catch(...) + { + MESSAGE( "SalomeDS Server: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "SalomeDS Server: Logger Server was found" ); + SALOMEDS=1; + break; + } + } + } + } + } + + } + catch( const SALOME_Exception &ex ) + { + MESSAGE( "Communication Error : " << ex.what() ); + return EXIT_FAILURE ; + } + if ((SALOMEDS==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; } - if ((SALOMEDS==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) - break; - } - // - // We allocate the objects on the heap. Since these are reference - // counted objects, they will be deleted by the POA when they are no - // longer needed. - SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb); + // We allocate the objects on the heap. Since these are reference + // counted objects, they will be deleted by the POA when they are no + // longer needed. + SALOMEDS_StudyManager_i * myStudyManager_i = new SALOMEDS_StudyManager_i(orb); - // Activate the objects. This tells the POA that the objects are - // ready to accept requests. - PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i); - myStudyManager_i->register_name("/myStudyManager"); + // Activate the objects. This tells the POA that the objects are + // ready to accept requests. + PortableServer::ObjectId_var myStudyManager_iid = poa->activate_object(myStudyManager_i); + myStudyManager_i->register_name("/myStudyManager"); - // Obtain a POAManager, and tell the POA to start accepting - // requests on its objects. - pman = poa->the_POAManager(); - pman->activate(); + // Obtain a POAManager, and tell the POA to start accepting + // requests on its objects. + pman = poa->the_POAManager(); + pman->activate(); #ifdef CHECKTIME - Utils_Timer timer; - timer.Start(); - timer.Stop(); - MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); - timer.ShowAbsolute(); + Utils_Timer timer; + timer.Start(); + timer.Stop(); + MESSAGE("SALOME_Registry_Server.cxx - orb->run()"); + timer.ShowAbsolute(); #endif - orb->run(); - orb->destroy(); - } - catch(CORBA::SystemException&) { - MESSAGE( "Caught CORBA::SystemException." ) - } - catch(CORBA::Exception&) { - MESSAGE( "Caught CORBA::Exception." ) - } - catch(omniORB::fatalException& fe) { - MESSAGE( "Caught omniORB::fatalException:" ) - MESSAGE( " file: " << fe.file() ) - MESSAGE( " line: " << fe.line() ) - MESSAGE( " mesg: " << fe.errmsg() ) - } - catch(...) { - MESSAGE( "Caught unknown exception." ) - } + orb->run(); + orb->destroy(); + } + catch(CORBA::SystemException&) + { + MESSAGE( "Caught CORBA::SystemException." ); + } + catch(CORBA::Exception&) + { + MESSAGE( "Caught CORBA::Exception." ); + } + catch(omniORB::fatalException& fe) + { + MESSAGE( "Caught omniORB::fatalException:" ); + MESSAGE( " file: " << fe.file() ); + MESSAGE( " line: " << fe.line() ); + MESSAGE( " mesg: " << fe.errmsg() ); + } + catch(...) + { + MESSAGE( "Caught unknown exception." ); + } return 0; } diff --git a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx index 93eaa48bc..a0afc4e53 100644 --- a/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx +++ b/src/SALOMEDS/SALOMEDS_StudyBuilder_i.cxx @@ -50,6 +50,8 @@ using namespace std; #include "SALOMEDS_AttributePersistentRef_i.hxx" #include "SALOMEDS_AttributeIOR_i.hxx" #include "SALOMEDS_AttributeComment_i.hxx" +#include "SALOMEDS_AttributeExternalFileDef_i.hxx" +#include "SALOMEDS_AttributeFileType_i.hxx" #include "SALOMEDS_AttributeName_i.hxx" #include "SALOMEDS_AttributeSequenceOfInteger_i.hxx" #include "SALOMEDS_AttributeSequenceOfReal_i.hxx" @@ -601,6 +603,26 @@ SALOMEDS::GenericAttribute_ptr SALOMEDS_StudyBuilder_i::FindOrCreateAttribute(SA SALOMEDS::AttributeComment_var aCA = aCommentAttr->AttributeComment::_this(); return aCA._retn(); } + else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) { + Handle(SALOMEDS_ExternalFileDef) anAttr; + if (!Lab.FindAttribute(SALOMEDS_ExternalFileDef::GetID(), anAttr)) { + anAttr = new SALOMEDS_ExternalFileDef; + Lab.AddAttribute(anAttr); + } + SALOMEDS_AttributeExternalFileDef_i* anExternalFileDefAttr = new SALOMEDS_AttributeExternalFileDef_i(anAttr, _orb); + SALOMEDS::AttributeExternalFileDef_var aCA = anExternalFileDefAttr->AttributeExternalFileDef::_this(); + return aCA._retn(); + } + else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) { + Handle(SALOMEDS_FileType) anAttr; + if (!Lab.FindAttribute(SALOMEDS_FileType::GetID(), anAttr)) { + anAttr = new SALOMEDS_FileType; + Lab.AddAttribute(anAttr); + } + SALOMEDS_AttributeFileType_i* anFileTypeAttr = new SALOMEDS_AttributeFileType_i(anAttr, _orb); + SALOMEDS::AttributeFileType_var aCA = anFileTypeAttr->AttributeFileType::_this(); + return aCA._retn(); + } else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) { Handle(SALOMEDS_IORAttribute) anAttr; if (!Lab.FindAttribute(SALOMEDS_IORAttribute::GetID(), anAttr)) { @@ -836,6 +858,16 @@ CORBA::Boolean SALOMEDS_StudyBuilder_i::FindAttribute(SALOMEDS::SObject_ptr anOb anAttribute = Attr->AttributeComment::_this(); return Standard_True; } + else if (strcmp(aTypeOfAttribute, "AttributeExternalFileDef") == 0 ) { + SALOMEDS_AttributeExternalFileDef_i* Attr= new SALOMEDS_AttributeExternalFileDef_i(Handle(SALOMEDS_ExternalFileDef)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeExternalFileDef::_this(); + return Standard_True; + } + else if (strcmp(aTypeOfAttribute, "AttributeFileType") == 0 ) { + SALOMEDS_AttributeFileType_i* Attr= new SALOMEDS_AttributeFileType_i(Handle(SALOMEDS_FileType)::DownCast(anAttr), _orb); + anAttribute = Attr->AttributeFileType::_this(); + return Standard_True; + } else if (strcmp(aTypeOfAttribute, "AttributeIOR") == 0 ) { SALOMEDS_AttributeIOR_i* Attr= new SALOMEDS_AttributeIOR_i(Handle(SALOMEDS_IORAttribute)::DownCast(anAttr), _orb); anAttribute = Attr->AttributeIOR::_this(); diff --git a/src/SALOMELocalTrace/Makefile.in b/src/SALOMELocalTrace/Makefile.in new file mode 100644 index 000000000..6e3674a3e --- /dev/null +++ b/src/SALOMELocalTrace/Makefile.in @@ -0,0 +1,49 @@ +# SALOMELocalTrace : log on local machine +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Paul RASCLE (EDF) +# Module : SALOME +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= SALOME_Log.hxx + +EXPORT_PYSCRIPTS = + +# Libraries targets + +LIB = libSALOMELocalTrace.la +LIB_SRC = SALOME_Log.cxx + +LDFLAGS+= + +@CONCLUDE@ diff --git a/src/SALOMELocalTrace/SALOME_Log.cxx b/src/SALOMELocalTrace/SALOME_Log.cxx new file mode 100644 index 000000000..476d987f4 --- /dev/null +++ b/src/SALOMELocalTrace/SALOME_Log.cxx @@ -0,0 +1,57 @@ +// SALOME_LocalTrace : log on local machine +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Log.hxx +// Author : Vasily Rusyaev, Paul RASCLE, EDF +// Module : KERNEL +// $Header$ + +#include +#include + +using namespace std; + +#include "SALOME_Log.hxx" + +SALOME_Log::SALOME_Log() +{ +} + +SALOME_Log::~SALOME_Log() +{ +} + +SALOME_Log& SALOME_Log::Instance() +{ + static SALOME_Log instance; + return instance; +} + +void SALOME_Log::putMessage(std::ostream& msg) +{ + cout << std::flush; + cerr <freeze(false); + seekp(0); +} + diff --git a/src/SALOMELocalTrace/SALOME_Log.hxx b/src/SALOMELocalTrace/SALOME_Log.hxx new file mode 100644 index 000000000..043d1e1c2 --- /dev/null +++ b/src/SALOMELocalTrace/SALOME_Log.hxx @@ -0,0 +1,85 @@ +// SALOME Utils : general SALOME's definitions and tools +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Log.hxx +// Author : Vasily Rusyaev (OCN), Paul RASCLE (EDF) +// Module : KERNEL +// $Header$ + +#ifndef _SALOME_LOG_HXX_ +#define _SALOME_LOG_HXX_ + +//these declarations for files don't using OCC includes (for example HDF) +# ifdef WNT + +# ifndef Standard_EXPORT +# define Standard_EXPORT __declspec( dllexport ) +// For global variables : +# define Standard_EXPORTEXTERN __declspec( dllexport ) extern +# define Standard_EXPORTEXTERNC extern "C" __declspec( dllexport ) +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT __declspec( dllimport ) extern +# define Standard_IMPORTC extern "C" __declspec( dllimport ) +# endif /* Standard_IMPORT */ + +# else /* WNT */ + +# ifndef Standard_EXPORT +# define Standard_EXPORT +// For global variables : +# define Standard_EXPORTEXTERN extern +# define Standard_EXPORTEXTERNC extern "C" +# endif /* Standard_EXPORT */ + +# ifndef Standard_IMPORT +# define Standard_IMPORT extern +# define Standard_IMPORTC extern "C" +# endif /* Standard_IMPORT */ + +# endif /* WNT */ + + +using namespace std; + +#include +#include + + +class SALOME_Log : public ostrstream +{ +public: + virtual ~SALOME_Log(); + static Standard_EXPORT SALOME_Log& Instance(); + Standard_EXPORT void putMessage(std::ostream& msg); + +protected: + //disable creation of instances: force use static SALOME_Log& Instance() + SALOME_Log(); +}; + + +#define SLog SALOME_Log::Instance() + +#endif diff --git a/src/SALOMELogger/Makefile.in b/src/SALOMELogger/Makefile.in new file mode 100644 index 000000000..2a9f4f5e4 --- /dev/null +++ b/src/SALOMELogger/Makefile.in @@ -0,0 +1,50 @@ +# SALOMELogger : CORBA distributed log +# +# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# +# +# +# File : Makefile.in +# Author : Paul RASCLE (EDF) +# Module : SALOME +# $Header$ + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# header files +EXPORT_HEADERS= + +EXPORT_PYSCRIPTS = + +# Libraries targets + +LIB = libSALOMELoggerClient.la +LIB_SRC = SALOME_LoggerClient.cxx +LIB_CLIENT_IDL = Logger.idl + +LDFLAGS+= + +@CONCLUDE@ diff --git a/src/SALOMELogger/SALOME_LoggerClient.cxx b/src/SALOMELogger/SALOME_LoggerClient.cxx new file mode 100644 index 000000000..70f765038 --- /dev/null +++ b/src/SALOMELogger/SALOME_LoggerClient.cxx @@ -0,0 +1,154 @@ +// SALOME_LoggerClient : CORBA distributed log +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : SALOME_Loggerclient.hxx +// Author : Vasily Rusyaev, Paul RASCLE, EDF +// Module : KERNEL +// $Header$ + +#include +#include + +using namespace std; + +#include "SALOME_Log.hxx" + +#include +#include CORBA_CLIENT_HEADER(Logger) + +// class SALOME_LoggerClient : public SALOME_Log +// { +// protected: +// SALOME_Logger::Logger_var m_pInterfaceLogger; // object reference on Logger server +// }; + +SALOME_Logger::Logger_ptr m_pInterfaceLogger; // object reference on Logger server + +SALOME_Log::SALOME_Log() +{ + cout << "SALOME_LoggerClient: constructor" << endl; + //get reference on object reference from NS + //and initialize m_pInterfaceLogger + + int argc = 1; + char* argv[1] = {"application"}; + try + { + //NB. You can't use SALOME_NamingService class because it uses MESSAGE macro + //Otherwise, you will get segmentation fault. + + //Initialize the ORB + CORBA::ORB_var orb = CORBA::ORB_init(argc,argv); + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CosNaming::Name name; + name.length(1); + name[0].id = CORBA::string_dup("Logger"); + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + cout<<"SALOME_LoggerClient: CORBA::COMM_FAILURE: Unable to contact the Naming Service"<resolve(name); + m_pInterfaceLogger = SALOME_Logger::Logger::_narrow(obj); + if (!CORBA::is_nil(m_pInterfaceLogger)) + cout<<"SALOME_LoggerClient: Logger Server was found"<freeze(false); + seekp(0); + + if (CORBA::is_nil(m_pInterfaceLogger)) + cout << LogMsg << std::flush; + else + m_pInterfaceLogger-> putMessage (LogMsg) ; + } + diff --git a/src/Session/Makefile.in b/src/Session/Makefile.in index 9e95d0c62..36ba65dde 100644 --- a/src/Session/Makefile.in +++ b/src/Session/Makefile.in @@ -51,7 +51,7 @@ BIN_CLIENT_IDL = SALOMEDS.idl SALOMEDS_Attributes.idl SALOME_Component.idl SALOM CPPFLAGS+=$(QT_MT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lSalomeLoggerServer -lPlot2d -lSalomeVTKFilter +LDFLAGS+=$(QT_MT_LIBS) -lSalomeNS -lSalomeGUI -lSalomeObject -lSalomeLifeCycleCORBA -lqsplitterP -lOpUtil -lPlot2d -lSalomeVTKFilter -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/Session/SALOME_Session_Server.cxx b/src/Session/SALOME_Session_Server.cxx index 99482aa36..2b00367c2 100644 --- a/src/Session/SALOME_Session_Server.cxx +++ b/src/Session/SALOME_Session_Server.cxx @@ -26,9 +26,9 @@ // Module : SALOME // $Header$ -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" -# include "SALOME_NamingService.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "SALOME_NamingService.hxx" #include #include using namespace std; @@ -57,110 +57,117 @@ int main(int argc, char **argv) try { - ORB_INIT &init = *SINGLETON_::Instance() ; - ASSERT(SINGLETON_::IsAlreadyExisting()) ; - CORBA::ORB_var &orb = init( argc , argv ) ; + ORB_INIT &init = *SINGLETON_::Instance() ; + ASSERT(SINGLETON_::IsAlreadyExisting()) ; + CORBA::ORB_var &orb = init( argc , argv ) ; - // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - int SESSION=0; - const char * Env = getenv("USE_LOGGER"); - int EnvL =0; - if ((Env!=NULL) && (strlen(Env))) - EnvL=1; - CosNaming::Name name; - name.length(1); - name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var pman; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ + // + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int SESSION=0; + const char * Env = getenv("USE_LOGGER"); + int EnvL =0; + if ((Env!=NULL) && (strlen(Env))) + EnvL=1; + CosNaming::Name name; + name.length(1); + name[0].id=CORBA::string_dup("Logger"); + PortableServer::POAManager_var pman; + for (int i = 1; i<=NumberOfTries; i++){ + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { obj = orb->resolve_initial_references("RootPOA"); if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); + poa = PortableServer::POA::_narrow(obj); if(!CORBA::is_nil(poa)) - pman = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); + pman = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); if (!CORBA::is_nil(theObj)) inc = CosNaming::NamingContext::_narrow(theObj); - } - catch( CORBA::COMM_FAILURE& ) - { - MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) - } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Session Server: Naming Service was found" ) - if(EnvL==1){ - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name); - } - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Session Server: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Session Server: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Session Server: Loger Server was found" ) - log->ping(); - SESSION=1; - break; - } - }} } - if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) - break; + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Session Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ); + } + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Session Server: Naming Service was found" ); + if(EnvL==1) + { + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { MESSAGE( "Session Server: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Session Server: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Session Server: Loger Server was found" ); + SESSION=1; + break; + } + } } - // + } + if ((SESSION==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) + break; + } - // servant - SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ; - PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ; - MESSAGE("poa->activate_object(mySALOME_Session)") + // servant + SALOME_Session_i * mySALOME_Session = new SALOME_Session_i(argc, argv, orb, poa) ; + PortableServer::ObjectId_var mySALOME_Sessionid = poa->activate_object(mySALOME_Session) ; + MESSAGE("poa->activate_object(mySALOME_Session)") - obj = mySALOME_Session->_this() ; - CORBA::String_var sior(orb->object_to_string(obj)) ; + obj = mySALOME_Session->_this() ; + CORBA::String_var sior(orb->object_to_string(obj)) ; - mySALOME_Session->NSregister(); + mySALOME_Session->NSregister(); - mySALOME_Session->_remove_ref() ; + mySALOME_Session->_remove_ref() ; - //DECOMMENT PortableServer::POAManager_var pman = poa->the_POAManager() ; - pman->activate() ; - MESSAGE("pman->activate()") + //DECOMMENT PortableServer::POAManager_var pman = poa->the_POAManager() ; + pman->activate() ; + MESSAGE("pman->activate()") - orb->run() ; - orb->destroy() ; + orb->run() ; + orb->destroy() ; } - catch (CORBA::SystemException&) + catch (CORBA::SystemException&) { - INFOS("Caught CORBA::SystemException.") + INFOS("Caught CORBA::SystemException."); } - catch (CORBA::Exception&) + catch (CORBA::Exception&) { - INFOS("Caught CORBA::Exception.") + INFOS("Caught CORBA::Exception."); } - catch (...) + catch (...) { - INFOS("Caught unknown exception.") + INFOS("Caught unknown exception."); } return 0 ; } diff --git a/src/TOOLSDS/Makefile.in b/src/TOOLSDS/Makefile.in index 41f346ded..a3d0a4fdc 100644 --- a/src/TOOLSDS/Makefile.in +++ b/src/TOOLSDS/Makefile.in @@ -29,7 +29,7 @@ BIN_CLIENT_IDL = CPPFLAGS+=$(OCC_INCLUDES) $(HDF5_INCLUDES) CXXFLAGS+=$(OCC_CXXFLAGS) -LDFLAGS+= -lOpUtil -lSalomeLoggerServer $(CAS_LDPATH) -lTKernel +LDFLAGS+= -lOpUtil $(CAS_LDPATH) -lTKernel @CONCLUDE@ diff --git a/src/TestContainer/Makefile.in b/src/TestContainer/Makefile.in index 8d2709d60..8ee409d99 100644 --- a/src/TestContainer/Makefile.in +++ b/src/TestContainer/Makefile.in @@ -45,7 +45,7 @@ LIB_CLIENT_IDL = SALOME_Component.idl SALOME_TestComponent.idl BIN = TestContainer TestLogger BIN_SRC = -LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSalomeLoggerServer +LDFLAGS+= -lSalomeNotification -lSalomeNS -lSalomeContainer -lRegistry -lOpUtil -lSALOMELocalTrace @CONCLUDE@ diff --git a/src/TestContainer/TestContainer.cxx b/src/TestContainer/TestContainer.cxx index 9849ce584..d1f1c35bb 100644 --- a/src/TestContainer/TestContainer.cxx +++ b/src/TestContainer/TestContainer.cxx @@ -26,7 +26,6 @@ // Module : SALOME // $Header$ -using namespace std; #include "utilities.h" #include #include @@ -36,10 +35,12 @@ using namespace std; #include "SALOME_NamingService.hxx" #include "OpUtil.hxx" -# include "Utils_ORB_INIT.hxx" -# include "Utils_SINGLETON.hxx" -# include "Utils_SALOME_Exception.hxx" -# include "Utils_CommException.hxx" +#include "Utils_ORB_INIT.hxx" +#include "Utils_SINGLETON.hxx" +#include "Utils_SALOME_Exception.hxx" +#include "Utils_CommException.hxx" +using namespace std; + int main (int argc, char * argv[]) { @@ -55,74 +56,84 @@ int main (int argc, char * argv[]) // Obtain a reference to the root POA // - long TIMESleep = 250000000; - int NumberOfTries = 40; - int a; - timespec ts_req; - ts_req.tv_nsec=TIMESleep; - ts_req.tv_sec=0; - timespec ts_rem; - ts_rem.tv_nsec=0; - ts_rem.tv_sec=0; - CosNaming::NamingContext_var inc; - PortableServer::POA_var poa; - CORBA::Object_var theObj; - CORBA::Object_var obj; - CORBA::Object_var object; - SALOME_Logger::Logger_var log; - SALOME_NamingService &naming = *SINGLETON_::Instance() ; - int TEST_CONTAINER=0; - const char * Env = getenv("USE_LOGGER"); + long TIMESleep = 250000000; + int NumberOfTries = 40; + int a; + timespec ts_req; + ts_req.tv_nsec=TIMESleep; + ts_req.tv_sec=0; + timespec ts_rem; + ts_rem.tv_nsec=0; + ts_rem.tv_sec=0; + CosNaming::NamingContext_var inc; + PortableServer::POA_var poa; + CORBA::Object_var theObj; + CORBA::Object_var obj; + CORBA::Object_var object; + SALOME_NamingService &naming = *SINGLETON_::Instance() ; + int TEST_CONTAINER=0; + const char * Env = getenv("USE_LOGGER"); int EnvL =0; if ((Env!=NULL) && (strlen(Env))) EnvL=1; CosNaming::Name name; name.length(1); name[0].id=CORBA::string_dup("Logger"); - PortableServer::POAManager_var manager; - for (int i = 1; i<=NumberOfTries; i++){ - if (i!=1) - a=nanosleep(&ts_req,&ts_rem); - try{ - obj = orb->resolve_initial_references("RootPOA"); - if(!CORBA::is_nil(obj)) - poa = PortableServer::POA::_narrow(obj); - if(!CORBA::is_nil(poa)) - manager = poa->the_POAManager(); - if(!CORBA::is_nil(orb)) - theObj = orb->resolve_initial_references("NameService"); - if (!CORBA::is_nil(theObj)) - inc = CosNaming::NamingContext::_narrow(theObj); - } - catch( CORBA::COMM_FAILURE& ) - { - MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) - } - if(!CORBA::is_nil(inc)) { - MESSAGE( "Test Container: Naming Service was found" ) - if(EnvL==1){ - for(int j=1; j<=NumberOfTries; j++){ - if (j!=1) - a=nanosleep(&ts_req, &ts_rem); - try{ - object = inc->resolve(name); - } - catch(CosNaming::NamingContext::NotFound){ MESSAGE( "Test Container: Logger Server wasn't found" ) } - catch(...){ MESSAGE( "Test Container: Unknown exception" ) } - if (!CORBA::is_nil(object)) - log = SALOME_Logger::Logger::_narrow(object); - if (!CORBA::is_nil(log)){ - MESSAGE( "Test Container: Loger Server was found" ) - log->ping(); - TEST_CONTAINER=1; - break; + PortableServer::POAManager_var manager; + for (int i = 1; i<=NumberOfTries; i++) + { + if (i!=1) + a=nanosleep(&ts_req,&ts_rem); + try + { + obj = orb->resolve_initial_references("RootPOA"); + if(!CORBA::is_nil(obj)) + poa = PortableServer::POA::_narrow(obj); + if(!CORBA::is_nil(poa)) + manager = poa->the_POAManager(); + if(!CORBA::is_nil(orb)) + theObj = orb->resolve_initial_references("NameService"); + if (!CORBA::is_nil(theObj)) + inc = CosNaming::NamingContext::_narrow(theObj); + } + catch( CORBA::COMM_FAILURE& ) + { + MESSAGE( "Test Container: CORBA::COMM_FAILURE: Unable to contact the Naming Service" ) + } + if(!CORBA::is_nil(inc)) + { + MESSAGE( "Test Container: Naming Service was found" ) + if(EnvL==1) + { + for(int j=1; j<=NumberOfTries; j++) + { + if (j!=1) + a=nanosleep(&ts_req, &ts_rem); + try + { + object = inc->resolve(name); + } + catch(CosNaming::NamingContext::NotFound) + { + MESSAGE( "Test Container: Logger Server wasn't found" ); + } + catch(...) + { + MESSAGE( "Test Container: Unknown exception" ); + } + if (!CORBA::is_nil(object)) + { + MESSAGE( "Test Container: Loger Server was found" ); + TEST_CONTAINER=1; + break; + } + } } - }} - } + } if ((TEST_CONTAINER==1)||((EnvL==0)&&(!CORBA::is_nil(inc)))) break; - } - // + } + // Use Name Service to find container SALOME_NamingService _NS(orb) ; string containerName = "/Containers/" ; diff --git a/src/Utils/Makefile.in b/src/Utils/Makefile.in index aec4b20ab..86ebc70ef 100644 --- a/src/Utils/Makefile.in +++ b/src/Utils/Makefile.in @@ -57,7 +57,7 @@ LIB_SRC = OpUtil.cxx Utils_Timer.cxx duplicate.cxx \ Utils_Identity.cxx Utils_ORB_INIT.cxx \ Utils_DESTRUCTEUR_GENERIQUE.cxx -LDFLAGS+= -lSalomeLoggerServer +LDFLAGS+= @CONCLUDE@ diff --git a/src/Utils/Utils_SALOME_Exception.cxx b/src/Utils/Utils_SALOME_Exception.cxx index 59b79a764..06f4a26f4 100644 --- a/src/Utils/Utils_SALOME_Exception.cxx +++ b/src/Utils/Utils_SALOME_Exception.cxx @@ -42,7 +42,7 @@ const char* duplicate( const char *const str ) ; SALOME_Exception::SALOME_Exception( void ): exception() , _text(0) { - MESSAGE( "You must user the standard builder : SALOME_Exception::SALOME_Exception( const char *text )" ) ; + MESSAGE( "You must use the standard builder: SALOME_Exception::SALOME_Exception( const char *text )" ) ; INTERRUPTION(1) ; } diff --git a/src/Utils/utilities.h b/src/Utils/utilities.h index 52256eae8..015e84e58 100644 --- a/src/Utils/utilities.h +++ b/src/Utils/utilities.h @@ -28,101 +28,67 @@ /* --- Definition macros file to print informations if _DEBUG_ is defined --- */ -# ifndef UTILITIES_H -# define UTILITIES_H +#ifndef UTILITIES_H +#define UTILITIES_H -# include -# include - - - -//VRV: T2.4 - replacement macro for using special CORBA server -#include "SALOME_Trace.hxx" -//VRV: T2.4 - replacement macro for using special CORBA server +#include +#include +#include "SALOME_Log.hxx" /* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */ -//VRV: T2.4 - replacement of these macros for using special CORBA server - -#define INFOS(msg) { GLogger.putMessage(GLogger << __FILE__<< " [" << __LINE__ << "] : " << msg<< endl << ends ); } -#define PYSCRIPT(msg) { GLogger.putMessage(GLogger<<"---PYSCRIPT--- "<