@@ -1016,11 +1016,6 @@ class ConstraintSystem {
10161016 // / \brief Whether to record failures or not.
10171017 bool recordFixes = false ;
10181018
1019- // / The list of constraints that have been retired along the
1020- // / current path, this list is used in LIFO fasion when constaints
1021- // / are added back to the circulation.
1022- ConstraintList retiredConstraints;
1023-
10241019 // / The current set of generated constraints.
10251020 SmallVector<Constraint *, 4 > generatedConstraints;
10261021
@@ -1051,6 +1046,28 @@ class ConstraintSystem {
10511046 generatedConstraints.size ()) });
10521047 }
10531048
1049+ // / \brief Check whether there are any retired constraints present.
1050+ bool hasRetiredConstraints () const {
1051+ return !retiredConstraints.empty ();
1052+ }
1053+
1054+ // / \brief Mark given constraint as retired along current solver path.
1055+ // /
1056+ // / \param constraint The constraint to retire temporarily.
1057+ void retireConstraint (Constraint *constraint) {
1058+ retiredConstraints.push_front (constraint);
1059+ }
1060+
1061+ // / \brief Iterate over all of the retired constraints registered with
1062+ // / current solver state.
1063+ // /
1064+ // / \param processor The processor function to be applied to each of
1065+ // / the constraints retrieved.
1066+ void forEachRetired (std::function<void (Constraint &)> processor) {
1067+ for (auto &constraint : retiredConstraints)
1068+ processor (constraint);
1069+ }
1070+
10541071 // / \brief Restore all of the retired/generated constraints to the state
10551072 // / before given scope. This is required because retired constraints have
10561073 // / to be re-introduced to the system in order of arrival (LIFO) and list
@@ -1088,6 +1105,11 @@ class ConstraintSystem {
10881105 }
10891106
10901107 private:
1108+ // / The list of constraints that have been retired along the
1109+ // / current path, this list is used in LIFO fasion when constaints
1110+ // / are added back to the circulation.
1111+ ConstraintList retiredConstraints;
1112+
10911113 // / The collection which holds association between solver scope
10921114 // / and position of the last retired constraint and number of
10931115 // / constraints generated before registration of given scope,
@@ -1564,7 +1586,7 @@ class ConstraintSystem {
15641586 // Record this as a newly-generated constraint.
15651587 if (solverState) {
15661588 solverState->generatedConstraints .push_back (constraint);
1567- solverState->retiredConstraints . push_front (constraint);
1589+ solverState->retireConstraint (constraint);
15681590 }
15691591 }
15701592
@@ -1588,7 +1610,7 @@ class ConstraintSystem {
15881610 InactiveConstraints.erase (constraint);
15891611
15901612 if (solverState)
1591- solverState->retiredConstraints . push_front (constraint);
1613+ solverState->retireConstraint (constraint);
15921614 }
15931615
15941616 // / Retrieve the list of inactive constraints.
0 commit comments