From 2124dabbe428a2d46e36b3265593b2ffc57b35f9 Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 8 Sep 2008 06:55:13 +0000 Subject: [PATCH] =?utf8?q?Remove=20debug=20output=20from=20terminal.=20Avo?= =?utf8?q?id=20using=20"utilities.h"=20in=20standalone=20(non-CORBA)=20cla?= =?utf8?q?sses=20(requested=20by=20B.S=C3=A9cher=20via=20mail)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/ResourcesManager/ResourcesManager.cxx | 67 ++++++++++++++++------- 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/src/ResourcesManager/ResourcesManager.cxx b/src/ResourcesManager/ResourcesManager.cxx index 06dc126ed..18a549287 100644 --- a/src/ResourcesManager/ResourcesManager.cxx +++ b/src/ResourcesManager/ResourcesManager.cxx @@ -30,8 +30,6 @@ #include #include -#include "utilities.h" - #define MAX_SIZE_FOR_HOSTNAME 256; using namespace std; @@ -46,7 +44,9 @@ ResourcesManager_cpp:: ResourcesManager_cpp(const char *xmlFilePath) : _path_resources(xmlFilePath) { - MESSAGE ( "ResourcesManager_cpp constructor" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "ResourcesManager_cpp constructor" << endl; +#endif } //============================================================================= @@ -62,7 +62,9 @@ ResourcesManager_cpp(const char *xmlFilePath) : ResourcesManager_cpp::ResourcesManager_cpp() { - MESSAGE ( "ResourcesManager_cpp constructor" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "ResourcesManager_cpp constructor" << endl; +#endif _isAppliSalomeDefined = (getenv("APPLI") != 0); if (_isAppliSalomeDefined) @@ -80,7 +82,9 @@ ResourcesManager_cpp::ResourcesManager_cpp() } ParseXmlFile(); - MESSAGE ( "ResourcesManager_cpp constructor end" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "ResourcesManager_cpp constructor end"; +#endif } //============================================================================= @@ -91,7 +95,9 @@ ResourcesManager_cpp::ResourcesManager_cpp() ResourcesManager_cpp::~ResourcesManager_cpp() { - MESSAGE ( "ResourcesManager_cpp destructor" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "ResourcesManager_cpp destructor" << endl; +#endif } //============================================================================= @@ -112,23 +118,33 @@ std::vector ResourcesManager_cpp::GetFittingResources(const machineParams& params, const std::vector& componentList) throw(ResourcesException) { +//#if defined(_DEBUG_) || defined(_DEBUG) // cerr << "ResourcesManager_cpp::GetFittingResources" << endl; +//#endif vector vec; ParseXmlFile(); const char *hostname = params.hostname.c_str(); - MESSAGE ( "GetFittingResources " << hostname << " " << GetHostname().c_str() ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "GetFittingResources " << hostname << " " << GetHostname().c_str() << endl; +#endif if (hostname[0] != '\0'){ - // cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl; +//#if defined(_DEBUG_) || defined(_DEBUG) +// cerr << "ResourcesManager_cpp::GetFittingResources : hostname specified" << endl; +//#endif if ( strcmp(hostname, "localhost") == 0 || strcmp(hostname, GetHostname().c_str()) == 0 ) { - // cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl; +//#if defined(_DEBUG_) || defined(_DEBUG) +// cerr << "ResourcesManager_cpp::GetFittingResources : localhost" << endl; +//#endif vec.push_back(GetHostname().c_str()); - // cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl; +//#if defined(_DEBUG_) || defined(_DEBUG) +// cerr << "ResourcesManager_cpp::GetFittingResources : " << vec.size() << endl; +//#endif } else if (_resourcesList.find(hostname) != _resourcesList.end()) @@ -149,15 +165,19 @@ ResourcesManager_cpp::GetFittingResources(const machineParams& params, if( (*iter).second.DataForSort._nbOfNodes > 1 ){ if( strncmp(hostname,(*iter).first.c_str(),strlen(hostname)) == 0 ){ vec.push_back((*iter).first.c_str()); - //cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector[" - // << cpt << "] = " << (*iter).first.c_str() << endl ; +//#if defined(_DEBUG_) || defined(_DEBUG) +// cerr << "SALOME_ResourcesManager_cpp::GetFittingResources vector[" +// << cpt << "] = " << (*iter).first.c_str() << endl ; +//#endif cpt++; } } } if(cpt==0){ // --- user specified an unknown hostame so notify him. - MESSAGE ( "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "ResourcesManager_cpp::GetFittingResources : SALOME_Exception" << endl; +#endif throw ResourcesException("unknown host"); } } @@ -273,7 +293,9 @@ void ResourcesManager_cpp::WriteInXmlFile() if (aFile == NULL) { - INFOS ( "Error opening file !" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "Error opening file !" << endl; +#endif return; } @@ -287,15 +309,18 @@ void ResourcesManager_cpp::WriteInXmlFile() int isOk = xmlSaveFile(aFilePath, aDoc); - if (!isOk) - INFOS ( "Error while XML file saving." ); +#if defined(_DEBUG_) || defined(_DEBUG) + if (!isOk) cerr << "Error while XML file saving." << endl; +#endif // Free the document xmlFreeDoc(aDoc); fclose(aFile); - INFOS ( "WRITING DONE!" ); +#if defined(_DEBUG_) || defined(_DEBUG) + cerr << "WRITING DONE!" << endl; +#endif } //============================================================================= @@ -318,16 +343,20 @@ const MapOfParserResourcesType& ResourcesManager_cpp::ParseXmlFile() if (aDoc != NULL) handler->ProcessXmlDocument(aDoc); +#if defined(_DEBUG_) || defined(_DEBUG) else - INFOS ( "ResourcesManager_cpp: could not parse file "<< aFilePath ); + cerr << "ResourcesManager_cpp: could not parse file "<< aFilePath << endl; +#endif // Free the document xmlFreeDoc(aDoc); fclose(aFile); } +#if defined(_DEBUG_) || defined(_DEBUG) else - INFOS ( "ResourcesManager_cpp: file "<