20 #ifndef ModelAPI_Data_H_
21 #define ModelAPI_Data_H_
24 #pragma warning( disable : 4503 )
58 enum ModelAPI_ExecState {
60 ModelAPI_StateMustBeUpdated,
61 ModelAPI_StateExecFailed,
62 ModelAPI_StateInvalidArgument,
77 virtual std::wstring
name() = 0;
79 virtual std::wstring
name(std::shared_ptr<GeomAPI_Shape> theSubShape) = 0;
81 virtual void setName(
const std::wstring& theName) = 0;
88 virtual void setVersion(
const std::string& theVersion) = 0;
91 virtual std::shared_ptr<ModelAPI_AttributeDocRef>
document(
const std::string& theID) = 0;
93 virtual std::shared_ptr<ModelAPI_AttributeDouble>
real(
const std::string& theID) = 0;
95 virtual std::shared_ptr<ModelAPI_AttributeDoubleArray>
realArray(
const std::string& theID) = 0;
97 virtual std::shared_ptr<ModelAPI_AttributeInteger>
integer(
const std::string& theID) = 0;
99 virtual std::shared_ptr<ModelAPI_AttributeReference>
reference(
const std::string& theID) = 0;
101 virtual std::shared_ptr<ModelAPI_AttributeSelection>
selection(
const std::string& theID) = 0;
103 virtual std::shared_ptr<ModelAPI_AttributeSelectionList>
106 virtual std::shared_ptr<ModelAPI_AttributeRefAttr>
refattr(
const std::string& theID) = 0;
108 virtual std::shared_ptr<ModelAPI_AttributeRefList>
reflist(
const std::string& theID) = 0;
111 virtual std::shared_ptr<ModelAPI_AttributeRefAttrList>
refattrlist(
const std::string& theID) = 0;
113 virtual std::shared_ptr<ModelAPI_AttributeBoolean>
boolean(
const std::string& theID) = 0;
115 virtual std::shared_ptr<ModelAPI_AttributeString>
string(
const std::string& theID) = 0;
117 virtual std::shared_ptr<ModelAPI_AttributeIntArray>
intArray(
const std::string& theID) = 0;
119 virtual std::shared_ptr<ModelAPI_AttributeStringArray>
stringArray(
const std::string& theID) = 0;
121 virtual std::shared_ptr<ModelAPI_AttributeImage>
image(
const std::string& theID) = 0;
123 virtual std::shared_ptr<ModelAPI_AttributeTables>
tables(
const std::string& theID) = 0;
127 virtual std::shared_ptr<ModelAPI_Attribute>
attribute(
const std::string& theID) = 0;
130 virtual std::list<std::shared_ptr<ModelAPI_Attribute> >
134 virtual std::list<std::string>
attributesIDs(
const std::string& theType) = 0;
137 virtual const std::string&
id(
const std::shared_ptr<ModelAPI_Attribute>& theAttr) = 0;
139 virtual bool isEqual(
const std::shared_ptr<ModelAPI_Data>& theData) = 0;
151 const std::string& theID,
const std::string theAttrType,
const int theIndex = -1) = 0;
157 virtual std::shared_ptr<ModelAPI_Attribute>
159 const std::string& theGroup) = 0;
162 virtual void allGroups(std::list<std::string>& theGroups) = 0;
166 std::list<std::shared_ptr<ModelAPI_Attribute> >& theAttrs) = 0;
179 const bool theBlock,
const bool theSendMessage =
true) = 0;
188 virtual void execState(
const ModelAPI_ExecState theState) = 0;
194 virtual void setError(
const std::string& theError,
bool theSend =
true) = 0;
197 virtual std::string
error()
const = 0;
203 virtual const std::set<std::shared_ptr<ModelAPI_Attribute> >&
refsToMe() = 0;
209 std::list<std::pair<std::string, std::list<std::shared_ptr<ModelAPI_Object> > > >& theRefs) =0;
212 virtual void copyTo(std::shared_ptr<ModelAPI_Data> theTarget) = 0;
225 virtual std::shared_ptr<ModelAPI_Object>
owner() = 0;
235 const std::string& theAttribute2)
const = 0;
259 typedef std::shared_ptr<ModelAPI_Data> DataPtr;
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Attribute that contains boolean value.
Definition: ModelAPI_AttributeBoolean.h:31
Attribute that contains reference to another document.
Definition: ModelAPI_AttributeDocRef.h:32
API for the attribute that contains several double in the array inside.
Definition: ModelAPI_AttributeDoubleArray.h:32
Attribute that contains real value with double precision.
Definition: ModelAPI_AttributeDouble.h:34
API for the attribute that contains binary data.
Definition: ModelAPI_AttributeImage.h:37
API for the attribute that contains several integers in the array inside.
Definition: ModelAPI_AttributeIntArray.h:36
API for the attribute that contains integer (int).
Definition: ModelAPI_AttributeInteger.h:34
Attribute that contains list of references to features (located in the same document) or references t...
Definition: ModelAPI_AttributeRefAttrList.h:34
Attribute that contains reference to an attribute of a feature or reference to a feature (switchable)
Definition: ModelAPI_AttributeRefAttr.h:33
Attribute that contains list of references to features (located in the same document).
Definition: ModelAPI_AttributeRefList.h:33
Attribute that contains reference to feature (located in the same document).
Definition: ModelAPI_AttributeReference.h:32
Attribute that contains list of references to the sub-shapes with possibility to manage them.
Definition: ModelAPI_AttributeSelectionList.h:37
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: ModelAPI_AttributeSelection.h:35
API for the attribute that contains several strings in the array inside.
Definition: ModelAPI_AttributeStringArray.h:32
API for the attribute that contains std (null terminated) string.
Definition: ModelAPI_AttributeString.h:33
API for the attribute that contains tables of some values type.
Definition: ModelAPI_AttributeTables.h:39
Generic attribute of the Object.
Definition: ModelAPI_Attribute.h:34
General object of the application that allows to get/set attributes from the document and compute res...
Definition: ModelAPI_Data.h:73
virtual void setError(const std::string &theError, bool theSend=true)=0
Registers error during the execution, causes the ExecutionFailed state.
virtual std::shared_ptr< ModelAPI_AttributeSelectionList > selectionList(const std::string &theID)=0
Returns the attribute that contains selection to a shape.
virtual bool isDisplayed()=0
Returns true if object must be displayed in the viewer: flag is stored in the data model,...
virtual std::shared_ptr< ModelAPI_Attribute > addAttribute(const std::string &theID, const std::string theAttrType, const int theIndex=-1)=0
Initializes object by the attributes: must be called just after the object is created for each attrib...
virtual int featureId() const =0
Returns the identifier of feature-owner, unique in this document.
virtual bool isInHistory()=0
Returns true if "is in history" custom behaviors is defined for the feature.
virtual std::list< std::string > attributesIDs(const std::string &theType)=0
Returns all attributes ids of the feature of the given type or all attributes if "theType" is empty.
virtual void sendAttributeUpdated(ModelAPI_Attribute *theAttr)=0
Useful method for "set" methods of the attributes: sends an UPDATE event and makes attribute initiali...
virtual void setName(const std::wstring &theName)=0
Defines the name of the feature visible by the user in the object browser.
virtual std::shared_ptr< ModelAPI_AttributeRefList > reflist(const std::string &theID)=0
Returns the attribute that contains list of references to features.
virtual std::string version()=0
Returns version of the feature (empty string if not applicable)
virtual int updateID()=0
Identifier of the transaction when object (feature or result) was updated last time.
virtual std::shared_ptr< ModelAPI_AttributeIntArray > intArray(const std::string &theID)=0
Returns the attribute that contains integer values array.
virtual bool isDeleted()=0
Returns true if the object is deleted, but some data is still kept in memory.
virtual std::shared_ptr< ModelAPI_Attribute > attribute(const std::string &theID)=0
Returns the generic attribute by identifier.
virtual bool isEqual(const std::shared_ptr< ModelAPI_Data > &theData)=0
Returns true if data belongs to same features.
virtual std::string error() const =0
Returns error, arose during the execution.
virtual void setVersion(const std::string &theVersion)=0
Initialize the version of the feature.
virtual std::shared_ptr< ModelAPI_AttributeRefAttr > refattr(const std::string &theID)=0
Returns the attribute that contains reference to an attribute of a feature.
virtual std::shared_ptr< ModelAPI_Attribute > addFloatingAttribute(const std::string &theID, const std::string theAttrType, const std::string &theGroup)=0
Adds a floating attribute (that may be added/removed during the data life)
virtual void removeAttributes(const std::string &theGroup)=0
Remove all attributes of the given group.
virtual bool isValid()=0
Returns true if it is correctly connected to the data model.
virtual std::shared_ptr< ModelAPI_AttributeReference > reference(const std::string &theID)=0
Returns the attribute that contains reference to a feature.
virtual std::wstring name(std::shared_ptr< GeomAPI_Shape > theSubShape)=0
Returns the name of the shape.
virtual std::shared_ptr< ModelAPI_AttributeString > string(const std::string &theID)=0
Returns the attribute that contains boolean value.
virtual bool isPrecedingAttribute(const std::string &theAttribute1, const std::string &theAttribute2) const =0
Returns true if theAttribute1 is going earlier than theAttribute2 in the data.
virtual void setUpdateID(const int theID)=0
Identifier of the transaction when object (feature or result) was updated last time.
virtual const std::string & id(const std::shared_ptr< ModelAPI_Attribute > &theAttr)=0
Identifier by the id (not fast, iteration by map)
virtual const std::set< std::shared_ptr< ModelAPI_Attribute > > & refsToMe()=0
returns all objects referenced to this
virtual std::wstring name()=0
Returns the name of the feature visible by the user in the object browser.
virtual std::shared_ptr< ModelAPI_AttributeInteger > integer(const std::string &theID)=0
Returns the attribute that contains integer value.
virtual std::shared_ptr< ModelAPI_AttributeDocRef > document(const std::string &theID)=0
Returns the attribute that references to another document.
virtual void copyTo(std::shared_ptr< ModelAPI_Data > theTarget)=0
Copies all attributes content into theTarget data.
virtual std::shared_ptr< ModelAPI_Data > invalidPtr()=0
Returns the invalid data pointer (to avoid working with NULL shared pointers in swig)
virtual bool blockSendAttributeUpdated(const bool theBlock, const bool theSendMessage=true)=0
Blocks sending "attribute updated" if theBlock is true.
virtual std::shared_ptr< ModelAPI_AttributeTables > tables(const std::string &theID)=0
Returns the attribute that contains tables.
virtual std::shared_ptr< ModelAPI_Object > owner()=0
Returns the owner of this data.
virtual void attributesOfGroup(const std::string &theGroup, std::list< std::shared_ptr< ModelAPI_Attribute > > &theAttrs)=0
Returns an ordered list of attributes that belong to the given group.
virtual std::shared_ptr< ModelAPI_AttributeStringArray > stringArray(const std::string &theID)=0
Returns the attribute that contains string values array.
virtual ModelAPI_ExecState execState()=0
Returns the state of the latest execution of the feature.
virtual void erase()=0
Erases all the data from the data model.
virtual std::shared_ptr< ModelAPI_AttributeBoolean > boolean(const std::string &theID)=0
Returns the attribute that contains boolean value.
virtual void execState(const ModelAPI_ExecState theState)=0
Stores the state of the object to execute it later accordingly.
virtual std::shared_ptr< ModelAPI_AttributeDouble > real(const std::string &theID)=0
Returns the attribute that contains real value with double precision.
virtual void setDisplayed(const bool theDisplay)=0
Sets the displayed/hidden state of the object.
virtual std::shared_ptr< ModelAPI_AttributeDoubleArray > realArray(const std::string &theID)=0
Returns the attribute that contains double values array.
virtual std::list< std::shared_ptr< ModelAPI_Attribute > > attributes(const std::string &theType)=0
Returns all attributes of the feature of the given type or all attributes if "theType" is empty.
virtual std::shared_ptr< ModelAPI_AttributeRefAttrList > refattrlist(const std::string &theID)=0
Returns the attribute that contains list of references to features or reference to an attribute of a ...
virtual void referencesToObjects(std::list< std::pair< std::string, std::list< std::shared_ptr< ModelAPI_Object > > > > &theRefs)=0
returns all references by attributes of this data
virtual void allGroups(std::list< std::string > &theGroups)=0
Returns all groups of this data (ordered).
virtual std::shared_ptr< ModelAPI_AttributeImage > image(const std::string &theID)=0
Returns the attribute that contains image.
virtual void setIsDeleted(const bool theFlag)=0
Sets true if the object is deleted, but some data is still kept in memory.
virtual void setIsInHistory(const bool theFlag)=0
Defines the custom "is in history" behavior.
virtual bool hasUserDefinedName() const =0
Return true if the object has been renamed by the user.
virtual std::shared_ptr< ModelAPI_AttributeSelection > selection(const std::string &theID)=0
Returns the attribute that contains selection to a shape.
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:53
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45