MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / execute

Method execute

src/App/PropertyExpressionEngine.cpp:638–768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638DocumentObjectExecReturn* App::PropertyExpressionEngine::execute(ExecuteOption option,
639 bool* touched)
640{
641 DocumentObject* docObj = freecad_cast<DocumentObject*>(getContainer());
642
643 if (!docObj) {
644 throw Base::RuntimeError("PropertyExpressionEngine must be owned by a DocumentObject.");
645 }
646
647 if (running) {
648 return DocumentObject::StdReturn;
649 }
650
651 if (option == ExecuteOnRestore) {
652 bool found = false;
653 for (auto& e : expressions) {
654 auto prop = e.first.getProperty();
655 if (!prop) {
656 continue;
657 }
658 if (prop->testStatus(App::Property::Transient)
659 || (prop->getType() & App::Prop_Transient)
660 || prop->testStatus(App::Property::EvalOnRestore)) {
661 found = true;
662 break;
663 }
664 }
665 if (!found) {
666 return DocumentObject::StdReturn;
667 }
668 }
669
670 /* Resetter class, to ensure that the "running" variable gets set to false, even if
671 * an exception is thrown.
672 */
673
674 class resetter
675 {
676 public:
677 explicit resetter(bool& b)
678 : _b(b)
679 {
680 _b = true;
681 }
682 ~resetter()
683 {
684 _b = false;
685 }
686
687 private:
688 bool& _b;
689 };
690
691 resetter r(running);
692
693 // Compute evaluation order
694 std::vector<App::ObjectIdentifier> evaluationOrder = computeEvaluationOrder(option);
695 std::vector<ObjectIdentifier>::const_iterator it = evaluationOrder.begin();

Callers

nothing calls this directly

Calls 15

getContainerFunction · 0.85
isAnyEqualFunction · 0.85
getValueAsAnyMethod · 0.80
getNameFunction · 0.70
getPropertyMethod · 0.45
testStatusMethod · 0.45
getTypeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
getContainerMethod · 0.45
getPathValueMethod · 0.45
setPathValueMethod · 0.45

Tested by

no test coverage detected