MCPcopy Create free account
hub / github.com/SoarGroup/Soar / UnregisterForStringEvent

Method UnregisterForStringEvent

Core/ClientSML/src/sml_ClientKernel.cpp:2294–2317  ·  view source on GitHub ↗

* @brief Unregister for a particular event * @returns True if succeeds *************************************************************/

Source from the content-addressed store, hash-verified

2292* @returns True if succeeds
2293*************************************************************/
2294bool Kernel::UnregisterForStringEvent(int callbackID)
2295{
2296 // Build a test object for the callbackID we're interested in
2297 TestStringCallback test(callbackID) ;
2298
2299 // Find the event ID for this callbackID
2300 smlStringEventId id = m_StringEventMap.findFirstKeyByTest(&test, smlSTRING_EVENT_BAD) ;
2301
2302 if (id == smlSTRING_EVENT_BAD)
2303 {
2304 return false ;
2305 }
2306
2307 // Remove the handler from our map
2308 m_StringEventMap.removeAllByTest(&test) ;
2309
2310 // If we just removed the last handler, then unregister from the kernel for this event
2311 if (m_StringEventMap.getListSize(id) == 0)
2312 {
2313 UnregisterForEventWithKernel(id, NULL) ;
2314 }
2315
2316 return true ;
2317}
2318
2319/*************************************************************
2320* @brief Unregister for a particular event

Calls 3

findFirstKeyByTestMethod · 0.45
removeAllByTestMethod · 0.45
getListSizeMethod · 0.45

Tested by 1

TEST_DEFINITIONFunction · 0.64