+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
// File: Model_Data.hxx
// Created: 21 Mar 2014
// Author: Mikhail PONIKAROV
#include <ModelAPI_AttributeReference.h>
#include <ModelAPI_AttributeRefList.h>
#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeIntArray.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Object.h>
/// List of attributes referenced to owner (updated only during the transaction change)
std::set<AttributePtr> myRefsToMe;
+ /// flag that may block the "attribute updated" sending
+ bool mySendAttributeUpdated;
Model_Data();
/// Returns the attribute that contains real value with double precision
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeString>
string(const std::string& theID);
+ /// Returns the attribute that contains integer values array
+ MODEL_EXPORT virtual std::shared_ptr<ModelAPI_AttributeIntArray>
+ intArray(const std::string& theID);
+
/// Returns the generic attribute by identifier
/// \param theID identifier of the attribute
MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID);
/// for each attribute of the object
/// \param theID identifier of the attribute that can be referenced by this ID later
/// \param theAttrType type of the created attribute (received from the type method)
- MODEL_EXPORT virtual void addAttribute(const std::string& theID, const std::string theAttrType);
+ /// \returns the just created attribute
+ MODEL_EXPORT virtual AttributePtr
+ addAttribute(const std::string& theID, const std::string theAttrType);
/// Useful method for "set" methods of the attributes: sends an UPDATE event and
/// makes attribute initialized
MODEL_EXPORT virtual void sendAttributeUpdated(ModelAPI_Attribute* theAttr);
+ /// Blocks sending "attribute updated" if theBlock is true
+ MODEL_EXPORT virtual void blockSendAttributeUpdated(const bool theBlock);
/// Puts feature to the document data sub-structure
MODEL_EXPORT void setLabel(TDF_Label theLab);
/// Returns the identifier of feature-owner, unique in this document
MODEL_EXPORT virtual int featureId() const;
- // returns all objects referenced to this
+ /// returns all objects referenced to this
MODEL_EXPORT virtual const std::set<AttributePtr>& refsToMe() {return myRefsToMe;}
+ /// returns all references by attributes of this data
+ /// \param theRefs returned list of pairs: id of referenced attribute and list of referenced objects
+ MODEL_EXPORT virtual void referencesToObjects(
+ std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
+
+ /// Copies all atributes content into theTarget data
+ 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);
- // returns all references by attributes of this data
- // \param the returned list of pairs: id of referenced attribute and list of referenced objects
- void referencesToObjects(std::list<std::pair<std::string, std::list<ObjectPtr> > >& theRefs);
+ /// 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);
};
#endif