From: prascle Date: Sun, 8 Feb 2004 22:04:10 +0000 (+0000) Subject: PR: merge from trunk 07Feb04 X-Git-Tag: BR_multhr_20040212~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=ce7559b20ac5151d2f42a5a8028f5b6c69b1e2ce;p=modules%2Fkernel.git PR: merge from trunk 07Feb04 --- diff --git a/src/Logger/SALOME_Trace.py b/src/Logger/SALOME_Trace.py index ab30f3379..900693e41 100644 --- a/src/Logger/SALOME_Trace.py +++ b/src/Logger/SALOME_Trace.py @@ -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): diff --git a/src/SALOMEGUI/QAD_Desktop.cxx b/src/SALOMEGUI/QAD_Desktop.cxx index d003e66ff..974dab6fa 100644 --- a/src/SALOMEGUI/QAD_Desktop.cxx +++ b/src/SALOMEGUI/QAD_Desktop.cxx @@ -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(); diff --git a/src/SALOMELocalTrace/SALOME_Log.cxx b/src/SALOMELocalTrace/SALOME_Log.cxx index 476d987f4..98acfd69a 100644 --- a/src/SALOMELocalTrace/SALOME_Log.cxx +++ b/src/SALOMELocalTrace/SALOME_Log.cxx @@ -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); } + diff --git a/src/SALOMELocalTrace/SALOME_Log.hxx b/src/SALOMELocalTrace/SALOME_Log.hxx index 043d1e1c2..af4f565da 100644 --- a/src/SALOMELocalTrace/SALOME_Log.hxx +++ b/src/SALOMELocalTrace/SALOME_Log.hxx @@ -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 diff --git a/src/SALOMELogger/SALOME_LoggerClient.cxx b/src/SALOMELogger/SALOME_LoggerClient.cxx index 70f765038..a468e9ffe 100644 --- a/src/SALOMELogger/SALOME_LoggerClient.cxx +++ b/src/SALOMELogger/SALOME_LoggerClient.cxx @@ -36,15 +36,14 @@ using namespace std; #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() +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) diff --git a/src/Utils/utilities.h b/src/Utils/utilities.h index 015e84e58..f396321e8 100644 --- a/src/Utils/utilities.h +++ b/src/Utils/utilities.h @@ -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__<<"] : "<putMessage(*SLog<<__FILE__<<" ["<<__LINE__<<"] : "<putMessage(*SLog<<"---PYSCRIPT--- "<putMessage(\ + *SLog<<__FILE__<<" ["<< __LINE__<<"] : "\ << "COMPILED with " << COMPILER \ << ", " << __DATE__ \ << " at " << __TIME__ <