]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix ParametersAPI
authorspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:48:00 +0000 (14:48 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Fri, 17 Jun 2016 11:48:00 +0000 (14:48 +0300)
src/ModelHighAPI/ModelHighAPI.i
src/ParametersAPI/ParametersAPI_Parameter.cpp
src/ParametersAPI/ParametersAPI_Parameter.h

index 1a043be269f022dce87bb1e8b54626f227dc6c17..7ebba1a5760c23ca850c15e301e8f53cc0fdcd80 100644 (file)
   $result = SWIG_NewPointerObj( (void*) ptr, $1_descriptor, 1 );
 }
 
+// std::list -> []
+%template(SelectionList) std::list<ModelHighAPI_Selection>;
+%template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
+
 // all supported interfaces
 %include "ModelHighAPI_Double.h"
 %include "ModelHighAPI_Integer.h"
 %include "ModelHighAPI_Selection.h"
 %include "ModelHighAPI_Macro.h"
 %include "ModelHighAPI_Tools.h"
-
-%template(SelectionList) std::list<ModelHighAPI_Selection>;
-%template(RefAttrList) std::list<ModelHighAPI_RefAttr>;
index 8ea872d37778753f111860f755b713fd604348cd..fc89a23923fe6a4a987b5af00b6bf6d4e448b94c 100644 (file)
@@ -19,12 +19,14 @@ ParametersAPI_Parameter::ParametersAPI_Parameter(
 ParametersAPI_Parameter::ParametersAPI_Parameter(
     const std::shared_ptr<ModelAPI_Feature> & 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<ModelAPI_Document> & 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<ModelAPI_Feature> aFeature = theParameter->addFeature(ParametersAPI_Parameter::ID());
-  return ParameterPtr(new ParametersAPI_Parameter(aFeature));
+  return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
 }
index 5a3023d9b9e631469886b466c897600868ea09c7..f3e92af1840391f9ac98134791929f883573c344 100644 (file)
@@ -31,14 +31,16 @@ public:
   PARAMETERSAPI_EXPORT
   explicit ParametersAPI_Parameter(const  std::shared_ptr<ModelAPI_Feature> & 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<ParametersAPI_Parameter> ParameterPtr;
 PARAMETERSAPI_EXPORT
 ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
                           const std::string & theName,
-                          const ModelHighAPI_Double & theExpression);
+                          const std::string & theExpression,
+                          const std::string & theComment = std::string());
 
 //--------------------------------------------------------------------------------------
 //--------------------------------------------------------------------------------------