]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
PR: merge from trunk 07Feb04
authorprascle <prascle>
Sun, 8 Feb 2004 22:04:10 +0000 (22:04 +0000)
committerprascle <prascle>
Sun, 8 Feb 2004 22:04:10 +0000 (22:04 +0000)
src/Logger/SALOME_Trace.py
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMELocalTrace/SALOME_Log.cxx
src/SALOMELocalTrace/SALOME_Log.hxx
src/SALOMELogger/SALOME_LoggerClient.cxx
src/Utils/utilities.h

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 d003e66ffecd74ca44e3bdf7f9c722a7ecb79c75..974dab6fa6111154e5bea0e67c75ed56164719bf 100644 (file)
@@ -2484,7 +2484,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 476d987f41b53f4762436464a19bf25a0a619351..98acfd69aef0a39b43aa5980e0ca525ad2d0dcdb 100644 (file)
@@ -33,18 +33,24 @@ using namespace std;
 
 #include "SALOME_Log.hxx"
 
-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))
 {
+  //cerr << endl << "#-=-# " << endl;
 }
 
 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)
@@ -55,3 +61,4 @@ void SALOME_Log::putMessage(std::ostream& msg)
   seekp(0);
 }
 
+
index 043d1e1c2e1efd0eba52977be1101e237336e074..af4f565dadb4fc384da43e10a2b0946834f65609 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 015e84e58f0fd9263c47337d1e5ebad366078980..f396321e87bcb363775ace52c41f8b1c5626733f 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 --- */
 
@@ -59,8 +59,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;}