-// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2010 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
+
// File : SMESH_Gen_i_DumpPython.cxx
// Created : Thu Mar 24 17:17:59 2005
// Author : Julia DOROVSKIKH
}
template<class TArray>
- void DumpArray(const TArray& theArray, std::ostringstream & theStream)
+ void DumpArray(const TArray& theArray, TPythonDump & theStream)
{
theStream << "[ ";
for (int i = 1; i <= theArray.length(); i++) {
TPythonDump&
TPythonDump::operator<<(const SMESH::long_array& theArg)
{
- DumpArray( theArg, myStream );
+ DumpArray( theArg, *this );
return *this;
}
TPythonDump&
TPythonDump::operator<<(const SMESH::double_array& theArg)
{
- DumpArray( theArg, myStream );
+ DumpArray( theArg, *this );
return *this;
}
SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
SALOMEDS::Study_var aStudy = aSMESHGen->GetCurrentStudy();
SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,theArg);
- if(!aSObject->_is_nil())
+ if(!aSObject->_is_nil() || CORBA::is_nil( theArg ))
return *this << aSObject;
SMESH::long_array_var anElementsId = theArg->GetIDs();
return *this << anElementsId;
return *this;
}
- TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups * theList){
- if(theList && theList->length() > 0 ) {
- SMESH_Gen_i* aSMESHGen = SMESH_Gen_i::GetSMESHGen();
- SALOMEDS::Study_ptr aStudy = aSMESHGen->GetCurrentStudy();
- myStream << "[";
- int aListLen = theList->length();
- for(int i = 0 ; i < aListLen; i++){
- SALOMEDS::SObject_var aSObject = SMESH_Gen_i::ObjectToSObject(aStudy,(*theList)[i]);
- if(!aSObject->_is_nil()) {
- myStream << aSObject->GetID();
- i < (aListLen - 1) ? myStream<<", " : myStream<<"]";
- }
-
- }
- }
+ TPythonDump& TPythonDump::operator<<(const SMESH::ListOfGroups& theList)
+ {
+ DumpArray( theList, *this );
+ return *this;
+ }
+ TPythonDump& TPythonDump::operator<<(const SMESH::ListOfIDSources& theList)
+ {
+ DumpArray( theList, *this );
return *this;
}
//================================================================================
/*!
- * \brief Return marker of long string literal beginning
- * \param type - a name of functionality producing the string literal
- * \retval TCollection_AsciiString - the marker string to be written into
- * a raw python script
+ * \brief Return marker of long string literal beginning
+ * \param type - a name of functionality producing the string literal
+ * \retval TCollection_AsciiString - the marker string to be written into
+ * a raw python script
*/
//================================================================================