]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
merge from trunk tag mergeto_BSEC_br1_14Mar04 BSEC_br1
authorprascle <prascle>
Tue, 16 Mar 2004 13:45:18 +0000 (13:45 +0000)
committerprascle <prascle>
Tue, 16 Mar 2004 13:45:18 +0000 (13:45 +0000)
18 files changed:
idl/SALOME_Component.idl
salome_adm/unix/config_files/check_omniorb.m4
src/Container/Container_i.cxx
src/Container/SALOME_Container_i.hxx
src/Logger/SALOME_Trace.py
src/NamingService/SALOME_NamingService.hxx
src/SALOMEDS/SALOMEDS_Client.cxx
src/SALOMEDS/SALOMEDS_Server.cxx
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_ObjectBrowser.cxx
src/SALOMELocalTrace/SALOME_Log.cxx
src/SALOMELocalTrace/SALOME_Log.hxx
src/SALOMELogger/SALOME_LoggerClient.cxx
src/Session/SALOME_Session_QThread.cxx
src/Session/SALOME_Session_QThread.hxx
src/Session/SALOME_Session_i.cxx
src/Utils/Utils_ORB_INIT.cxx
src/Utils/utilities.h

index ad9be3b06762bab1e8daa8ac0d13ed580da310e1..a18580fe7f4e2bd9b93d3f6d71c646058099d01f 100644 (file)
@@ -83,6 +83,14 @@ module Engines
    Returns True if the %container has been killed
 */
     boolean Kill_impl() ;
