From 23d265a7a729adcd4a3442a4e01826cbb4f9f77c Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 6 Mar 2013 16:30:42 +0000 Subject: [PATCH] PPGP issue. Fix dump of not published SMESH_IDSource's. As a result DumpStudy command fails. --- src/SMESH_I/SMESH_2smeshpy.cxx | 5 +++++ src/SMESH_I/SMESH_DumpPython.cxx | 18 +++++++++--------- src/SMESH_I/SMESH_PythonDump.hxx | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/SMESH_I/SMESH_2smeshpy.cxx b/src/SMESH_I/SMESH_2smeshpy.cxx index 5b10f9914..6351ac79b 100644 --- a/src/SMESH_I/SMESH_2smeshpy.cxx +++ b/src/SMESH_I/SMESH_2smeshpy.cxx @@ -179,6 +179,11 @@ namespace { void CheckObjectPresence( const Handle(_pyCommand)& cmd, set<_pyID> & presentObjects) { + if ( cmd->GetString().Location( TPythonDump::NotPublishedObjectName(), 1, cmd->Length() )) + { + cmd->Comment(); + return; + } for ( int iArg = cmd->GetNbArgs(); iArg; --iArg ) { const _pyID& arg = cmd->GetArg( iArg ); diff --git a/src/SMESH_I/SMESH_DumpPython.cxx b/src/SMESH_I/SMESH_DumpPython.cxx index 34c1c32cc..0a8014386 100644 --- a/src/SMESH_I/SMESH_DumpPython.cxx +++ b/src/SMESH_I/SMESH_DumpPython.cxx @@ -43,15 +43,11 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -static TCollection_AsciiString NotPublishedObjectName() -{ - return "__NOT__Published__Object__"; -} - namespace SMESH { size_t TPythonDump::myCounter = 0; + const char theNotPublishedObjectName[] = "__NOT__Published__Object__"; TVar::TVar(CORBA::Double value):myVals(1) { myVals[0] = SMESH_Comment(value); } TVar::TVar(CORBA::Long value):myVals(1) { myVals[0] = SMESH_Comment(value); } @@ -279,7 +275,7 @@ namespace SMESH myStream << entry.in(); } else { - myStream << NotPublishedObjectName(); + myStream << theNotPublishedObjectName; } return *this; } @@ -298,7 +294,7 @@ namespace SMESH if ( aSMESHGen->CanPublishInStudy( theArg )) // not published SMESH object myStream << "smeshObj_" << size_t(theArg); else - myStream << NotPublishedObjectName(); + myStream << theNotPublishedObjectName; } else myStream << "None"; @@ -343,7 +339,7 @@ namespace SMESH SMESH::ElementType type = types->length() ? types[0] : SMESH::ALL; return *this << mesh << ".GetIDSource(" << anElementsId << ", " << type << ")"; } - return *this; + return *this << theNotPublishedObjectName; } TPythonDump& @@ -505,6 +501,10 @@ namespace SMESH DumpArray( theList, *this ); return *this; } + const char* TPythonDump::NotPublishedObjectName() + { + return theNotPublishedObjectName; + } TCollection_AsciiString myLongStringStart( "TPythonDump::LongStringStart" ); TCollection_AsciiString myLongStringEnd ( "TPythonDump::LongStringEnd" ); @@ -679,7 +679,7 @@ Engines::TMPFile* SMESH_Gen_i::DumpPython (CORBA::Object_ptr theStudy, CORBA::Octet* anOctetBuf = (CORBA::Octet*)aBuffer; Engines::TMPFile_var aStreamFile = new Engines::TMPFile(aLen+1, aLen+1, anOctetBuf, 1); - bool hasNotPublishedObjects = aScript.Location( NotPublishedObjectName(), 1, aLen); + bool hasNotPublishedObjects = aScript.Location( SMESH::theNotPublishedObjectName, 1, aLen); isValidScript = isValidScript && !hasNotPublishedObjects; return aStreamFile._retn(); diff --git a/src/SMESH_I/SMESH_PythonDump.hxx b/src/SMESH_I/SMESH_PythonDump.hxx index 4ff5cfc28..852f7bc91 100644 --- a/src/SMESH_I/SMESH_PythonDump.hxx +++ b/src/SMESH_I/SMESH_PythonDump.hxx @@ -213,6 +213,7 @@ namespace SMESH static const char* SMESHGenName() { return "smeshgen"; } static const char* MeshEditorName() { return "mesh_editor"; } + static const char* NotPublishedObjectName(); /*! * \brief Return marker of long string literal beginning -- 2.39.2