MODEL_EXPORT virtual ModelAPI_ExecState execState();
/// Registers error during the execution, causes the ExecutionFailed state
- MODEL_EXPORT virtual void setError(const std::string& theError);
+ MODEL_EXPORT virtual void setError(const std::string& theError, bool theSend = true);
+
+ /// Registers error during the execution, causes the ExecutionFailed state
+ MODEL_EXPORT virtual std::string error() const;
/// Returns the identifier of feature-owner, unique in this document
MODEL_EXPORT virtual int featureId() const;
MODEL_EXPORT virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget);
private:
- /// removes all information about back references
+ /// Removes all information about back references
void eraseBackReferences();
- // adds a back reference (with identifier which attribute references to this object
- void addBackReference(FeaturePtr theFeature, std::string theAttrID);
+ /// Adds a back reference (with identifier which attribute references to this object
+ /// It does not change the consealment flag of the data object result
+ /// \param theFeature feature referenced to this
+ /// \param theAttrID identifier of the attribute that is references from theFeature to this
+ void removeBackReference(FeaturePtr theFeature, std::string theAttrID);
+ /// Adds a back reference (with identifier which attribute references to this object
+ /// \param theFeature feature referenced to this
+ /// \param theAttrID identifier of the attribute that is references from theFeature to this
+ /// \param theApplyConcealment applies consealment flag changes
+ void addBackReference(FeaturePtr theFeature, std::string theAttrID,
+ const bool theApplyConcealment = true);
};
+/// Generic method to register back reference, used in referencing attributes.
+/// Without concealment change, it will be done later, on synchronization.
+#define ADD_BACK_REF(TARGET) \
+ if (TARGET.get() != NULL) { \
+ FeaturePtr anAttributeOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner()); \
+ if (anAttributeOwnerFeature.get()) { \
+ std::shared_ptr<Model_Data> aTargetData = std::dynamic_pointer_cast<Model_Data>( \
+ (TARGET)->data()); \
+ aTargetData->addBackReference(anAttributeOwnerFeature, id(), false); \
+ } \
+ }
+
+/// Generic method to unregister back reference, used in referencing attributes.
+/// Without concealment change, it will be done later, on synchronization.
+#define REMOVE_BACK_REF(TARGET) \
+ if (TARGET.get() != NULL) { \
+ FeaturePtr anAttOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner()); \
+ if (anAttOwnerFeature.get()) { \
+ std::shared_ptr<Model_Data> aTargetData = std::dynamic_pointer_cast<Model_Data>( \
+ (TARGET)->data()); \
+ aTargetData->removeBackReference(anAttOwnerFeature, id()); \
+ } \
+ }
+
#endif