+/*!
+   Returns the hostname of the container
+*/
+    string getHostName();
+/*!
+   Returns the PID of the container
+*/
+    long getPID();
   };
 /*! \brief Interface of the %component
 
index 500abac3114190acd0bbd813d81bc0a220106325..c7a9699e31edaaa1ce5d3f3fa64a4834873999e1 100644 (file)
@@ -30,19 +30,35 @@ then
   AC_SUBST(OMNIORB_IDL)
 
   OMNIORB_BIN=`echo ${OMNIORB_IDL} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
-  OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin,lib,"`
-
-  OMNIORB_ROOT=`echo ${OMNIORB_BIN}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
-  OMNIORB_ROOT=`echo ${OMNIORB_ROOT} | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+  OMNIORB_ROOT=${OMNIORB_BIN}
+  # one-level up
+  OMNIORB_ROOT=`echo ${OMNIORB_ROOT}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+  #
+  #
+  if test -d $OMNIORB_ROOT/include ; then
+    # if $OMNIORB_ROOT/include exists, there are a lot of chance that
+    # this is omniORB4.x installed via configure && make && make install
+    OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin\$,lib,"`
+    OMNIORB_VERSION=4
+  else
+    # omniORB has been installed old way
+    OMNIORB_LIB=`echo ${OMNIORB_BIN} | sed -e "s,bin/,lib/,"`
+    # one-level up again
+    OMNIORB_ROOT=`echo ${OMNIORB_ROOT}  | sed -e "s,[[^/]]*$,,;s,/$,,;s,^$,.,"`
+    if test -d $OMNIORB_ROOT/include/omniORB4 ; then
+      OMNIORB_VERSION=4
+    else
+      OMNIORB_VERSION=3
+    fi
+  fi
   AC_SUBST(OMNIORB_ROOT)
 
-  OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB3 -I$OMNIORB_ROOT/include/COS"
-dnl  OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB4 -I$OMNIORB_ROOT/include/COS"
+  OMNIORB_INCLUDES="-I$OMNIORB_ROOT/include -I$OMNIORB_ROOT/include/omniORB${OMNIORB_VERSION} -I$OMNIORB_ROOT/include/COS"
   AC_SUBST(OMNIORB_INCLUDES)
 
   ENABLE_PTHREADS
 
-  OMNIORB_CXXFLAGS=
+  OMNIORB_CXXFLAGS="-DOMNIORB_VERSION=$OMNIORB_VERSION"
   case $build_cpu in
     sparc*)
       AC_DEFINE(__sparc__)
@@ -120,16 +136,23 @@ then
   AC_CHECK_LIB(nsl,gethostbyname, LIBS="-lnsl $LIBS",,)
 
   LIBS_old=$LIBS
-  OMNIORB_LIBS="$OMNIORB_LDFLAGS -lomniORB3 -ltcpwrapGK -lomniDynamic3 -lomnithread -lCOS3 -lCOSDynamic3"
-dnl  OMNIORB_LIBS="$OMNIORB_LDFLAGS -lomniORB4 -lomniDynamic4 -lomnithread -lCOS4 -lCOSDynamic4"
+  OMNIORB_LIBS="$OMNIORB_LDFLAGS"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomniORB${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomniDynamic${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lCOS${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lCOSDynamic${OMNIORB_VERSION}"
+  OMNIORB_LIBS="$OMNIORB_LIBS -lomnithread"
+  if test $OMNIORB_VERSION = 3 ; then
+    OMNIORB_LIBS="$OMNIORB_LIBS -ltcpwrapGK"
+  fi
   AC_SUBST(OMNIORB_LIBS)
 
   LIBS="$OMNIORB_LIBS $LIBS"
   CXXFLAGS_old=$CXXFLAGS
   CXXFLAGS="$CXXFLAGS $OMNIORB_CXXFLAGS $OMNIORB_INCLUDES"
 
-  AC_MSG_CHECKING(whether we can link with omniORB3)
-  AC_CACHE_VAL(salome_cv_lib_omniorb3,[
+  AC_MSG_CHECKING(whether we can link with omniORB)
+  AC_CACHE_VAL(salome_cv_lib_omniorb,[
     AC_TRY_LINK(
 #include <CORBA.h>
 ,   CORBA::ORB_var orb,
@@ -184,21 +207,22 @@ then
 
   CORBA_ORB_INIT_HAVE_3_ARGS=1
   AC_DEFINE(CORBA_ORB_INIT_HAVE_3_ARGS)
-  CORBA_ORB_INIT_THIRD_ARG='"omniORB3"'
-  AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB3")
+  CORBA_ORB_INIT_THIRD_ARG='"omniORB"'
+  AC_DEFINE(CORBA_ORB_INIT_THIRD_ARG, "omniORB")
 
 fi
 
 omniORBpy_ok=no
 if  test "x$omniORB_ok" = "xyes"
 then
-  AC_MSG_CHECKING(omniORBpy (CORBA.py file available))
-  if test -f ${OMNIORB_ROOT}/lib/python/CORBA.py
-  then
-    omniORBpy_ok=yes
-    PYTHONPATH=${OMNIORB_ROOT}/lib/python:${OMNIORB_LIB}:${PYTHON_PREFIX}/lib/python${PYTHON_VERSION}:${PYTHONPATH}
-    AC_SUBST(PYTHONPATH)
+  AC_MSG_CHECKING(omniORBpy)
+  $PYTHON -c "import omniORB" &> /dev/null
+  if test $? = 0 ; then
     AC_MSG_RESULT(yes)
+    omniORBpy_ok=yes
+  else
+    AC_MSG_RESULT(no, check your installation of omniORBpy)
+    omniORBpy_ok=no
   fi
 fi
 
index 760857dd9a203836b48f0b304713e7ca530c8bcd..e16c47ad73673f883823ef2c8c799484612d027f 100644 (file)
@@ -65,6 +65,7 @@ Engines_Container_i::Engines_Container_i (CORBA::ORB_ptr orb,
                                          bool activ ) :
  _numInstance(0)
 {
+  _pid = (long)getpid();
 
   if(regist)
     ActSigIntHandler() ;
@@ -449,3 +450,15 @@ void SigIntHandler(int what , siginfo_t * siginfo ,
     return ;
   }
 }
+
+// Get the PID of the Container
+
+long Engines_Container_i::getPID() {
+    return(_pid);
+}
+
+// Get the hostName of the Container
+
+char* Engines_Container_i::getHostName() {
+    return((char*)(GetHostname().c_str()));
+}
index a69758cb40de6de3a0a69bd8805873ea9ce233be..613f3ecf75f133d804b2151ee29b10ce5e47fd94 100644 (file)
@@ -72,6 +72,8 @@ public:
 
   // Kill current container
   bool Kill_impl() ;
+  char* getHostName();
+  long getPID();
 
 protected:
 
@@ -90,6 +92,7 @@ protected:
 
   int   _argc ;
   char** _argv ;
+  long _pid;
 
 };
 
index ab30f3379d505bce3e1bfa47c813b6ac5d2f87fa..900693e4106b5a547ac99b14b1570fee5e07c1c3 100644 (file)
@@ -15,8 +15,9 @@ import time
 import os
 
 trace="local"
-if (os.environ["SALOME_trace"] == "with_logger"):
-    trace="logger"
+if (os.environ.has_key("SALOME_trace")):
+    if (os.environ["SALOME_trace"] == "with_logger"):
+        trace="logger"
 
 class SALOME_Trace :
     def __init__(self):
index e22bf2d169a65f3fb79bbcb8e64e63b6d188ea5f..dde3261388331532bb793ee1da79e7e61e41f558 100644 (file)
@@ -31,7 +31,8 @@
 
 #include "utilities.h"
 //#include <omniORB4/CORBA.h>
-#include <omniORB3/CORBA.h>
+//##include <omniORB3/CORBA.h>
+#include <CORBA.h>
 #include <vector>
 #include <string>
 
index 14b3faf67b0e480771ad6c9f9a5717d22ec8ba0b..a0cc035ce59a4e905716b5a6cabcb7682d7da5c2 100644 (file)
@@ -279,8 +279,13 @@ int main(int argc, char** argv)
 { 
   try {
     // Initialise the ORB.
+#if OMNIORB_VERSION >= 4
+    const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
+    CORBA::ORB_var orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+#else
     CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB3");
     omniORB::MaxMessageSize(100 * 1024 * 1024);
+#endif
     
     // Obtain a reference to the root POA.
     CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
index 11be220654bbb55fb295c09ec34430591caa1f76..1ed30a91efe121876a87ea94c498d6faaa05ce3e 100644 (file)
@@ -129,8 +129,7 @@ int main(int argc, char** argv)
                      }
                  }
              }
-       
-           }
+                   }
          catch( const SALOME_Exception &ex )
            {
              MESSAGE( "Communication Error : " << ex.what() );
index 76d862ebf4c6f95868955d79f3fc30e8baf5cbc8..9a100591e5993238f8c750a7536d8eb2e15da098 100644 (file)
@@ -2478,7 +2478,9 @@ void QAD_Desktop::onOpenWith()
        } else if ( list_type_composants->length() > 1 ) {
          SALOMEGUI_OpenWith* aDlg = new SALOMEGUI_OpenWith( this );
          for (unsigned int ind = 0; ind < list_type_composants->length();ind++) {
-           aDlg->addComponent( strdup(list_type_composants[ind]) );
+           QString compusername = getComponentUserName(strdup(list_type_composants[ind]));
+           if ( compusername.compare("") != 0 )
+             aDlg->addComponent( compusername );
          }
          
          int retVal = aDlg->exec();
index 4154183067649c658d4a76ef96c5f75eaab20aa0..9b7d93fc60340dbdc8911a2f6b3423479070b6be 100644 (file)
@@ -150,6 +150,8 @@ QAD_ObjectBrowser::QAD_ObjectBrowser( SALOMEDS::Study_var study, QWidget* parent
   myStudy = SALOMEDS::Study::_duplicate( study );
   myListViewMap.clear();
   myUseCaseMap.clear();
+  myListView=0;    // must be done before setupListView(): setCornerWidget() provoque call to eventFilter
+  myUseCaseView=0; // and test myUseCaseView->viewport() before initialisation
   setupListView();
 }
 
@@ -339,6 +341,7 @@ bool QAD_ObjectBrowser::eventFilter( QObject* o, QEvent* e )
     return QTabWidget::eventFilter( o, e );
 
   SALOMEDS::UseCaseBuilder_var UCBuilder = myStudy->GetUseCaseBuilder();
+  if (! myUseCaseView) return QTabWidget::eventFilter( o, e );
   if (o == myUseCaseView->viewport()) {
     if ( e->type() == QEvent::MouseButtonPress ) {
       // Test if clicked on selection and start drag if necessary
index f270a26b6d12e55847c1509ef52d1bf1d6ea46d2..c7059d8558e11aaac706d96fa7b50dcf2248abd5 100644 (file)
 #include "SALOME_Log.hxx"
 using namespace std;
 
-SALOME_Log::SALOME_Log()
+SALOME_Log* SALOME_Log::_singleton = 0;
+
+// log line size: if too short, log line is truncated, without crash...
+char SALOME_LogStr[1024]; 
+
+SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
 {
 }
 
@@ -40,10 +45,10 @@ SALOME_Log::~SALOME_Log()
 {
 }
 
-SALOME_Log& SALOME_Log::Instance()
+SALOME_Log* SALOME_Log::Instance()
 {
-  static SALOME_Log instance;
-  return instance;
+  if (_singleton == 0) _singleton = new SALOME_Log();
+  return _singleton;
 }
 
 void SALOME_Log::putMessage(std::ostream& msg)
@@ -54,3 +59,4 @@ void SALOME_Log::putMessage(std::ostream& msg)
   seekp(0);
 }
 
+
index 2fbade5bf0c15f7bae26f2733feeacdbad1c1b33..30694062bf28f0e6f04d1605b88af6745b08c826 100644 (file)
@@ -69,17 +69,17 @@ using namespace std;
 
 class SALOME_Log : public ostrstream
 {
-public:
-  virtual ~SALOME_Log();
-  static Standard_EXPORT SALOME_Log& Instance();
-  Standard_EXPORT void putMessage(std::ostream& msg);
-
+private:
+  static SALOME_Log* _singleton;
 protected:
   //disable creation of instances: force use static SALOME_Log& Instance()
   SALOME_Log();
+public:
+  virtual ~SALOME_Log();
+  static Standard_EXPORT SALOME_Log* Instance();
+  Standard_EXPORT void putMessage(std::ostream& msg);
 };
 
-
 #define SLog SALOME_Log::Instance()
 
 #endif
index 70f7650382c31f9e1d25fe8d89fd3bf8c9cb939d..a468e9ffe6826e5acc737ee09d6a4f0afebd1128 100644 (file)
@@ -36,15 +36,14 @@ using namespace std;
 #include <SALOMEconfig.h>
 #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()
+SALOME_Log* SALOME_Log::_singleton = 0;
+
+// log line size: if too short, log line is truncated, without crash...
+char SALOME_LogStr[1024]; 
+
+SALOME_Log::SALOME_Log(): ostrstream(SALOME_LogStr,sizeof(SALOME_LogStr))
 {
   cout << "SALOME_LoggerClient: constructor" << endl;
   //get reference on object reference from NS
@@ -131,10 +130,10 @@ SALOME_Log::~SALOME_Log()
 {
 }
 
-SALOME_Log& SALOME_Log::Instance()
+SALOME_Log* SALOME_Log::Instance()
 {
-  static SALOME_Log instance;
-  return instance;
+  if (_singleton == 0) _singleton = new SALOME_Log();
+  return _singleton;
 }
 
 void SALOME_Log::putMessage(std::ostream& msg)
index 76de080f2b8fadc39eb2ccab0fa02e52495e6143..bdd9910f25af29600546d136fa596e6826db7035 100644 (file)
@@ -48,6 +48,8 @@ using namespace std;
 #include <SALOMEconfig.h>
 #include CORBA_SERVER_HEADER(SALOMEDS)
 
+SALOME_Session_QThread* SALOME_Session_QThread::_singleton = 0;
+
 //=============================================================================
 /*! SALOME_Session_QThread
  *  constructor
@@ -56,6 +58,7 @@ using namespace std;
 
 SALOME_Session_QThread::SALOME_Session_QThread(int argc, char ** argv) : QThread()
 {
+  INFOS("Creation SALOME_Session_QThread");
   _qappl = 0 ;
   _mw = 0 ;
   _argc = argc ;
@@ -63,6 +66,19 @@ SALOME_Session_QThread::SALOME_Session_QThread(int argc, char ** argv) : QThread
   _NS = 0 ;
 } ;
 
+//=============================================================================
+/*!
+ *  
+ */
+//=============================================================================
+
+  SALOME_Session_QThread* SALOME_Session_QThread::Instance(int argc, char ** argv)
+{
+  if (_singleton == 0) _singleton = new SALOME_Session_QThread(argc, argv);
+  return _singleton;
+
+}
+
 //=============================================================================
 /*! run
  *  Creates one QApplication for the all the session life.
index 9e9941bd7814552fbc47286b31d00b2b4e4bd7b7..eac1da8d65ceb0be7fe031e362d872e5f2271783 100644 (file)
@@ -41,7 +41,7 @@ class SALOME_Session_QThread: public QThread
 {
 
 public:
-  SALOME_Session_QThread(int argc, char ** argv) ;
+  static SALOME_Session_QThread* Instance(int argc, char ** argv);
 
   //! launch the Qt main window of the GUI on a separate thread
   virtual void run() ;
@@ -57,6 +57,10 @@ protected:
   QApplication *_qappl ;
 
   SALOMEGUI_Application* _mw ;
+  SALOME_Session_QThread(int argc, char ** argv);
+
+private:
+  static SALOME_Session_QThread* _singleton;
 } ;
 
 #endif
index 8c678fc68d419e26f55fa425ce91200383366d5d..dc16fae7deceae32874412b7906e3a3f963d2b5d 100644 (file)
@@ -52,7 +52,7 @@ SALOME_Session_i::SALOME_Session_i(int argc, char ** argv, CORBA::ORB_ptr orb, P
 {
   _argc = argc ;
   _argv = argv ;
-  _IAPPThread = new SALOME_Session_QThread(_argc, _argv) ;
+  _IAPPThread = SALOME_Session_QThread::Instance(_argc, _argv);
   _isGUI = FALSE ;
   _runningStudies= 0 ;
   _orb = CORBA::ORB::_duplicate(orb) ;
index c140441790beaf921926bd19614a7f008ad84974..c91a525e64024764bd298ef85e364a482a144d3e 100644 (file)
@@ -52,12 +52,15 @@ CORBA::ORB_var &ORB_INIT::operator() ( int argc , char **argv ) throw( CommExcep
        {
                try
                {
-                 //              const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
-                 //              _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+#if OMNIORB_VERSION >= 4
+                 const char* options[][2] = { { "giopMaxMsgSize", "104857600" }, { 0, 0 } };
+                 _orb = CORBA::ORB_init( argc , argv , "omniORB4", options) ;
+#else
                  _orb = CORBA::ORB_init( argc , argv ) ;
                  //set GIOP message size equal to 50Mb for transferring brep shapes as 
                  //sequence of bytes using C++ streams
                  omniORB::MaxMessageSize(100*1024*1024);
+#endif
                }
                catch( const CORBA::Exception &ex )
                {
index 09a5c129309784b081b8e9d0fa35e1393e1fed1d..f8b86b71e62814c71c318f8736524db66ddfffc3 100644 (file)
@@ -37,8 +37,8 @@
 
 /* ---  INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
 
-#define INFOS(msg)    {SLog.putMessage(SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
-#define PYSCRIPT(msg) {SLog.putMessage(SLog<<"---PYSCRIPT--- "<<msg<<endl);}
+#define INFOS(msg)    {SLog->putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<<msg<<endl);}
+#define PYSCRIPT(msg) {SLog->putMessage(*SLog<<"---PYSCRIPT--- "<<msg<<endl);}
 
 /* --- To print date and time of compilation of current source --- */
 
@@ -61,8 +61,8 @@
 #endif
 
 #define INFOS_COMPILATION { \
-                          SLog.putMessage(\
-                                          SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
+                          SLog->putMessage(\
+                                          *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\
                                           << "COMPILED with " << COMPILER \
                                           << ", " << __DATE__ \
                                           << " at " << __TIME__ <<endl); }
 
 /* --- the following MACROS are useful at debug time --- */
 
-#define MYTRACE SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " 
+#define MYTRACE *SLog << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " 
 
-#define MESSAGE(msg) {SLog.putMessage( MYTRACE <<msg<<endl<<ends); }
-#define SCRUTE(var)  {SLog.putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
+#define MESSAGE(msg) {SLog->putMessage( MYTRACE <<msg<<endl<<ends); }
+#define SCRUTE(var)  {SLog->putMessage( MYTRACE << #var << "=" << var <<endl<<ends); }
 
-#define REPERE SLog << "   --------------" << endl 
+#define REPERE *SLog << "   --------------" << endl 
 #define BEGIN_OF(msg) {REPERE;MYTRACE<<"Begin of: "     <<msg<<endl;REPERE;} 
 #define END_OF(msg)   {REPERE;MYTRACE<<"Normal end of: "<<msg<<endl;REPERE;}