From f3836994011c8020c240202c73000e6910b11f4e Mon Sep 17 00:00:00 2001 From: asl Date: Wed, 25 Nov 2009 08:22:54 +0000 Subject: [PATCH] 1. GetParameters() is implemented 2. Debug --- src/GEOM_I/GEOM_Object_i.cc | 39 ++++++++++++++++++++----------------- src/GEOM_I/GEOM_Object_i.hh | 6 ++++-- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/src/GEOM_I/GEOM_Object_i.cc b/src/GEOM_I/GEOM_Object_i.cc index 91108bdb3..2e9b99946 100644 --- a/src/GEOM_I/GEOM_Object_i.cc +++ b/src/GEOM_I/GEOM_Object_i.cc @@ -431,32 +431,35 @@ bool GEOM_Object_i::IsShape() void GEOM_Object_i::SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters ) { - //printf( "set parameters\n" ); - int n = theParameters.length(); - if ( n <= 0 ) - return; - theNotebook->ClearDependencies( _this(), SALOME::Parameters ); + _parameters.clear(); + int n = theParameters.length(); Handle( GEOM_Function ) aFunc = _impl->GetLastFunction(); - TColStd_Array1OfAsciiString aParams( 1, n ); - char* aStr; for( int i = 0; i < n; i++ ) { - aStr = CORBA::string_dup( theParameters[i] ); - //printf( "\tparam = %s\n", aStr ); - SALOME::Parameter_ptr aParam = theNotebook->GetParameter( aStr ); - TCollection_AsciiString anAsciiName; - if( !CORBA::is_nil( aParam ) ) - { - //printf( "add dep\n" ); - theNotebook->AddDependency( _this(), aParam ); - anAsciiName = aStr; - } - aFunc->SetParam( i+1, anAsciiName ); + std::string aParam = CORBA::string_dup( theParameters[i] ); + SALOME::Parameter_ptr aParamPtr = theNotebook->GetParameter( aParam.c_str() ); + if( !CORBA::is_nil( aParamPtr ) ) + theNotebook->AddDependency( _this(), aParamPtr ); + + aFunc->SetParam( i+1, TCollection_AsciiString( aParam.c_str() ) ); + _parameters.push_back( aParam ); } } +SALOME::StringArray* GEOM_Object_i::GetParameters() +{ + SALOME::StringArray_var aParams = new SALOME::StringArray(); + + aParams->length( _parameters.size() ); + std::list::const_iterator it = _parameters.begin(), last = _parameters.end(); + for( int i=0; it!=last; it++, i++ ) + aParams[i] = CORBA::string_dup( it->c_str() ); + + return aParams._retn(); +} + char* GEOM_Object_i::GetComponent() { return CORBA::string_dup( "GEOM" ); diff --git a/src/GEOM_I/GEOM_Object_i.hh b/src/GEOM_I/GEOM_Object_i.hh index 24aac5613..d3e40bad0 100644 --- a/src/GEOM_I/GEOM_Object_i.hh +++ b/src/GEOM_I/GEOM_Object_i.hh @@ -94,6 +94,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public virtual void SetParameters( SALOME::Notebook_ptr theNotebook, const SALOME::StringArray& theParameters ); + virtual SALOME::StringArray* GetParameters(); + virtual void StoreDependencies( SALOME::Notebook_ptr theNotebook ); virtual char* GetComponent(); @@ -104,8 +106,8 @@ class GEOM_I_EXPORT GEOM_Object_i : public virtual POA_GEOM::GEOM_Object, public Handle(GEOM_Object) GetImpl() { return _impl; } - private: - +private: + std::list _parameters; GEOM::GEOM_Gen_var _engine; Handle(GEOM_Object) _impl; TopoDS_Shape _geom; -- 2.39.2