]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/ModelHighAPI/ModelHighAPI_Dumper.h
Salome HOME
Issue #1648: Dump Python in the High Level Parameterized Geometry API
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Dumper.h
index 30cdce0883d38bcda70ec674527973e5d149690d..f7f0dcc3e5c192126f9aaee79dc6d29ca7e02c47 100644 (file)
@@ -22,10 +22,14 @@ class GeomDataAPI_Dir;
 class GeomDataAPI_Point;
 class GeomDataAPI_Point2D;
 
+class ModelAPI_Attribute;
 class ModelAPI_AttributeBoolean;
 class ModelAPI_AttributeDouble;
 class ModelAPI_AttributeInteger;
 class ModelAPI_AttributeRefAttr;
+class ModelAPI_AttributeRefAttrList;
+class ModelAPI_AttributeReference;
+class ModelAPI_AttributeRefList;
 class ModelAPI_AttributeSelection;
 class ModelAPI_AttributeSelectionList;
 class ModelAPI_AttributeString;
@@ -33,9 +37,13 @@ class ModelAPI_CompositeFeature;
 class ModelAPI_Document;
 class ModelAPI_Entity;
 class ModelAPI_Feature;
+class ModelAPI_Object;
+class ModelAPI_Result;
 
-typedef std::shared_ptr<ModelAPI_Entity>  EntityPtr;
-typedef std::shared_ptr<ModelAPI_Feature> FeaturePtr;
+typedef std::shared_ptr<ModelAPI_Document> DocumentPtr;
+typedef std::shared_ptr<ModelAPI_Entity>   EntityPtr;
+typedef std::shared_ptr<ModelAPI_Feature>  FeaturePtr;
+typedef std::shared_ptr<ModelAPI_Result> ResultPtr;
 
 /**\class ModelHighAPI_Dumper
  * \ingroup CPPHighAPI
@@ -99,6 +107,9 @@ public:
   /// Dump string
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const std::string& theString);
+  /// Dump boolean
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const bool theValue);
   /// Dump integer
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const int theValue);
@@ -147,17 +158,39 @@ public:
   ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeString>& theAttrStr);
   /// Dump name of entity and remember to dump "setName" if the entity has user-defined name
   MODELHIGHAPI_EXPORT
-  ModelHighAPI_Dumper& operator<<(const EntityPtr& theEntity);
+  ModelHighAPI_Dumper& operator<<(const FeaturePtr& theEntity);
+
+  /// Dump result
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const ResultPtr& theResult);
+
+  /// Dump Attribute
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Attribute>& theAttr);
+  /// Dump Object
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_Object>& theObject);
 
   /// Dump AttributeRefAttr
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttr>& theRefAttr);
+  /// Dump AttributeRefAttrList as follows:
+  /// "[obj1, obj2, obj3, ...]"
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefAttrList>& theRefAttrList);
+  /// Dump AttributeRefList as follows:
+  /// "[obj1, obj2, obj3, ...]"
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeRefList>& theRefList);
   /// Dump AttributeSelection
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelection>& theAttrSelect);
   /// Dump AttributeSelectionList
   MODELHIGHAPI_EXPORT
   ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeSelectionList>& theAttrSelList);
+  /// Dump AttributeReference
+  MODELHIGHAPI_EXPORT
+  ModelHighAPI_Dumper& operator<<(const std::shared_ptr<ModelAPI_AttributeReference>& theReference);
 
   /// Clear dump buffer
   MODELHIGHAPI_EXPORT
@@ -176,8 +209,14 @@ private:
   /// Iterate all features in document and dump them into intermediate buffer
   bool process(const std::shared_ptr<ModelAPI_Document>& theDoc);
 
+  /// Dump composite feature and all it sub-features
+  bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool isForce = false);
+
   /// Iterate all features in composite feature and dump them into intermediate buffer
-  bool process(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite);
+  /// \param theComposite   [in] parent composite feature
+  /// \param theDumpModelDo [in] shows that command "model.do()" should be written at the end
+  MODELHIGHAPI_EXPORT
+  bool processSubs(const std::shared_ptr<ModelAPI_CompositeFeature>& theComposite, bool theDumpModelDo = false);
 
   /// Check the entity is already dumped
   bool isDumped(const EntityPtr& theEntity) const;
@@ -185,6 +224,7 @@ private:
 private:
   typedef std::map<EntityPtr, std::pair<std::string, bool> > EntityNameMap;
   typedef std::map<std::string, std::set<std::string> >      ModulesMap;
+  typedef std::map<DocumentPtr, std::map<std::string, int> > NbFeaturesMap;
 
   static ModelHighAPI_Dumper* mySelf;
 
@@ -195,8 +235,12 @@ private:
   EntityNameMap       myNames;              ///< names of the entities
   EntityPtr           myLastEntityWithName; ///< not null, if last dumped entity had user defined name
 
+  NbFeaturesMap       myFeatureCount;       ///< number of features of each kind
+
 protected:
   std::set<EntityPtr> myNotDumpedEntities;  ///< list of entities, used by other features but not dumped yet
+
+  friend class SketchAPI_Sketch;
 };
 
 #endif