Commit c188555 1 parent 0ce0d70 commit c188555 Copy full SHA for c188555
File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -216,6 +216,29 @@ namespace Core
216
216
}
217
217
218
218
219
+ /* *
220
+ * Removes an existing transition.
221
+ * This is a 'fancy' capability that should be used with caution.
222
+ *
223
+ * @param event The event that is to be removed from the transition table.
224
+ * @return the old state to which the removed event was transitioning
225
+ * or SentinelStateID indicating that there was no such transition.
226
+ */
227
+ virtual StateID RemoveTransition (
228
+ const Event & event
229
+ )
230
+ {
231
+ StateID old_state{ SentinelStateID };
232
+ auto dit = transition_table.find ( event );
233
+ if ( dit != transition_table.end () )
234
+ {
235
+ std::swap ( dit->second , old_state );
236
+ transition_table.erase ( dit );
237
+ }
238
+ return old_state;
239
+ }
240
+
241
+
219
242
/* *
220
243
* Retrieves the target state if a transition was installed for the
221
244
* provided event.
You can’t perform that action at this time.
0 commit comments