From 15e49d24ae56bcaab6e3c2d8bddf3dc506e5cd83 Mon Sep 17 00:00:00 2001 From: srn Date: Thu, 2 Feb 2006 14:50:56 +0000 Subject: [PATCH] Changed ID to strings and added 2 methods to Study: GetCommonParameters and GetModuleParameters --- idl/SALOMEDS.idl | 16 +++ idl/SALOMEDS_Attributes.idl | 40 +++--- src/SALOMEDS/SALOMEDS_AttributeParameter.cxx | 76 ++++++------ src/SALOMEDS/SALOMEDS_AttributeParameter.hxx | 34 ++--- .../SALOMEDS_AttributeParameter_i.cxx | 44 +++---- .../SALOMEDS_AttributeParameter_i.hxx | 34 ++--- src/SALOMEDS/SALOMEDS_Study.cxx | 25 ++++ src/SALOMEDS/SALOMEDS_Study.hxx | 4 +- src/SALOMEDS/SALOMEDS_Study_i.cxx | 32 +++++ src/SALOMEDS/SALOMEDS_Study_i.hxx | 5 + .../SALOMEDSClient_AttributeParameter.hxx | 34 ++--- src/SALOMEDSClient/SALOMEDSClient_Study.hxx | 4 + .../SALOMEDSImpl_AttributeParameter.cxx | 116 +++++++++--------- .../SALOMEDSImpl_AttributeParameter.hxx | 48 ++++---- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 48 +++++++- src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx | 7 ++ src/SALOMEDSImpl/testDS.cxx | 54 ++++---- 17 files changed, 378 insertions(+), 243 deletions(-) diff --git a/idl/SALOMEDS.idl b/idl/SALOMEDS.idl index de883d82e..c15c9ee94 100644 --- a/idl/SALOMEDS.idl +++ b/idl/SALOMEDS.idl @@ -97,6 +97,7 @@ during each working session. interface ChildIterator; interface Driver; interface AttributeStudyProperties; + interface AttributeParameter; interface UseCaseIterator; interface UseCaseBuilder; @@ -370,6 +371,21 @@ during each working session. boolean DumpStudy(in string thePath, in string theBaseName, in boolean isPublished); +/*! + Returns an AttributeParameter used to store common parameters for given %theSavePoint. + \param theID identifies a common parameters set (Example: "Interface Applicative") + \param theSavePoint is number of a set of parameters as there can be several sets +*/ + AttributeParameter GetCommonParameters(in string theID, in long theSavePoint); + +/*! + Returns an AttributeParameter used to store parameters for given %theModuleName. + \param theID identifies a common parameters set (Example: "Interface Applicative") + \param theModuleName is a name of the module (Example: "Geometry") + \param theSavePoint is number of a set of parameters as there can be several sets +*/ + AttributeParameter GetModuleParameters(in string theID, in string theModuleName, in long theSavePoint); + /*! Private method, returns an implementation of this Study. \param theHostname is a hostname of the caller diff --git a/idl/SALOMEDS_Attributes.idl b/idl/SALOMEDS_Attributes.idl index e1ca3d8bc..9306818dc 100644 --- a/idl/SALOMEDS_Attributes.idl +++ b/idl/SALOMEDS_Attributes.idl @@ -1347,96 +1347,96 @@ Sets the item to be selectable \param theID An ID of a parameter. \param theValue A value of the parameter */ - void SetInt(in long theID, in long theValue); + void SetInt(in string theID, in long theValue); /*! Returns a int value associated with the given ID \param theID An ID of a parameter. */ - long GetInt(in long theID); + long GetInt(in string theID); /*! Associates a real value with the ID \param theID An ID of a parameter. \param theValue A value of the parameter */ - void SetReal(in long theID, in double theValue); + void SetReal(in string theID, in double theValue); /*! Returns a real value associated with the given ID \param theID An ID of a parameter. */ - double GetReal(in long theID); + double GetReal(in string theID); /*! Associates a string value with the ID \param theID An ID of a parameter. \param theValue A value of the parameter */ - void SetString(in long theID, in string theValue); + void SetString(in string theID, in string theValue); /*! Returns a string value associated with the given ID \param theID An ID of a parameter. */ - string GetString(in long theID); + string GetString(in string theID); /*! Associates a boolean value with the ID \param theID An ID of a parameter. \param theValue A value of the parameter */ - void SetBool(in long theID, in boolean theValue); + void SetBool(in string theID, in boolean theValue); /*! Returns a boolean value associated with the given ID \param theID An ID of a parameter. */ - boolean GetBool(in long theID); + boolean GetBool(in string theID); /*! Associates an array of real values with the ID \param theID An ID of a parameter. \param theArray The array of real values */ - void SetRealArray(in long theID, in DoubleSeq theArray); + void SetRealArray(in string theID, in DoubleSeq theArray); /*! Returns an array of real values associated with the ID \param theID An ID of a parameter. */ - DoubleSeq GetRealArray(in long theID); + DoubleSeq GetRealArray(in string theID); /*! Associates an array of integer values with the ID \param theID An ID of a parameter. \param theArray The array of integer values */ - void SetIntArray(in long theID, in LongSeq theArray); + void SetIntArray(in string theID, in LongSeq theArray); /*! Returns an array of integer values associated with the ID \param theID An ID of a parameter. */ - LongSeq GetIntArray(in long theID); + LongSeq GetIntArray(in string theID); /*! Associates an array of string values with the ID \param theID An ID of a parameter. \param theArray The array of string values */ - void SetStrArray(in long theID, in StringSeq theArray); + void SetStrArray(in string theID, in StringSeq theArray); /*! Returns an array of string values associated with the ID \param theID An ID of a parameter. */ - StringSeq GetStrArray(in long theID); + StringSeq GetStrArray(in string theID); /*! Returns True if for the ID of given type was assigned a value in the attribute \param theID An ID of a parameter. - \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(Triplet)]. + \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)]. */ - boolean IsSet(in long theID, in long theType); + boolean IsSet(in string theID, in long theType); /*! Removes a parameter with given ID and Type, returns True if succeded \param theID An ID of a parameter. - \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(Triplet)]. + \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)]. */ - boolean RemoveID(in long theID, in long theType); + boolean RemoveID(in string theID, in long theType); /*! Returns a father attribute of this attribute */ @@ -1455,9 +1455,9 @@ Sets the item to be selectable void Clear(); /*! Returns a sequence of ID's of the give type - \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(Triplet)]. + \param theType A type of parameter [0(Int), 1(Real), 2(Boolean), 3(String), 4(RealArray), 5(IntArray), 6(StrArray)]. */ - LongSeq GetIDs(in long theType); + StringSeq GetIDs(in long theType); }; }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx index 056ea49ea..6a91073ae 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter.cxx @@ -61,14 +61,14 @@ SALOMEDS_AttributeParameter::~SALOMEDS_AttributeParameter() * Purpose : Associates a integer value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetInt(const int theID, const int& theValue) +void SALOMEDS_AttributeParameter::SetInt(const string& theID, const int theValue) { CheckLocked(); if(_isLocal) Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetInt(theID, theValue); else - SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID, theValue); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetInt(theID.c_str(), theValue); } //======================================================================= @@ -77,13 +77,13 @@ void SALOMEDS_AttributeParameter::SetInt(const int theID, const int& theValue) * Purpose : Returns a int value associated with the given ID */ //======================================================================= -int SALOMEDS_AttributeParameter::GetInt(const int theID) +int SALOMEDS_AttributeParameter::GetInt(const string& theID) { int aValue; if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetInt(theID); else - aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID); + aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetInt(theID.c_str()); return aValue; } @@ -93,14 +93,14 @@ int SALOMEDS_AttributeParameter::GetInt(const int theID) * Purpose : Associates a double value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetReal(const int theID, const double& theValue) +void SALOMEDS_AttributeParameter::SetReal(const string& theID, const double& theValue) { CheckLocked(); if(_isLocal) Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetReal(theID, theValue); else - SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID, theValue); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetReal(theID.c_str(), theValue); } //======================================================================= @@ -109,13 +109,13 @@ void SALOMEDS_AttributeParameter::SetReal(const int theID, const double& theValu * Purpose : Returns a double value associated with the given ID */ //======================================================================= -double SALOMEDS_AttributeParameter::GetReal(const int theID) +double SALOMEDS_AttributeParameter::GetReal(const string& theID) { double aValue; if(_isLocal) aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetReal(theID); else - aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID); + aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetReal(theID.c_str()); return aValue; } @@ -125,14 +125,14 @@ double SALOMEDS_AttributeParameter::GetReal(const int theID) * Purpose : Associates a string with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetString(const int theID, const string& theValue) +void SALOMEDS_AttributeParameter::SetString(const string& theID, const string& theValue) { CheckLocked(); if(_isLocal) - Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, (char*)theValue.c_str()); + Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetString(theID, theValue); else - SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID, theValue.c_str()); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetString(theID.c_str(), theValue.c_str()); } //======================================================================= @@ -141,13 +141,13 @@ void SALOMEDS_AttributeParameter::SetString(const int theID, const string& theVa * Purpose : Returns a string associated with the given ID */ //======================================================================= -string SALOMEDS_AttributeParameter::GetString(const int theID) +string SALOMEDS_AttributeParameter::GetString(const string& theID) { string aValue; if(_isLocal) - aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID).ToCString(); + aValue = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetString(theID); else - aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID); + aValue = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetString(theID.c_str()); return aValue; } @@ -157,14 +157,14 @@ string SALOMEDS_AttributeParameter::GetString(const int theID) * Purpose : Associates a bool value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetBool(const int theID, const bool& theValue) +void SALOMEDS_AttributeParameter::SetBool(const string& theID, const bool& theValue) { CheckLocked(); if(_isLocal) Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->SetBool(theID, theValue); else - SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID, theValue); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetBool(theID.c_str(), theValue); } //======================================================================= @@ -173,12 +173,12 @@ void SALOMEDS_AttributeParameter::SetBool(const int theID, const bool& theValue) * Purpose : Returns a bool value associated with the ID */ //======================================================================= -bool SALOMEDS_AttributeParameter::GetBool(const int theID) +bool SALOMEDS_AttributeParameter::GetBool(const string& theID) { if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetBool(theID); else - return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID); + return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetBool(theID.c_str()); } //======================================================================= @@ -187,7 +187,7 @@ bool SALOMEDS_AttributeParameter::GetBool(const int theID) * Purpose : Associates an array of double values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetRealArray(const int theID, const vector& theArray) +void SALOMEDS_AttributeParameter::SetRealArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -200,7 +200,7 @@ void SALOMEDS_AttributeParameter::SetRealArray(const int theID, const vectorlength(length); for(int i = 0; iSetRealArray(theID, aSeq); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetRealArray(theID.c_str(), aSeq); } } @@ -210,13 +210,13 @@ void SALOMEDS_AttributeParameter::SetRealArray(const int theID, const vector SALOMEDS_AttributeParameter::GetRealArray(const int theID) +vector SALOMEDS_AttributeParameter::GetRealArray(const string& theID) { vector v; if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetRealArray(theID); else { - SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID); + SALOMEDS::DoubleSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetRealArray(theID.c_str()); int length = aSeq->length(); if(length) { v.resize(length); @@ -232,7 +232,7 @@ vector SALOMEDS_AttributeParameter::GetRealArray(const int theID) * Purpose : Associates an array of int values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetIntArray(const int theID, const vector& theArray) +void SALOMEDS_AttributeParameter::SetIntArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -245,7 +245,7 @@ void SALOMEDS_AttributeParameter::SetIntArray(const int theID, const vector aSeq->length(length); for(int i = 0; iSetIntArray(theID, aSeq); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetIntArray(theID.c_str(), aSeq); } } @@ -255,13 +255,13 @@ void SALOMEDS_AttributeParameter::SetIntArray(const int theID, const vector * Purpose : Returns an array of int values associated with the ID */ //======================================================================= -vector SALOMEDS_AttributeParameter::GetIntArray(const int theID) +vector SALOMEDS_AttributeParameter::GetIntArray(const string& theID) { vector v; if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetIntArray(theID); else { - SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID); + SALOMEDS::LongSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetIntArray(theID.c_str()); int length = aSeq->length(); if(length) { v.resize(length); @@ -277,7 +277,7 @@ vector SALOMEDS_AttributeParameter::GetIntArray(const int theID) * Purpose : Associates an array of string values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter::SetStrArray(const int theID, const vector& theArray) +void SALOMEDS_AttributeParameter::SetStrArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -290,7 +290,7 @@ void SALOMEDS_AttributeParameter::SetStrArray(const int theID, const vectorlength(length); for(int i = 0; iSetStrArray(theID, aSeq); + SALOMEDS::AttributeParameter::_narrow(_corba_impl)->SetStrArray(theID.c_str(), aSeq); } } @@ -300,13 +300,13 @@ void SALOMEDS_AttributeParameter::SetStrArray(const int theID, const vector SALOMEDS_AttributeParameter::GetStrArray(const int theID) +vector SALOMEDS_AttributeParameter::GetStrArray(const string& theID) { vector v; if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->GetStrArray(theID); else { - SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID); + SALOMEDS::StringSeq_var aSeq = SALOMEDS::AttributeParameter::_narrow(_corba_impl)->GetStrArray(theID.c_str()); int length = aSeq->length(); if(length) { v.resize(length); @@ -324,12 +324,12 @@ vector SALOMEDS_AttributeParameter::GetStrArray(const int theID) * a value in the attribute */ //======================================================================= -bool SALOMEDS_AttributeParameter::IsSet(const int theID, const int theType) +bool SALOMEDS_AttributeParameter::IsSet(const string& theID, const int theType) { if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->IsSet(theID, (Parameter_Types)theType); else - return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID, theType); + return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->IsSet(theID.c_str(), theType); } //======================================================================= @@ -338,14 +338,14 @@ bool SALOMEDS_AttributeParameter::IsSet(const int theID, const int theType) * Purpose : Removes a parameter with given ID */ //======================================================================= -bool SALOMEDS_AttributeParameter::RemoveID(const int theID, const int theType) +bool SALOMEDS_AttributeParameter::RemoveID(const string& theID, const int theType) { CheckLocked(); if(_isLocal) return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl)->RemoveID(theID, (Parameter_Types)theType); else - return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID, theType); + return SALOMEDS::AttributeParameter::_narrow(_corba_impl)->RemoveID(theID.c_str(), theType); } //======================================================================= @@ -419,20 +419,20 @@ void SALOMEDS_AttributeParameter::Clear() * Purpose : Returns an array of all ID's of the given type */ //======================================================================= -vector SALOMEDS_AttributeParameter::GetIDs(const int theType) +vector SALOMEDS_AttributeParameter::GetIDs(const int theType) { - vector v; + vector v; if(_isLocal) { Handle(SALOMEDSImpl_AttributeParameter) AP_impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_local_impl); return AP_impl->GetIDs((Parameter_Types)theType); } else { SALOMEDS::AttributeParameter_var AP_impl = SALOMEDS::AttributeParameter::_narrow(_corba_impl); - SALOMEDS::LongSeq_var CorbaSeq = AP_impl->GetIDs(theType); + SALOMEDS::StringSeq_var CorbaSeq = AP_impl->GetIDs(theType); int length = CorbaSeq->length(); if(length) { v.resize(length); - for(int i = 0; i & theArray); - virtual std::vector GetRealArray(const int theID); + virtual void SetRealArray(const std::string& theID, const std::vector& theArray); + virtual std::vector GetRealArray(const std::string& theID); - virtual void SetIntArray(const int theID, const std::vector& theArray); - virtual std::vector GetIntArray(const int theID); + virtual void SetIntArray(const std::string& theID, const std::vector& theArray); + virtual std::vector GetIntArray(const std::string& theID); - virtual void SetStrArray(const int theID, const std::vector& theArray); - virtual std::vector GetStrArray(const int theID); + virtual void SetStrArray(const std::string& theID, const std::vector& theArray); + virtual std::vector GetStrArray(const std::string& theID); - virtual bool IsSet(const int theID, const int theType); + virtual bool IsSet(const std::string& theID, const int theType); - virtual bool RemoveID(const int theID, const int theType); + virtual bool RemoveID(const std::string& theID, const int theType); virtual _PTR(AttributeParameter) GetFather(); virtual bool HasFather(); @@ -71,7 +71,7 @@ public: virtual void Clear(); - virtual std::vector GetIDs(const int theType); + virtual std::vector GetIDs(const int theType); }; #endif diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx index 653edce65..ff5023dbf 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.cxx @@ -36,7 +36,7 @@ using namespace std; * Purpose : Associates a integer value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetInt(CORBA::Long theID, CORBA::Long theValue) +void SALOMEDS_AttributeParameter_i::SetInt(const char* theID, CORBA::Long theValue) { SALOMEDS::Locker lock; CheckLocked(); @@ -49,7 +49,7 @@ void SALOMEDS_AttributeParameter_i::SetInt(CORBA::Long theID, CORBA::Long theVal * Purpose : Returns a int value associated with the given ID */ //======================================================================= -CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(CORBA::Long theID) +CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(const char* theID) { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetInt(theID); @@ -61,7 +61,7 @@ CORBA::Long SALOMEDS_AttributeParameter_i::GetInt(CORBA::Long theID) * Purpose : Associates a double value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetReal(CORBA::Long theID, const CORBA::Double theValue) +void SALOMEDS_AttributeParameter_i::SetReal(const char* theID, const CORBA::Double theValue) { SALOMEDS::Locker lock; CheckLocked(); @@ -74,7 +74,7 @@ void SALOMEDS_AttributeParameter_i::SetReal(CORBA::Long theID, const CORBA::Doub * Purpose : Returns a double value associated with the given ID */ //======================================================================= -CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(CORBA::Long theID) +CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(const char* theID) { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetReal(theID); @@ -86,12 +86,12 @@ CORBA::Double SALOMEDS_AttributeParameter_i::GetReal(CORBA::Long theID) * Purpose : Associates a string with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetString(CORBA::Long theID, const char* theValue) +void SALOMEDS_AttributeParameter_i::SetString(const char* theID, const char* theValue) { SALOMEDS::Locker lock; CheckLocked(); Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); - impl->SetString(theID, TCollection_AsciiString((char*)theValue)); + impl->SetString(theID, theValue); } //======================================================================= @@ -100,11 +100,11 @@ void SALOMEDS_AttributeParameter_i::SetString(CORBA::Long theID, const char* the * Purpose : Returns a string associated with the given ID */ //======================================================================= -char* SALOMEDS_AttributeParameter_i::GetString(CORBA::Long theID) +char* SALOMEDS_AttributeParameter_i::GetString(const char* theID) { SALOMEDS::Locker lock; Handle(SALOMEDSImpl_AttributeParameter) impl = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl); - CORBA::String_var c_s = CORBA::string_dup(TCollection_AsciiString(impl->GetString(theID)).ToCString()); + CORBA::String_var c_s = CORBA::string_dup(impl->GetString(theID).c_str()); return c_s._retn(); } @@ -114,7 +114,7 @@ char* SALOMEDS_AttributeParameter_i::GetString(CORBA::Long theID) * Purpose : Associates a bool value with the ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetBool(CORBA::Long theID, CORBA::Boolean theValue) +void SALOMEDS_AttributeParameter_i::SetBool(const char* theID, CORBA::Boolean theValue) { SALOMEDS::Locker lock; CheckLocked(); @@ -127,7 +127,7 @@ void SALOMEDS_AttributeParameter_i::SetBool(CORBA::Long theID, CORBA::Boolean th * Purpose : Returns a bool value associated with the ID */ //======================================================================= -CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(CORBA::Long theID) +CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(const char* theID) { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetBool(theID); @@ -139,7 +139,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::GetBool(CORBA::Long theID) * Purpose : Associates an array of double values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetRealArray(CORBA::Long theID, const SALOMEDS::DoubleSeq& theArray) +void SALOMEDS_AttributeParameter_i::SetRealArray(const char* theID, const SALOMEDS::DoubleSeq& theArray) { SALOMEDS::Locker lock; CheckLocked(); @@ -158,7 +158,7 @@ void SALOMEDS_AttributeParameter_i::SetRealArray(CORBA::Long theID, const SALOME * Purpose : Returns an array of double values associated with the ID */ //======================================================================= -SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(CORBA::Long theID) +SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(const char* theID) { SALOMEDS::Locker lock; SALOMEDS::DoubleSeq_var aSeq = new SALOMEDS::DoubleSeq; @@ -177,7 +177,7 @@ SALOMEDS::DoubleSeq* SALOMEDS_AttributeParameter_i::GetRealArray(CORBA::Long the * Purpose : Associates an array of int values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetIntArray(CORBA::Long theID, const SALOMEDS::LongSeq& theArray) +void SALOMEDS_AttributeParameter_i::SetIntArray(const char* theID, const SALOMEDS::LongSeq& theArray) { SALOMEDS::Locker lock; CheckLocked(); @@ -196,7 +196,7 @@ void SALOMEDS_AttributeParameter_i::SetIntArray(CORBA::Long theID, const SALOMED * Purpose : Returns an array of int values associated with the ID */ //======================================================================= -SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(CORBA::Long theID) +SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(const char* theID) { SALOMEDS::Locker lock; SALOMEDS::LongSeq_var aSeq = new SALOMEDS::LongSeq; @@ -215,7 +215,7 @@ SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIntArray(CORBA::Long theID) * Purpose : Associates an array of string values with the given ID */ //======================================================================= -void SALOMEDS_AttributeParameter_i::SetStrArray(CORBA::Long theID, const SALOMEDS::StringSeq& theArray) +void SALOMEDS_AttributeParameter_i::SetStrArray(const char* theID, const SALOMEDS::StringSeq& theArray) { SALOMEDS::Locker lock; CheckLocked(); @@ -234,7 +234,7 @@ void SALOMEDS_AttributeParameter_i::SetStrArray(CORBA::Long theID, const SALOMED * Purpose : Returns an array of string values associated with the ID */ //======================================================================= -SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(CORBA::Long theID) +SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(const char* theID) { SALOMEDS::Locker lock; SALOMEDS::StringSeq_var aSeq = new SALOMEDS::StringSeq; @@ -255,7 +255,7 @@ SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetStrArray(CORBA::Long theI * a value in the attribute */ //======================================================================= -CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(CORBA::Long theID, CORBA::Long theType) +CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(const char* theID, CORBA::Long theType) { SALOMEDS::Locker lock; return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->IsSet(theID, (Parameter_Types)theType); @@ -267,7 +267,7 @@ CORBA::Boolean SALOMEDS_AttributeParameter_i::IsSet(CORBA::Long theID, CORBA::Lo * Purpose : Removes a parameter with given ID */ //======================================================================= -CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(CORBA::Long theID, CORBA::Long theType) +CORBA::Boolean SALOMEDS_AttributeParameter_i::RemoveID(const char* theID, CORBA::Long theType) { SALOMEDS::Locker lock; CheckLocked(); @@ -331,16 +331,16 @@ void SALOMEDS_AttributeParameter_i::Clear() * Purpose : Returns an array of all ID's of the given type */ //======================================================================= -SALOMEDS::LongSeq* SALOMEDS_AttributeParameter_i::GetIDs(CORBA::Long theType) +SALOMEDS::StringSeq* SALOMEDS_AttributeParameter_i::GetIDs(CORBA::Long theType) { SALOMEDS::Locker lock; - SALOMEDS::LongSeq_var CorbaSeq = new SALOMEDS::LongSeq; - vector A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType); + SALOMEDS::StringSeq_var CorbaSeq = new SALOMEDS::StringSeq; + vector A = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(_impl)->GetIDs((Parameter_Types)theType); if(A.size()) { int length = A.size(); CorbaSeq->length(length); - for (int i = 0; i < length; i++) CorbaSeq[i] = A[i];; + for (int i = 0; i < length; i++) CorbaSeq[i] = CORBA::string_dup(A[i].c_str());; } return CorbaSeq._retn(); diff --git a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx index c732a518a..c393a208a 100644 --- a/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx +++ b/src/SALOMEDS/SALOMEDS_AttributeParameter_i.hxx @@ -48,30 +48,30 @@ public: ~SALOMEDS_AttributeParameter_i() {}; - virtual void SetInt(CORBA::Long theID, CORBA::Long theValue); - virtual CORBA::Long GetInt(CORBA::Long theID); + virtual void SetInt(const char* theID, CORBA::Long theValue); + virtual CORBA::Long GetInt(const char* theID); - virtual void SetReal(CORBA::Long theID, const CORBA::Double theValue); - virtual CORBA::Double GetReal(CORBA::Long theID); + virtual void SetReal(const char* theID, const CORBA::Double theValue); + virtual CORBA::Double GetReal(const char* theID); - virtual void SetString(CORBA::Long theID, const char* theValue); - virtual char* GetString(CORBA::Long theID); + virtual void SetString(const char* theID, const char* theValue); + virtual char* GetString(const char* theID); - virtual void SetBool(CORBA::Long theID, CORBA::Boolean theValue); - virtual CORBA::Boolean GetBool(CORBA::Long theID); + virtual void SetBool(const char* theID, CORBA::Boolean theValue); + virtual CORBA::Boolean GetBool(const char* theID); - virtual void SetRealArray(CORBA::Long theID, const SALOMEDS::DoubleSeq& theArray); - virtual SALOMEDS::DoubleSeq* GetRealArray(CORBA::Long theID); + virtual void SetRealArray(const char* theID, const SALOMEDS::DoubleSeq& theArray); + virtual SALOMEDS::DoubleSeq* GetRealArray(const char* theID); - virtual void SetIntArray(CORBA::Long theID, const SALOMEDS::LongSeq& theArray); - virtual SALOMEDS::LongSeq* GetIntArray(CORBA::Long theID); + virtual void SetIntArray(const char* theID, const SALOMEDS::LongSeq& theArray); + virtual SALOMEDS::LongSeq* GetIntArray(const char* theID); - virtual void SetStrArray(CORBA::Long theID, const SALOMEDS::StringSeq& theArray); - virtual SALOMEDS::StringSeq* GetStrArray(CORBA::Long theID); + virtual void SetStrArray(const char* theID, const SALOMEDS::StringSeq& theArray); + virtual SALOMEDS::StringSeq* GetStrArray(const char* theID); - virtual CORBA::Boolean IsSet(CORBA::Long theID, CORBA::Long theType); + virtual CORBA::Boolean IsSet(const char* theID, CORBA::Long theType); - virtual CORBA::Boolean RemoveID(CORBA::Long theID, CORBA::Long theType); + virtual CORBA::Boolean RemoveID(const char* theID, CORBA::Long theType); virtual SALOMEDS::AttributeParameter_ptr GetFather(); virtual CORBA::Boolean HasFather(); @@ -79,7 +79,7 @@ public: virtual void Clear(); - virtual SALOMEDS::LongSeq* GetIDs(CORBA::Long theType); + virtual SALOMEDS::StringSeq* GetIDs(CORBA::Long theType); }; diff --git a/src/SALOMEDS/SALOMEDS_Study.cxx b/src/SALOMEDS/SALOMEDS_Study.cxx index 1f6c1ee87..16705635a 100644 --- a/src/SALOMEDS/SALOMEDS_Study.cxx +++ b/src/SALOMEDS/SALOMEDS_Study.cxx @@ -40,6 +40,8 @@ #include "SALOMEDSImpl_AttributeStudyProperties.hxx" #include "SALOMEDS_UseCaseBuilder.hxx" #include "SALOMEDSImpl_UseCaseBuilder.hxx" +#include "SALOMEDS_AttributeParameter.hxx" +#include "SALOMEDSImpl_AttributeParameter.hxx" #include "SALOMEDS_Driver_i.hxx" #include "SALOMEDS_Study_i.hxx" @@ -549,6 +551,28 @@ bool SALOMEDS_Study::DumpStudy(const std::string& thePath, const std::string& th return ret; } +_PTR(AttributeParameter) SALOMEDS_Study::GetCommonParameters(const string& theID, int theSavePoint) +{ + SALOMEDSClient_AttributeParameter* AP = NULL; + if(_isLocal) AP = new SALOMEDS_AttributeParameter(_local_impl->GetCommonParameters(theID.c_str(), theSavePoint)); + else AP = new SALOMEDS_AttributeParameter(_corba_impl->GetCommonParameters(theID.c_str(), theSavePoint)); + return _PTR(AttributeParameter)(AP); +} + +_PTR(AttributeParameter) SALOMEDS_Study::GetModuleParameters(const string& theID, + const string& theModuleName, + int theSavePoint) +{ + SALOMEDSClient_AttributeParameter* AP = NULL; + if(_isLocal) AP = new SALOMEDS_AttributeParameter(_local_impl->GetModuleParameters(theID.c_str(), + theModuleName.c_str(), + theSavePoint)); + else AP = new SALOMEDS_AttributeParameter(_corba_impl->GetModuleParameters(theID.c_str(), + theModuleName.c_str(), + theSavePoint)); + return _PTR(AttributeParameter)(AP); +} + std::string SALOMEDS_Study::ConvertObjectToIOR(CORBA::Object_ptr theObject) { return _orb->object_to_string(theObject); @@ -588,3 +612,4 @@ SALOMEDS::Study_ptr SALOMEDS_Study::GetStudy() return SALOMEDS::Study::_nil(); } + diff --git a/src/SALOMEDS/SALOMEDS_Study.hxx b/src/SALOMEDS/SALOMEDS_Study.hxx index db2ce6999..506c02c33 100644 --- a/src/SALOMEDS/SALOMEDS_Study.hxx +++ b/src/SALOMEDS/SALOMEDS_Study.hxx @@ -87,7 +87,9 @@ public: virtual void Close(); virtual void EnableUseCaseAutoFilling(bool isEnabled); virtual bool DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished); - + virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint); + virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, + const std::string& theModuleName, int theSavePoint); std::string ConvertObjectToIOR(CORBA::Object_ptr theObject); CORBA::Object_ptr ConvertIORToObject(const std::string& theIOR); diff --git a/src/SALOMEDS/SALOMEDS_Study_i.cxx b/src/SALOMEDS/SALOMEDS_Study_i.cxx index 6db403acb..45fa259a1 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.cxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.cxx @@ -27,6 +27,7 @@ #include "SALOMEDS_UseCaseIterator_i.hxx" #include "SALOMEDS_GenericAttribute_i.hxx" #include "SALOMEDS_AttributeStudyProperties_i.hxx" +#include "SALOMEDS_AttributeParameter_i.hxx" #include "SALOMEDS_ChildIterator_i.hxx" #include "SALOMEDS_Driver_i.hxx" #include "SALOMEDS.hxx" @@ -35,6 +36,7 @@ #include "SALOMEDSImpl_SComponent.hxx" #include "SALOMEDSImpl_UseCaseBuilder.hxx" #include "SALOMEDSImpl_AttributeStudyProperties.hxx" +#include "SALOMEDSImpl_AttributeParameter.hxx" #include "SALOMEDSImpl_ChildIterator.hxx" #include @@ -748,6 +750,36 @@ CORBA::Boolean SALOMEDS_Study_i::DumpStudy(const char* thePath, const char* theB return ret; } +//============================================================================ +/*! Function : GetCommonParameters + * Purpose : + */ +//============================================================================ +SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetCommonParameters(const char* theID, CORBA::Long theSavePoint) +{ + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetCommonParameters(theID, theSavePoint); + SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); + return SP->AttributeParameter::_this(); +} + +//============================================================================ +/*! Function : GetCommonModuleParameters + * Purpose : + */ +//============================================================================ +SALOMEDS::AttributeParameter_ptr SALOMEDS_Study_i::GetModuleParameters(const char* theID, + const char* theModuleName, + CORBA::Long theSavePoint) +{ + SALOMEDS::Locker lock; + + Handle(SALOMEDSImpl_AttributeParameter) anAttr = _impl->GetModuleParameters(theID, theModuleName, theSavePoint); + SALOMEDS_AttributeParameter_i* SP = new SALOMEDS_AttributeParameter_i(anAttr, _orb); + return SP->AttributeParameter::_this(); +} + //=========================================================================== // PRIVATE FUNCTIONS //=========================================================================== diff --git a/src/SALOMEDS/SALOMEDS_Study_i.hxx b/src/SALOMEDS/SALOMEDS_Study_i.hxx index b10719216..24f857734 100644 --- a/src/SALOMEDS/SALOMEDS_Study_i.hxx +++ b/src/SALOMEDS/SALOMEDS_Study_i.hxx @@ -279,6 +279,11 @@ public: // theWay = -1: get back to the list of postponed #endif + virtual SALOMEDS::AttributeParameter_ptr GetCommonParameters(const char* theID, CORBA::Long theSavePoint); + virtual SALOMEDS::AttributeParameter_ptr GetModuleParameters(const char* theID, + const char* theModuleName, + CORBA::Long theSavePoint); + virtual CORBA::Boolean DumpStudy(const char* thePath, const char* theBaseName, CORBA::Boolean isPublished); virtual Handle(SALOMEDSImpl_Study) GetImpl() { return _impl; } diff --git a/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx b/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx index 118d84cce..e8c3f1752 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_AttributeParameter.hxx @@ -34,30 +34,30 @@ class SALOMEDSClient_AttributeParameter : public virtual SALOMEDSClient_GenericA public: - virtual void SetInt(const int theID, const int& theValue) = 0; - virtual int GetInt(const int theID) = 0; + virtual void SetInt(const std::string& theID, const int theValue) = 0; + virtual int GetInt(const std::string& theID) = 0; - virtual void SetReal(const int theID, const double& theValue) = 0; - virtual double GetReal(const int theID) = 0; + virtual void SetReal(const std::string& theID, const double& theValue) = 0; + virtual double GetReal(const std::string& theID) = 0; - virtual void SetString(const int theID, const std::string& theValue) = 0; - virtual std::string GetString(const int theID) = 0; + virtual void SetString(const std::string& theID, const std::string& theValue) = 0; + virtual std::string GetString(const std::string& theID) = 0; - virtual void SetBool(const int theID, const bool& theValue) = 0; - virtual bool GetBool(const int theID) = 0; + virtual void SetBool(const std::string& theID, const bool& theValue) = 0; + virtual bool GetBool(const std::string& theID) = 0; - virtual void SetRealArray(const int theID, const std::vector& theArray) = 0; - virtual std::vector GetRealArray(const int theID) = 0; + virtual void SetRealArray(const std::string& theID, const std::vector& theArray) = 0; + virtual std::vector GetRealArray(const std::string& theID) = 0; - virtual void SetIntArray(const int theID, const std::vector& theArray) = 0; - virtual std::vector GetIntArray(const int theID) = 0; + virtual void SetIntArray(const std::string& theID, const std::vector& theArray) = 0; + virtual std::vector GetIntArray(const std::string& theID) = 0; - virtual void SetStrArray(const int theID, const std::vector& theArray) = 0; - virtual std::vector GetStrArray(const int theID) = 0; + virtual void SetStrArray(const std::string& theID, const std::vector& theArray) = 0; + virtual std::vector GetStrArray(const std::string& theID) = 0; - virtual bool IsSet(const int theID, const int theType) = 0; + virtual bool IsSet(const std::string& theID, const int theType) = 0; - virtual bool RemoveID(const int theID, const int theType) = 0; + virtual bool RemoveID(const std::string& theID, const int theType) = 0; virtual _PTR(AttributeParameter) GetFather() = 0; virtual bool HasFather() = 0; @@ -65,7 +65,7 @@ public: virtual void Clear() = 0; - virtual std::vector GetIDs(const int theType) = 0; + virtual std::vector GetIDs(const int theType) = 0; }; #endif diff --git a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx index 4a33f2b9d..ea8c08874 100644 --- a/src/SALOMEDSClient/SALOMEDSClient_Study.hxx +++ b/src/SALOMEDSClient/SALOMEDSClient_Study.hxx @@ -30,6 +30,7 @@ #include "SALOMEDSClient_definitions.hxx" #include "SALOMEDSClient_SComponentIterator.hxx" #include "SALOMEDSClient_StudyBuilder.hxx" +#include "SALOMEDSClient_AttributeParameter.hxx" #include "SALOMEDSClient_SObject.hxx" #include "SALOMEDSClient_SComponent.hxx" #include "SALOMEDSClient_UseCaseBuilder.hxx" @@ -80,6 +81,9 @@ public: virtual void Close() = 0; virtual void EnableUseCaseAutoFilling(bool isEnabled) = 0; virtual bool DumpStudy(const std::string& thePath, const std::string& theBaseName, bool isPublished) = 0; + virtual _PTR(AttributeParameter) GetCommonParameters(const std::string& theID, int theSavePoint) = 0; + virtual _PTR(AttributeParameter) GetModuleParameters(const std::string& theID, + const std::string& theModuleName, int theSavePoint) = 0; }; diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx index ccf0e96f3..929dec934 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.cxx @@ -115,7 +115,7 @@ Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_AttributeParameter::Set (co * Purpose : Associates a integer value with the ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetInt(const int theID, const int& theValue) +void SALOMEDSImpl_AttributeParameter::SetInt(const string& theID, const int& theValue) { CheckLocked(); @@ -132,7 +132,7 @@ void SALOMEDSImpl_AttributeParameter::SetInt(const int theID, const int& theValu * Purpose : Returns a int value associated with the given ID */ //======================================================================= -int SALOMEDSImpl_AttributeParameter::GetInt(const int theID) +int SALOMEDSImpl_AttributeParameter::GetInt(const string& theID) { if(!IsSet(theID, PT_INTEGER)) Standard_Failure::Raise("Invalid ID"); return _ints[theID]; @@ -144,7 +144,7 @@ int SALOMEDSImpl_AttributeParameter::GetInt(const int theID) * Purpose : Associates a double value with the ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetReal(const int theID, const double& theValue) +void SALOMEDSImpl_AttributeParameter::SetReal(const string& theID, const double& theValue) { CheckLocked(); @@ -161,7 +161,7 @@ void SALOMEDSImpl_AttributeParameter::SetReal(const int theID, const double& the * Purpose : Returns a double value associated with the given ID */ //======================================================================= -double SALOMEDSImpl_AttributeParameter::GetReal(const int theID) +double SALOMEDSImpl_AttributeParameter::GetReal(const string& theID) { if(!IsSet(theID, PT_REAL)) Standard_Failure::Raise("Invalid ID"); return _reals[theID]; @@ -173,14 +173,13 @@ double SALOMEDSImpl_AttributeParameter::GetReal(const int theID) * Purpose : Associates a string with the ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetString(const int theID, const TCollection_AsciiString& theValue) +void SALOMEDSImpl_AttributeParameter::SetString(const string& theID, const string& theValue) { CheckLocked(); Backup(); - string s(theValue.ToCString()); - _strings[theID] = s; + _strings[theID] = theValue; SetModifyFlag(); } @@ -191,11 +190,10 @@ void SALOMEDSImpl_AttributeParameter::SetString(const int theID, const TCollecti * Purpose : Returns a string associated with the given ID */ //======================================================================= -TCollection_AsciiString SALOMEDSImpl_AttributeParameter::GetString(const int theID) +string SALOMEDSImpl_AttributeParameter::GetString(const string& theID) { if(!IsSet(theID, PT_STRING)) Standard_Failure::Raise("Invalid ID"); - string s = _strings[theID]; - return TCollection_AsciiString((char*)s.c_str()); + return _strings[theID]; } //======================================================================= @@ -204,7 +202,7 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::GetString(const int the * Purpose : Associates a bool value with the ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetBool(const int theID, const bool& theValue) +void SALOMEDSImpl_AttributeParameter::SetBool(const string& theID, const bool& theValue) { CheckLocked(); @@ -221,7 +219,7 @@ void SALOMEDSImpl_AttributeParameter::SetBool(const int theID, const bool& theVa * Purpose : Returns a bool value associated with the ID */ //======================================================================= -bool SALOMEDSImpl_AttributeParameter::GetBool(const int theID) +bool SALOMEDSImpl_AttributeParameter::GetBool(const string& theID) { if(!IsSet(theID, PT_BOOLEAN)) Standard_Failure::Raise("Invalid ID"); return _bools[theID]; @@ -233,7 +231,7 @@ bool SALOMEDSImpl_AttributeParameter::GetBool(const int theID) * Purpose : Associates an array of double values with the given ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetRealArray(const int theID, const vector& theArray) +void SALOMEDSImpl_AttributeParameter::SetRealArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -250,7 +248,7 @@ void SALOMEDSImpl_AttributeParameter::SetRealArray(const int theID, const vector * Purpose : Returns double values associated with the ID */ //======================================================================= -vector SALOMEDSImpl_AttributeParameter::GetRealArray(const int theID) +vector SALOMEDSImpl_AttributeParameter::GetRealArray(const string& theID) { if(!IsSet(theID, PT_REALARRAY)) Standard_Failure::Raise("Invalid ID"); return _realarrays[theID]; @@ -263,7 +261,7 @@ vector SALOMEDSImpl_AttributeParameter::GetRealArray(const int theID) * Purpose : Associates an array of int values with the given ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetIntArray(const int theID, const vector& theArray) +void SALOMEDSImpl_AttributeParameter::SetIntArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -280,7 +278,7 @@ void SALOMEDSImpl_AttributeParameter::SetIntArray(const int theID, const vector< * Purpose : Returns int values associated with the ID */ //======================================================================= -vector SALOMEDSImpl_AttributeParameter::GetIntArray(const int theID) +vector SALOMEDSImpl_AttributeParameter::GetIntArray(const string& theID) { if(!IsSet(theID, PT_INTARRAY)) Standard_Failure::Raise("Invalid ID"); return _intarrays[theID]; @@ -293,7 +291,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIntArray(const int theID) * Purpose : Associates an array of string values with the given ID */ //======================================================================= -void SALOMEDSImpl_AttributeParameter::SetStrArray(const int theID, const vector& theArray) +void SALOMEDSImpl_AttributeParameter::SetStrArray(const string& theID, const vector& theArray) { CheckLocked(); @@ -310,7 +308,7 @@ void SALOMEDSImpl_AttributeParameter::SetStrArray(const int theID, const vector< * Purpose : Returns string values associated with the ID */ //======================================================================= -vector SALOMEDSImpl_AttributeParameter::GetStrArray(const int theID) +vector SALOMEDSImpl_AttributeParameter::GetStrArray(const string& theID) { if(!IsSet(theID, PT_STRARRAY)) Standard_Failure::Raise("Invalid ID"); return _strarrays[theID]; @@ -324,7 +322,7 @@ vector SALOMEDSImpl_AttributeParameter::GetStrArray(const int theID) * a value in the attribute */ //======================================================================= -bool SALOMEDSImpl_AttributeParameter::IsSet(const int theID, const Parameter_Types theType) +bool SALOMEDSImpl_AttributeParameter::IsSet(const string& theID, const Parameter_Types theType) { switch(theType) { case PT_INTEGER: { @@ -367,7 +365,7 @@ bool SALOMEDSImpl_AttributeParameter::IsSet(const int theID, const Parameter_Typ * Purpose : Removes a parameter with given ID */ //======================================================================= -bool SALOMEDSImpl_AttributeParameter::RemoveID(const int theID, const Parameter_Types theType) +bool SALOMEDSImpl_AttributeParameter::RemoveID(const string& theID, const Parameter_Types theType) { Backup(); SetModifyFlag(); @@ -485,17 +483,17 @@ void SALOMEDSImpl_AttributeParameter::Clear() * Purpose : Returns an array of all ID's of the given type */ //======================================================================= -vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theType) +vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theType) { - vector anArray; + vector anArray; int i = 0; switch(theType) { case PT_INTEGER: { if(_ints.size()) { anArray.resize(_ints.size()); - for(map::const_iterator p = _ints.begin(); p != _ints.end(); p++, i++) + for(map::const_iterator p = _ints.begin(); p != _ints.end(); p++, i++) anArray[i] = p->first; } break; @@ -503,7 +501,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_REAL: { if(_reals.size()) { anArray.resize(_reals.size()); - for(map::const_iterator p = _reals.begin(); p != _reals.end(); p++, i++) + for(map::const_iterator p = _reals.begin(); p != _reals.end(); p++, i++) anArray[i] = p->first; } break; @@ -511,7 +509,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_BOOLEAN: { if(_bools.size()) { anArray.resize(_bools.size()); - for(map::const_iterator p = _bools.begin(); p != _bools.end(); p++, i++) + for(map::const_iterator p = _bools.begin(); p != _bools.end(); p++, i++) anArray[i] = p->first; } break; @@ -519,7 +517,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_STRING: { if(_strings.size()) { anArray.resize(_strings.size()); - for(map::const_iterator p = _strings.begin(); p!= _strings.end(); p++) + for(map::const_iterator p = _strings.begin(); p!= _strings.end(); p++) anArray[i] = p->first; } break; @@ -527,7 +525,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_REALARRAY: { if(_realarrays.size()) { anArray.resize(_realarrays.size()); - for(map< int, vector >::const_iterator p = _realarrays.begin(); p!= _realarrays.end(); p++) + for(map< string, vector >::const_iterator p = _realarrays.begin(); p!= _realarrays.end(); p++) anArray[i] = p->first; } break; @@ -535,7 +533,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_INTARRAY: { if(_intarrays.size()) { anArray.resize(_intarrays.size()); - for(map< int, vector >::const_iterator p = _intarrays.begin(); p!= _intarrays.end(); p++) + for(map< string, vector >::const_iterator p = _intarrays.begin(); p!= _intarrays.end(); p++) anArray[i] = p->first; } break; @@ -543,7 +541,7 @@ vector SALOMEDSImpl_AttributeParameter::GetIDs(const Parameter_Types theTyp case PT_STRARRAY: { if(_strarrays.size()) { anArray.resize(_strarrays.size()); - for(map< int, vector >::const_iterator p = _strarrays.begin(); p!= _strarrays.end(); p++) + for(map< string, vector >::const_iterator p = _strarrays.begin(); p!= _strarrays.end(); p++) anArray[i] = p->first; } break; @@ -585,16 +583,16 @@ void SALOMEDSImpl_AttributeParameter::Restore(const Handle(TDF_Attribute)& with) _intarrays.clear(); _strarrays.clear(); - for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second; - for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second; - for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second; - for(map::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) + for(map::const_iterator p = A->_ints.begin(); p!= A->_ints.end(); p++) _ints[p->first] = p->second; + for(map::const_iterator p = A->_reals.begin(); p!= A->_reals.end(); p++) _reals[p->first] = p->second; + for(map::const_iterator p = A->_bools.begin(); p!= A->_bools.end(); p++) _bools[p->first] = p->second; + for(map::const_iterator p = A->_strings.begin(); p!= A->_strings.end(); p++) _strings[p->first] = p->second; - for(map< int,vector >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) + for(map< string,vector >::const_iterator p = A->_realarrays.begin(); p!= A->_realarrays.end(); p++) _realarrays[p->first] = p->second; - for(map< int,vector >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) + for(map< string,vector >::const_iterator p = A->_intarrays.begin(); p!= A->_intarrays.end(); p++) _intarrays[p->first] = p->second; - for(map< int,vector >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) + for(map< string,vector >::const_iterator p = A->_strarrays.begin(); p!= A->_strarrays.end(); p++) _strarrays[p->first] = p->second; } @@ -623,30 +621,30 @@ TCollection_AsciiString SALOMEDSImpl_AttributeParameter::Save() buffer << _ints.size() << " "; - for(map::const_iterator p = _ints.begin(); p != _ints.end(); p++) { - buffer << p->first << " " << p->second << " "; + for(map::const_iterator p = _ints.begin(); p != _ints.end(); p++) { + buffer << convertString(p->first) << " " << p->second << " "; } buffer << _reals.size() << " "; - for(map::const_iterator p =_reals.begin(); p != _reals.end(); p++) { + for(map::const_iterator p =_reals.begin(); p != _reals.end(); p++) { sprintf(tmpBuffer, "%.64e", p->second); - buffer << p->first << " " << tmpBuffer << " "; + buffer << convertString(p->first) << " " << tmpBuffer << " "; } buffer << _bools.size() << " "; - for(map::const_iterator p = _bools.begin(); p != _bools.end(); p++) { - buffer << p->first << " " << p->second << " "; + for(map::const_iterator p = _bools.begin(); p != _bools.end(); p++) { + buffer << convertString(p->first) << " " << p->second << " "; } buffer << _strings.size() << " "; - for(map::const_iterator p = _strings.begin(); p != _strings.end(); p++) { - buffer << p->first << " " << convertString(p->second) << " "; + for(map::const_iterator p = _strings.begin(); p != _strings.end(); p++) { + buffer << convertString(p->first) << " " << convertString(p->second) << " "; } buffer << _realarrays.size() << " "; - for(map< int,vector >::const_iterator p = _realarrays.begin(); p != _realarrays.end(); p++) { + for(map< string,vector >::const_iterator p = _realarrays.begin(); p != _realarrays.end(); p++) { vector v(p->second); - sprintf(tmpBuffer, " %d %d ", p->first, v.size()); + sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size()); buffer << tmpBuffer; for(int i = 0; i >::const_iterator p = _intarrays.begin(); p != _intarrays.end(); p++) { + for(map< string,vector >::const_iterator p = _intarrays.begin(); p != _intarrays.end(); p++) { vector v(p->second); - sprintf(tmpBuffer, " %d %d ", p->first, v.size()); + sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size()); buffer << tmpBuffer; for(int i = 0; i >::const_iterator p = _strarrays.begin(); p != _strarrays.end(); p++) { + for(map< string,vector >::const_iterator p = _strarrays.begin(); p != _strarrays.end(); p++) { vector v(p->second); - sprintf(tmpBuffer, " %d %d ", p->first, v.size()); + sprintf(tmpBuffer, " %s %d ", convertString(p->first).c_str(), v.size()); buffer << tmpBuffer; for(int i = 0; i> size; for(int i = 1; i<=size; i++) { buffer >> id >> val; - _ints[id] = val; + _ints[restoreString(id)] = val; } buffer >> size; for(int i = 1; i<=size; i++) { buffer >> id >> val2; - _reals[id] = val2; + _reals[restoreString(id)] = val2; } buffer >> size; for(int i = 1; i<=size; i++) { buffer >> id >> val; - _bools[id] = val; + _bools[restoreString(id)] = val; } buffer >> size; for(int i = 1; i<=size; i++) { buffer >> id >> s; - _strings[id] = restoreString(s); + _strings[restoreString(id)] = restoreString(s); } buffer >> size; @@ -738,7 +736,7 @@ void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theVal buffer >> val2; v[j] = val2; } - _realarrays[id] = v; + _realarrays[restoreString(id)] = v; } buffer >> size; @@ -750,7 +748,7 @@ void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theVal buffer >> ival; v[j] = ival; } - _intarrays[id] = v; + _intarrays[restoreString(id)] = v; } buffer >> size; @@ -762,6 +760,6 @@ void SALOMEDSImpl_AttributeParameter::Load(const TCollection_AsciiString& theVal buffer >> s; v[j] = restoreString(s); } - _strarrays[id] = v; + _strarrays[restoreString(id)] = v; } } diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx index 92b2e16b3..ab273ae50 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_AttributeParameter.hxx @@ -54,13 +54,13 @@ class SALOMEDSImpl_AttributeParameter : public SALOMEDSImpl_GenericAttribute private: - std::map _ints; - std::map _reals; - std::map _strings; - std::map _bools; - std::map< int, vector > _realarrays; - std::map< int, vector > _intarrays; - std::map< int, vector > _strarrays; + std::map _ints; + std::map _reals; + std::map _strings; + std::map _bools; + std::map< std::string, vector > _realarrays; + std::map< std::string, vector > _intarrays; + std::map< std::string, vector > _strarrays; public: Standard_EXPORT static const Standard_GUID& GetID() ; @@ -69,36 +69,36 @@ public: Standard_EXPORT static Handle(SALOMEDSImpl_AttributeParameter) Set (const TDF_Label& L); - Standard_EXPORT void SetInt(const int theID, const int& theValue); - Standard_EXPORT int GetInt(const int theID); + Standard_EXPORT void SetInt(const std::string& theID, const int& theValue); + Standard_EXPORT int GetInt(const std::string& theID); - Standard_EXPORT void SetReal(const int theID, const double& theValue); - Standard_EXPORT double GetReal(const int theID); + Standard_EXPORT void SetReal(const std::string& theID, const double& theValue); + Standard_EXPORT double GetReal(const std::string& theID); - Standard_EXPORT void SetString(const int theID, const TCollection_AsciiString& theValue); - Standard_EXPORT TCollection_AsciiString GetString(const int theID); + Standard_EXPORT void SetString(const std::string& theID, const std::string& theValue); + Standard_EXPORT std::string GetString(const std::string& theID); - Standard_EXPORT void SetBool(const int theID, const bool& theValue); - Standard_EXPORT bool GetBool(const int theID); + Standard_EXPORT void SetBool(const std::string& theID, const bool& theValue); + Standard_EXPORT bool GetBool(const std::string& theID); - Standard_EXPORT void SetRealArray(const int theID, const std::vector& theArray); - Standard_EXPORT std::vector GetRealArray(const int theID); + Standard_EXPORT void SetRealArray(const std::string& theID, const std::vector& theArray); + Standard_EXPORT std::vector GetRealArray(const std::string& theID); - Standard_EXPORT void SetIntArray(const int theID, const std::vector& theArray); - Standard_EXPORT std::vector GetIntArray(const int theID); + Standard_EXPORT void SetIntArray(const std::string& theID, const std::vector& theArray); + Standard_EXPORT std::vector GetIntArray(const std::string& theID); - Standard_EXPORT void SetStrArray(const int theID, const std::vector& theArray); - Standard_EXPORT std::vector GetStrArray(const int theID); + Standard_EXPORT void SetStrArray(const std::string& theID, const std::vector& theArray); + Standard_EXPORT std::vector GetStrArray(const std::string& theID); - Standard_EXPORT bool IsSet(const int theID, const Parameter_Types theType); + Standard_EXPORT bool IsSet(const std::string& theID, const Parameter_Types theType); - Standard_EXPORT bool RemoveID(const int theID, const Parameter_Types theType); + Standard_EXPORT bool RemoveID(const std::string& theID, const Parameter_Types theType); Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetFather(); Standard_EXPORT bool HasFather(); Standard_EXPORT bool IsRoot(); - Standard_EXPORT std::vector GetIDs(const Parameter_Types theType); + Standard_EXPORT std::vector GetIDs(const Parameter_Types theType); Standard_EXPORT void Clear(); diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index b181b0fb2..700284799 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -1318,12 +1318,10 @@ bool SALOMEDSImpl_Study::DumpStudy(const TCollection_AsciiString& thePath, if (aDriver != NULL) { Handle(SALOMEDSImpl_StudyBuilder) SB = NewBuilder(); - cout << "Before SB" << endl; if(!SB->LoadWith(sco, aDriver)) { _errorCode = SB->GetErrorCode(); return false; } - cout << "After SB" << endl; } else continue; } @@ -1493,3 +1491,49 @@ void SALOMEDSImpl_Study::Modify() _errorCode = ""; _doc->Modify(); } + +//============================================================================ +/*! Function : + * Purpose : + */ +//============================================================================ +Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetCommonParameters(const char* theID, int theSavePoint) +{ + Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); + Handle(SALOMEDSImpl_SObject) so = FindComponent((char*)theID); + if(so.IsNull()) so = builder->NewComponent((char*)theID); + Handle(SALOMEDSImpl_SObject) newSO = builder->NewObjectToTag(so, theSavePoint); + return Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(newSO, "AttributeParameter")); +} + +//============================================================================ +/*! Function : + * Purpose : + */ +//============================================================================ +Handle(SALOMEDSImpl_AttributeParameter) SALOMEDSImpl_Study::GetModuleParameters(const char* theID, + const char* theModuleName, + int theSavePoint) +{ + Handle(SALOMEDSImpl_AttributeParameter) main_ap = GetCommonParameters(theID, theSavePoint); + Handle(SALOMEDSImpl_SObject) main_so = main_ap->GetSObject(); + Handle(SALOMEDSImpl_AttributeParameter) par; + + Handle(SALOMEDSImpl_ChildIterator) it = NewChildIterator(main_so); + string moduleName(theModuleName); + for(; it->More(); it->Next()) { + Handle(SALOMEDSImpl_SObject) so(it->Value()); + Handle(SALOMEDSImpl_GenericAttribute) ga; + if(so->FindAttribute(ga, "AttributeParameter")) { + par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(ga); + if(!par->IsSet("AP_MODULE_NAME", (Parameter_Types)3)) continue; //3 -> PT_STRING + if(par->GetString("AP_MODULE_NAME") == moduleName) return par; + } + } + + Handle(SALOMEDSImpl_StudyBuilder) builder = NewBuilder(); + Handle(SALOMEDSImpl_SObject) so = builder->NewObject(main_so); + par = Handle(SALOMEDSImpl_AttributeParameter)::DownCast(builder->FindOrCreateAttribute(so, "AttributeParameter")); + par->SetString("AP_MODULE_NAME", moduleName); + return par; +} diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx index d87b4ec8d..bdf3972f7 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.hxx @@ -56,6 +56,7 @@ DEFINE_STANDARD_HANDLE( SALOMEDSImpl_Study, MMgt_TShared ) #include "SALOMEDSImpl_UseCaseBuilder.hxx" #include "SALOMEDSImpl_AttributeStudyProperties.hxx" #include "SALOMEDSImpl_AttributeIOR.hxx" +#include "SALOMEDSImpl_AttributeParameter.hxx" #include "SALOMEDSImpl_Callback.hxx" #include "SALOMEDSImpl_Driver.hxx" #include "SALOMEDSImpl_ChildIterator.hxx" @@ -268,6 +269,12 @@ public: //This method marks the study as being modified Standard_EXPORT void Modify(); + Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetCommonParameters(const char* theID, int theSavePoint); + + Standard_EXPORT Handle(SALOMEDSImpl_AttributeParameter) GetModuleParameters(const char* theID, + const char* theModuleName, + int theSavePoint); + public: DEFINE_STANDARD_RTTI( SALOMEDSImpl_Study ) diff --git a/src/SALOMEDSImpl/testDS.cxx b/src/SALOMEDSImpl/testDS.cxx index b430b3dc1..0f8f2f61b 100644 --- a/src/SALOMEDSImpl/testDS.cxx +++ b/src/SALOMEDSImpl/testDS.cxx @@ -105,33 +105,35 @@ int main (int argc, char * argv[]) cout << "AttributeParameter with type : " << AP->Type() << endl; - AP->SetInt(1, 123); - cout << "IsSet for int: " << AP->IsSet(1, PT_INTEGER) << " value : " << AP->GetInt(1) << endl; - for(int i = 2; i < 5; i++) AP->SetInt(i, i*i); + AP->SetInt("1", 123); + cout << "IsSet for int: " << AP->IsSet("1", PT_INTEGER) << " value : " << AP->GetInt("1") << endl; + //for(int i = 2; i < 5; i++) AP->SetInt(i, i*i); - AP->SetReal(1, 123.123); - cout << "IsSet for real: " << AP->IsSet(1, PT_REAL) << " value : " << AP->GetReal(1) << endl; - for(int i = 2; i < 5; i++) AP->SetReal(i, 0.1); + AP->SetReal("1", 123.123); + cout << "IsSet for real: " << AP->IsSet("1", PT_REAL) << " value : " << AP->GetReal("1") << endl; + //for(int i = 2; i < 5; i++) AP->SetReal(i, 0.1); - AP->SetString(1, "value is 123.123!"); - cout << "IsSet for string: " << AP->IsSet(1, PT_STRING) << " value : " << AP->GetString(1) << endl; + AP->SetString("1", "value is 123.123!"); + cout << "IsSet for string: " << AP->IsSet("1", PT_STRING) << " value : " << AP->GetString("1") << endl; + /* for(int i = 2; i < 5; i++) { TCollection_AsciiString s((double)(1.0/i)); cout << "Setting for " << i << " value : " << s << endl; AP->SetString(i, s); } + */ - AP->SetBool(1, true); - cout << "IsSet for bool: " << AP->IsSet(1, PT_BOOLEAN) << " value : " << AP->GetBool(1) << endl; - for(int i = 2; i < 5; i++) AP->SetBool(i, 0); + AP->SetBool("1", true); + cout << "IsSet for bool: " << AP->IsSet("1", PT_BOOLEAN) << " value : " << AP->GetBool("1") << endl; + //for(int i = 2; i < 5; i++) AP->SetBool(i, 0); vector v; v.push_back(111.111); v.push_back(222.22222); v.push_back(333.3333333); - AP->SetRealArray(1, v); - cout << "IsSet for array: " << AP->IsSet(1, PT_REALARRAY); - vector v2 = AP->GetRealArray(1); + AP->SetRealArray("1", v); + cout << "IsSet for array: " << AP->IsSet("1", PT_REALARRAY); + vector v2 = AP->GetRealArray("1"); cout.precision(10); cout << " values : "; for(int i = 0; iSetRealArray(2, v); + AP->SetRealArray("2", v); vector vi; vi.push_back(1); vi.push_back(2); - AP->SetIntArray(2, vi); + AP->SetIntArray("2", vi); vector vs; vs.push_back("hello, "); vs.push_back("world!"); - AP->SetStrArray(3, vs); + AP->SetStrArray("3", vs); TCollection_AsciiString as = AP->Save(); cout << "AS = " << as << endl; AP->Load(as); - cout << "Restored string with id = 1 is: " << AP->GetString(1) << endl; - cout << "Restored int with id = 2 is: " << AP->GetInt(2) << endl; - cout << "Restored real with id = 3 is: " << AP->GetReal(3) << endl; - cout << "Restored bool with id = 1 is: " << AP->GetBool(1) << endl; + cout << "Restored string with id = 1 is: " << AP->GetString("1") << endl; + cout << "Restored int with id = 2 is: " << AP->GetInt("1") << endl; + cout << "Restored real with id = 3 is: " << AP->GetReal("1") << endl; + cout << "Restored bool with id = 1 is: " << AP->GetBool("1") << endl; - v2 = AP->GetRealArray(2); + v2 = AP->GetRealArray("2"); cout << "Restored real array with id = 2 is: "; for(int i = 0; iGetIntArray(2); + vi = AP->GetIntArray("2"); cout << "Restored int array with id = 2 is: "; for(int i = 0; iGetStrArray(3); + vs = AP->GetStrArray("3"); cout << "Restored string array with id = 2 is: "; for(int i = 0; iRemoveID(1, PT_INTEGER); - cout << "IsSet with id = 1, type = PT_INTEGER : " << AP->IsSet(1, PT_INTEGER) << endl; + AP->RemoveID("1", PT_INTEGER); + cout << "IsSet with id = 1, type = PT_INTEGER : " << AP->IsSet("1", PT_INTEGER) << endl; cout << "Check RemoveID is done" << endl; cout << "Check AttributeParameter : done" << endl; -- 2.39.2