mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
Allow sorting StateChange callbacks
If the key of the callback is a number, it will be used to invoke callbacks with the correct ordering.
This commit is contained in:
parent
c3418cc7b8
commit
3c1723fc54
|
@ -310,7 +310,9 @@ try {
|
||||||
|
|
||||||
void StateMachine::SubscribeToStateChange(const string& key, function<void(const State)> callback)
|
void StateMachine::SubscribeToStateChange(const string& key, function<void(const State)> callback)
|
||||||
{
|
{
|
||||||
static_pointer_cast<FairMQFSM>(fFsm)->fStateChangeSignalsMap.insert({key, static_pointer_cast<FairMQFSM>(fFsm)->fStateChangeSignal.connect(callback)});
|
// Check if the key has a integer value as prefix, if yes, decode it.
|
||||||
|
int i = strtol(key.c_str(), nullptr, 10);
|
||||||
|
static_pointer_cast<FairMQFSM>(fFsm)->fStateChangeSignalsMap.insert({key, static_pointer_cast<FairMQFSM>(fFsm)->fStateChangeSignal.connect(i, callback)});
|
||||||
}
|
}
|
||||||
|
|
||||||
void StateMachine::UnsubscribeFromStateChange(const string& key)
|
void StateMachine::UnsubscribeFromStateChange(const string& key)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user