##// END OF EJS Templates
Implements execute() method of desync operation...
Alexandre Leroux -
r1241:5f4e5de2ac36
parent child
Show More
@@ -75,3 +75,17 void FuzzingState::synchronizeVariable(VariableId variableId, SyncGroupId syncGr
75 75 }
76 76 }
77 77
78 void FuzzingState::desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId)
79 {
80 if (syncGroupId.isNull()) {
81 return;
82 }
83
84 // Unregisters variable from sync group: if there is no more variable in the group, resets the range
85 auto &syncGroup = m_SyncGroupsPool.at(syncGroupId);
86 syncGroup.m_Variables.erase(variableId);
87 if (syncGroup.m_Variables.empty()) {
88 syncGroup.m_Range = INVALID_RANGE;
89 }
90 }
91
@@ -105,6 +105,11 struct FuzzingState {
105 105 /// @param syncGroupId the synchronization group
106 106 void synchronizeVariable(VariableId variableId, SyncGroupId syncGroupId);
107 107
108 /// Updates fuzzing state according to a variable desynchronization
109 /// @param variableId the variable that is desynchronized
110 /// @param syncGroupId the synchronization group from which to remove the variable
111 void desynchronizeVariable(VariableId variableId, SyncGroupId syncGroupId);
112
108 113
109 114 VariablesPool m_VariablesPool;
110 115 SyncGroupsPool m_SyncGroupsPool;
@@ -67,6 +67,10 struct DeleteOperation : public IFuzzingOperation {
67 67 // Updates variable's state
68 68 variableState.m_Range = INVALID_RANGE;
69 69 variableState.m_Variable = nullptr;
70
71 // Desynchronizes the variable if it was in a sync group
72 auto syncGroupId = fuzzingState.syncGroupId(variableId);
73 fuzzingState.desynchronizeVariable(variableId, syncGroupId);
70 74 }
71 75 };
72 76
@@ -184,6 +188,21 struct DesynchronizeOperation : public IFuzzingOperation {
184 188 void execute(VariableId variableId, FuzzingState &fuzzingState,
185 189 VariableController &variableController, const Properties &) const override
186 190 {
191 auto &variableState = fuzzingState.variableState(variableId);
192
193 // Gets the sync group of the variable
194 auto syncGroupId = fuzzingState.syncGroupId(variableId);
195
196 qCInfo(LOG_FuzzingOperations()).noquote()
197 << "Removing" << variableState.m_Variable->name() << "from synchronization group"
198 << syncGroupId << "...";
199 variableController.onAddSynchronized(variableState.m_Variable, syncGroupId);
200
201 // Updates state
202 fuzzingState.desynchronizeVariable(variableId, syncGroupId);
203 }
204 };
205
187 206 struct UnknownOperation : public IFuzzingOperation {
188 207 bool canExecute(VariableId, const FuzzingState &) const override { return false; }
189 208
General Comments 0
You need to be logged in to leave comments. Login now