1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeInteger.cpp
4 // Created: 03 sep 2014
7 #include <Model_AttributeInteger.h>
9 #include <ModelAPI_Attribute.h>
10 #include <ModelAPI_Data.h>
11 #include <ModelAPI_Object.h>
13 #include <Standard_TypeDef.hxx>
14 #include <TDataStd_Integer.hxx>
16 void Model_AttributeInteger::setValue(const int theValue)
18 if (!myIsInitialized || myInteger->Get() != theValue) {
19 myInteger->Set(theValue);
20 owner()->data()->sendAttributeUpdated(this);
24 int Model_AttributeInteger::value()
26 return myInteger->Get();
29 Model_AttributeInteger::Model_AttributeInteger(TDF_Label& theLabel)
31 // check the attribute could be already presented in this doc (after load document)
32 myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), myInteger) == Standard_True;
33 if (!myIsInitialized) {
34 // create attribute: not initialized by value yet, just zero
35 myInteger = TDataStd_Integer::Set(theLabel, 0);