1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: Model_AttributeBoolean.cpp
4 // Created: 2 june 2014
5 // Author: Vitaly Smetannikov
7 #include "Model_AttributeBoolean.h"
8 #include <ModelAPI_Feature.h>
9 #include <ModelAPI_Data.h>
13 void Model_AttributeBoolean::setValue(bool theValue)
15 Standard_Boolean aValue = theValue ? Standard_True : Standard_False;
16 if (!myIsInitialized || myBool->Get() != aValue) {
18 owner()->data()->sendAttributeUpdated(this);
22 bool Model_AttributeBoolean::value()
24 return myBool->Get() == Standard_True ;
27 Model_AttributeBoolean::Model_AttributeBoolean(TDF_Label& theLabel)
29 // check the attribute could be already presented in this doc (after load document)
30 myIsInitialized = theLabel.FindAttribute(TDataStd_Integer::GetID(), myBool) == Standard_True;
31 if (!myIsInitialized) {
32 // create attribute: not initialized by value yet, just zero
33 myBool = TDataStd_Integer::Set(theLabel, 0);