list<AttributePtr>::iterator aRefsIter = aRefs.begin();
for (; aRefsIter != aRefs.end(); aRefsIter++) {
std::shared_ptr<ModelAPI_AttributeSelection> aSel =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
- bool isObligatory = !aFactory->isNotObligatory(
- theFeature->getKind(), theFeature->data()->id(aSel)) &&
- aFactory->isCase(theFeature, theFeature->data()->id(aSel));
- if (aSel->isInvalid()) {
- aState = ModelAPI_StateInvalidArgument;
- } else {
- ObjectPtr aContext = aSel->context();
- // update argument only if the referenced object is changed
- if (aContext.get() && !aContext->isDisabled() &&
- (myJustUpdated.find(aContext) != myJustUpdated.end() ||
- aContext->data()->updateID() > theFeature->data()->updateID())) {
- if (aState == ModelAPI_StateDone)
- aState = ModelAPI_StateMustBeUpdated;
- if (!aSel->update()) { // this must be done on execution since it may be long operation
- if (isObligatory)
- aState = ModelAPI_StateInvalidArgument;
- }
+ std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(*aRefsIter);
+ ObjectPtr aContext = aSel->context();
+ // update argument only if the referenced object is changed
+ if (aContext.get() && !aContext->isDisabled()) {
+ bool isObligatory = !aFactory->isNotObligatory(
+ theFeature->getKind(), theFeature->data()->id(aSel)) &&
+ aFactory->isCase(theFeature, theFeature->data()->id(aSel));
+ if (myJustUpdated.find(aContext) != myJustUpdated.end() ||
+ aContext->data()->updateID() > theFeature->data()->updateID()) {
+ if (aState == ModelAPI_StateDone)
+ aState = ModelAPI_StateMustBeUpdated;
+ if (!aSel->update()) { // this must be done on execution since it may be long operation
+ if (isObligatory)
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ } else if (aSel->isInvalid()) { // not needed to update, but invalid (stated previously)
+ aState = ModelAPI_StateInvalidArgument;
}
}
}
std::shared_ptr<ModelAPI_AttributeSelection> aSelAttr =
std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(aSel->value(a));
if (aSelAttr) {
- bool isObligatory = !aFactory->isNotObligatory(
- theFeature->getKind(), theFeature->data()->id(aSel)) &&
- aFactory->isCase(theFeature, theFeature->data()->id(aSel));
- if (aSelAttr->isInvalid()) {
- aState = ModelAPI_StateInvalidArgument;
- } else {
- ObjectPtr aContext = aSelAttr->context();
- // update argument onlt if the referenced object is changed
- if (aContext.get() && !aContext->isDisabled() &&
- (myJustUpdated.find(aContext) != myJustUpdated.end() ||
+ ObjectPtr aContext = aSelAttr->context();
+ // update argument onlt if the referenced object is changed
+ if (aContext.get() && !aContext->isDisabled()) {
+ bool isObligatory = !aFactory->isNotObligatory(
+ theFeature->getKind(), theFeature->data()->id(aSel)) &&
+ aFactory->isCase(theFeature, theFeature->data()->id(aSel));
+ if ((myJustUpdated.find(aContext) != myJustUpdated.end() ||
aContext->data()->updateID() > theFeature->data()->updateID())) {
- if (aState == ModelAPI_StateDone)
+ if (aState == ModelAPI_StateDone)
aState = ModelAPI_StateMustBeUpdated;
- if (!aSelAttr->update()) {
- if (isObligatory)
- aState = ModelAPI_StateInvalidArgument;
- }
+ if (!aSelAttr->update()) {
+ if (isObligatory)
+ aState = ModelAPI_StateInvalidArgument;
+ }
+ } else if (aSelAttr->isInvalid()) {
+ aState = ModelAPI_StateInvalidArgument;
}
}
}