From 50998af82bc6d9e252b9ccb14005d17a4a3d00f4 Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 17 Jun 2016 14:48:00 +0300 Subject: [PATCH] Fix ParametersAPI --- src/ModelHighAPI/ModelHighAPI.i | 7 ++++--- src/ParametersAPI/ParametersAPI_Parameter.cpp | 9 ++++++--- src/ParametersAPI/ParametersAPI_Parameter.h | 11 +++++++---- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/ModelHighAPI/ModelHighAPI.i b/src/ModelHighAPI/ModelHighAPI.i index 1a043be26..7ebba1a57 100644 --- a/src/ModelHighAPI/ModelHighAPI.i +++ b/src/ModelHighAPI/ModelHighAPI.i @@ -113,6 +113,10 @@ $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 ); } +// std::list -> [] +%template(SelectionList) std::list; +%template(RefAttrList) std::list; + // all supported interfaces %include "ModelHighAPI_Double.h" %include "ModelHighAPI_Integer.h" @@ -121,6 +125,3 @@ %include "ModelHighAPI_Selection.h" %include "ModelHighAPI_Macro.h" %include "ModelHighAPI_Tools.h" - -%template(SelectionList) std::list; -%template(RefAttrList) std::list; diff --git a/src/ParametersAPI/ParametersAPI_Parameter.cpp b/src/ParametersAPI/ParametersAPI_Parameter.cpp index 8ea872d37..fc89a2392 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.cpp +++ b/src/ParametersAPI/ParametersAPI_Parameter.cpp @@ -19,12 +19,14 @@ ParametersAPI_Parameter::ParametersAPI_Parameter( ParametersAPI_Parameter::ParametersAPI_Parameter( const std::shared_ptr & theFeature, const std::string & theName, - const ModelHighAPI_Double & theExpression) + const std::string & theExpression, + const std::string & theComment) : ModelHighAPI_Interface(theFeature) { if (initialize()) { fillAttribute(theName, name()); fillAttribute(theExpression, expression()); + fillAttribute(theComment, comment()); execute(); } @@ -37,9 +39,10 @@ ParametersAPI_Parameter::~ParametersAPI_Parameter() //-------------------------------------------------------------------------------------- ParameterPtr addParameter(const std::shared_ptr & theParameter, const std::string & theName, - const ModelHighAPI_Double & theExpression) + const std::string & theExpression, + const std::string & theComment) { // TODO(spo): check that theParameter is not empty std::shared_ptr aFeature = theParameter->addFeature(ParametersAPI_Parameter::ID()); - return ParameterPtr(new ParametersAPI_Parameter(aFeature)); + return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment)); } diff --git a/src/ParametersAPI/ParametersAPI_Parameter.h b/src/ParametersAPI/ParametersAPI_Parameter.h index 5a3023d9b..f3e92af18 100644 --- a/src/ParametersAPI/ParametersAPI_Parameter.h +++ b/src/ParametersAPI/ParametersAPI_Parameter.h @@ -31,14 +31,16 @@ public: PARAMETERSAPI_EXPORT explicit ParametersAPI_Parameter(const std::shared_ptr & theFeature, const std::string & theName, - const ModelHighAPI_Double & theExpression); + const std::string & theExpression, + const std::string & theComment = std::string()); /// Destructor PARAMETERSAPI_EXPORT virtual ~ParametersAPI_Parameter(); - INTERFACE_2(ParametersPlugin_Parameter::ID(), + INTERFACE_3(ParametersPlugin_Parameter::ID(), name, ParametersPlugin_Parameter::VARIABLE_ID(), ModelAPI_AttributeString, /** Name */, - expression, ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeDouble, /** Expression */ + expression, ParametersPlugin_Parameter::EXPRESSION_ID(), ModelAPI_AttributeString, /** Expression */, + comment, ParametersPlugin_Parameter::COMMENT_ID(), ModelAPI_AttributeString, /** Comment */ ) }; @@ -52,7 +54,8 @@ typedef std::shared_ptr ParameterPtr; PARAMETERSAPI_EXPORT ParameterPtr addParameter(const std::shared_ptr & thePart, const std::string & theName, - const ModelHighAPI_Double & theExpression); + const std::string & theExpression, + const std::string & theComment = std::string()); //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -- 2.39.2