com.wallstop-studios.dxmessaging 2.0.0-rc14 → 2.0.0-rc15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -11
- package/Runtime/Core/InstanceId.cs +7 -6
- package/Runtime/Core/MessageBus/IMessageBus.cs +36 -30
- package/Runtime/Core/MessageBus/MessageBus.cs +8 -2
- package/Runtime/Core/MessageHandler.cs +169 -155
- package/Runtime/Core/MessagingDebug.cs +2 -2
- package/Tests/Runtime/Benchmarks/PerformanceTests.cs +129 -78
- package/Tests/Runtime/Core/MessagingTestBase.cs +24 -9
- package/package.json +1 -1
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
/// Maps Types to the corresponding Handler of that type.
|
|
34
34
|
/// </summary>
|
|
35
35
|
/// <note>
|
|
36
|
-
/// Ideally, this would be something like a Dictionary[T,Handler[T]], but that can't be done with C#s type system.
|
|
36
|
+
/// Ideally, this would be something like a Dictionary[T, Handler[T]], but that can't be done with C#s type system.
|
|
37
37
|
/// </note>
|
|
38
38
|
private readonly Dictionary<
|
|
39
39
|
IMessageBus,
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
/// Callback from the MessageBus for handling UntargetedMessages - user code should generally never use this.
|
|
61
61
|
/// </summary>
|
|
62
62
|
/// <note>
|
|
63
|
-
/// In this case, "UntargetedMessage" refers to Targeted without targeting, and UntargetedMessages, hence T :
|
|
63
|
+
/// In this case, "UntargetedMessage" refers to Targeted without targeting, and UntargetedMessages, hence T : IMessage.
|
|
64
64
|
/// </note>
|
|
65
65
|
/// <param name="message">Message to handle.</param>
|
|
66
66
|
/// <param name="messageBus">The specific MessageBus to use.</param>
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
/// Callback from the MessageBus for handling UntargetedMessages - user code should generally never use this.
|
|
94
94
|
/// </summary>
|
|
95
95
|
/// <note>
|
|
96
|
-
/// In this case, "UntargetedMessage" refers to Targeted without targeting, and UntargetedMessages, hence T :
|
|
96
|
+
/// In this case, "UntargetedMessage" refers to Targeted without targeting, and UntargetedMessages, hence T : IUntargetedMessage.
|
|
97
97
|
/// </note>
|
|
98
98
|
/// <param name="message">Message to handle.</param>
|
|
99
99
|
/// <param name="messageBus">The specific MessageBus to use.</param>
|
|
@@ -193,7 +193,7 @@
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
/// <summary>
|
|
196
|
-
/// Callback from the MessageBus for post
|
|
196
|
+
/// Callback from the MessageBus for post-processing TargetedMessages when this MessageHandler has subscribed - user code should generally never use this.
|
|
197
197
|
/// </summary>
|
|
198
198
|
/// <note>
|
|
199
199
|
/// TargetedMessage refers to those that are intended for the GameObject that owns this MessageHandler.
|
|
@@ -228,7 +228,7 @@
|
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
/// <summary>
|
|
231
|
-
/// Callback from the MessageBus for post
|
|
231
|
+
/// Callback from the MessageBus for post-processing TargetedMessages when this MessageHandler has subscribed - user code should generally never use this.
|
|
232
232
|
/// </summary>
|
|
233
233
|
/// <note>
|
|
234
234
|
/// TargetedMessage refers to those that are intended for the GameObject that owns this MessageHandler.
|
|
@@ -425,7 +425,7 @@
|
|
|
425
425
|
return;
|
|
426
426
|
}
|
|
427
427
|
|
|
428
|
-
// Use the "IMessage" explicitly to indicate global messages, allowing us to
|
|
428
|
+
// Use the "IMessage" explicitly to indicate global messages, allowing us to multipurpose a single dictionary
|
|
429
429
|
if (GetHandlerForType(typeof(IMessage), messageBus, out TypedHandler<IMessage> handler))
|
|
430
430
|
{
|
|
431
431
|
handler.HandleGlobalUntargeted(ref message);
|
|
@@ -449,7 +449,7 @@
|
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
451
|
|
|
452
|
-
// Use the "IMessage" explicitly to indicate global messages, allowing us to
|
|
452
|
+
// Use the "IMessage" explicitly to indicate global messages, allowing us to multipurpose a single dictionary
|
|
453
453
|
if (GetHandlerForType(typeof(IMessage), messageBus, out TypedHandler<IMessage> handler))
|
|
454
454
|
{
|
|
455
455
|
handler.HandleGlobalTargeted(ref target, ref message);
|
|
@@ -473,7 +473,7 @@
|
|
|
473
473
|
return;
|
|
474
474
|
}
|
|
475
475
|
|
|
476
|
-
// Use the "IMessage" explicitly to indicate global messages, allowing us to
|
|
476
|
+
// Use the "IMessage" explicitly to indicate global messages, allowing us to multipurpose a single dictionary
|
|
477
477
|
if (GetHandlerForType(typeof(IMessage), messageBus, out TypedHandler<IMessage> handler))
|
|
478
478
|
{
|
|
479
479
|
handler.HandleGlobalBroadcast(ref source, ref message);
|
|
@@ -481,7 +481,7 @@
|
|
|
481
481
|
}
|
|
482
482
|
|
|
483
483
|
/// <summary>
|
|
484
|
-
/// Registers this MessageHandler to Globally Accept All Messages via the MessageBus, properly handling
|
|
484
|
+
/// Registers this MessageHandler to Globally Accept All Messages via the MessageBus, properly handling deregistration.
|
|
485
485
|
/// </summary>
|
|
486
486
|
/// <param name="untargetedMessageHandler">MessageHandler to accept all UntargetedMessages.</param>
|
|
487
487
|
/// <param name="broadcastMessageHandler">MessageHandler to accept all TargetedMessages for all entities.</param>
|
|
@@ -527,7 +527,7 @@
|
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
/// <summary>
|
|
530
|
-
/// Registers this MessageHandler to Globally Accept All Messages via the MessageBus, properly handling
|
|
530
|
+
/// Registers this MessageHandler to Globally Accept All Messages via the MessageBus, properly handling deregistration.
|
|
531
531
|
/// </summary>
|
|
532
532
|
/// <param name="untargetedMessageHandler">MessageHandler to accept all UntargetedMessages.</param>
|
|
533
533
|
/// <param name="broadcastMessageHandler">MessageHandler to accept all TargetedMessages for all entities.</param>
|
|
@@ -573,7 +573,7 @@
|
|
|
573
573
|
}
|
|
574
574
|
|
|
575
575
|
/// <summary>
|
|
576
|
-
/// Registers this MessageHandler to accept TargetedMessages via the MessageBus, properly handling
|
|
576
|
+
/// Registers this MessageHandler to accept TargetedMessages via the MessageBus, properly handling deregistration.
|
|
577
577
|
/// </summary>
|
|
578
578
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
579
579
|
/// <param name="target">Target Id of TargetedMessages to listen for.</param>
|
|
@@ -605,7 +605,7 @@
|
|
|
605
605
|
}
|
|
606
606
|
|
|
607
607
|
/// <summary>
|
|
608
|
-
/// Registers this MessageHandler to accept fast TargetedMessages via the MessageBus, properly handling
|
|
608
|
+
/// Registers this MessageHandler to accept fast TargetedMessages via the MessageBus, properly handling deregistration.
|
|
609
609
|
/// </summary>
|
|
610
610
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
611
611
|
/// <param name="target">Target Id of TargetedMessages to listen for.</param>
|
|
@@ -637,7 +637,7 @@
|
|
|
637
637
|
}
|
|
638
638
|
|
|
639
639
|
/// <summary>
|
|
640
|
-
/// Registers this MessageHandler to post process TargetedMessages via the MessageBus, properly handling
|
|
640
|
+
/// Registers this MessageHandler to post process TargetedMessages via the MessageBus, properly handling deregistration.
|
|
641
641
|
/// </summary>
|
|
642
642
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
643
643
|
/// <param name="target">Target Id of TargetedMessages to listen for.</param>
|
|
@@ -669,7 +669,7 @@
|
|
|
669
669
|
}
|
|
670
670
|
|
|
671
671
|
/// <summary>
|
|
672
|
-
/// Registers this MessageHandler to post process fast TargetedMessages via the MessageBus, properly handling
|
|
672
|
+
/// Registers this MessageHandler to post process fast TargetedMessages via the MessageBus, properly handling deregistration.
|
|
673
673
|
/// </summary>
|
|
674
674
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
675
675
|
/// <param name="target">Target Id of TargetedMessages to listen for.</param>
|
|
@@ -701,7 +701,7 @@
|
|
|
701
701
|
}
|
|
702
702
|
|
|
703
703
|
/// <summary>
|
|
704
|
-
/// Registers this MessageHandler to post
|
|
704
|
+
/// Registers this MessageHandler to post-process TargetedMessages for all messages of the provided type via the MessageBus, properly handling deregistration.
|
|
705
705
|
/// </summary>
|
|
706
706
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
707
707
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -730,7 +730,7 @@
|
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
/// <summary>
|
|
733
|
-
/// Registers this MessageHandler to post process fast TargetedMessages for all messages of the provided type via the MessageBus, properly handling
|
|
733
|
+
/// Registers this MessageHandler to post process fast TargetedMessages for all messages of the provided type via the MessageBus, properly handling deregistration.
|
|
734
734
|
/// </summary>
|
|
735
735
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
736
736
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -759,7 +759,7 @@
|
|
|
759
759
|
}
|
|
760
760
|
|
|
761
761
|
/// <summary>
|
|
762
|
-
/// Registers this MessageHandler to accept TargetedMessages without Targeting via the MessageBus, properly handling
|
|
762
|
+
/// Registers this MessageHandler to accept TargetedMessages without Targeting via the MessageBus, properly handling deregistration.
|
|
763
763
|
/// </summary>
|
|
764
764
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
765
765
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -787,7 +787,7 @@
|
|
|
787
787
|
}
|
|
788
788
|
|
|
789
789
|
/// <summary>
|
|
790
|
-
/// Registers this MessageHandler to accept fast TargetedMessages without Targeting via the MessageBus, properly handling
|
|
790
|
+
/// Registers this MessageHandler to accept fast TargetedMessages without Targeting via the MessageBus, properly handling deregistration.
|
|
791
791
|
/// </summary>
|
|
792
792
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
793
793
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -815,7 +815,7 @@
|
|
|
815
815
|
}
|
|
816
816
|
|
|
817
817
|
/// <summary>
|
|
818
|
-
/// Registers this MessageHandler to accept UntargetedMessages via the MessageBus, properly handling
|
|
818
|
+
/// Registers this MessageHandler to accept UntargetedMessages via the MessageBus, properly handling deregistration.
|
|
819
819
|
/// </summary>
|
|
820
820
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
821
821
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -843,7 +843,7 @@
|
|
|
843
843
|
}
|
|
844
844
|
|
|
845
845
|
/// <summary>
|
|
846
|
-
/// Registers this MessageHandler to accept fast UntargetedMessages via the MessageBus, properly handling
|
|
846
|
+
/// Registers this MessageHandler to accept fast UntargetedMessages via the MessageBus, properly handling deregistration.
|
|
847
847
|
/// </summary>
|
|
848
848
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
849
849
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -871,7 +871,7 @@
|
|
|
871
871
|
}
|
|
872
872
|
|
|
873
873
|
/// <summary>
|
|
874
|
-
/// Registers this MessageHandler to post
|
|
874
|
+
/// Registers this MessageHandler to post-process UntargetedMessages via the MessageBus, properly handling deregistration.
|
|
875
875
|
/// </summary>
|
|
876
876
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
877
877
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -899,7 +899,7 @@
|
|
|
899
899
|
}
|
|
900
900
|
|
|
901
901
|
/// <summary>
|
|
902
|
-
/// Registers this MessageHandler to post process fast UntargetedMessages via the MessageBus, properly handling
|
|
902
|
+
/// Registers this MessageHandler to post process fast UntargetedMessages via the MessageBus, properly handling deregistration.
|
|
903
903
|
/// </summary>
|
|
904
904
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
905
905
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -927,7 +927,7 @@
|
|
|
927
927
|
}
|
|
928
928
|
|
|
929
929
|
/// <summary>
|
|
930
|
-
/// Registers this MessageHandler to accept BroadcastMessages via their MessageBus, properly handling
|
|
930
|
+
/// Registers this MessageHandler to accept BroadcastMessages via their MessageBus, properly handling deregistration.
|
|
931
931
|
/// </summary>
|
|
932
932
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
933
933
|
/// <param name="source">Source Id of BroadcastMessages to listen for.</param>
|
|
@@ -950,7 +950,7 @@
|
|
|
950
950
|
priority: priority
|
|
951
951
|
);
|
|
952
952
|
TypedHandler<T> typedHandler = GetOrCreateHandlerForType<T>(messageBus);
|
|
953
|
-
|
|
953
|
+
|
|
954
954
|
return typedHandler.AddSourcedBroadcastHandler(
|
|
955
955
|
source,
|
|
956
956
|
messageHandler,
|
|
@@ -960,7 +960,7 @@
|
|
|
960
960
|
}
|
|
961
961
|
|
|
962
962
|
/// <summary>
|
|
963
|
-
/// Registers this MessageHandler to accept fast BroadcastMessages via their MessageBus, properly handling
|
|
963
|
+
/// Registers this MessageHandler to accept fast BroadcastMessages via their MessageBus, properly handling deregistration.
|
|
964
964
|
/// </summary>
|
|
965
965
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
966
966
|
/// <param name="source">Source Id of BroadcastMessages to listen for.</param>
|
|
@@ -992,7 +992,7 @@
|
|
|
992
992
|
}
|
|
993
993
|
|
|
994
994
|
/// <summary>
|
|
995
|
-
/// Registers this MessageHandler to accept BroadcastMessage regardless of source via their MessageBus, properly handling
|
|
995
|
+
/// Registers this MessageHandler to accept BroadcastMessage regardless of source via their MessageBus, properly handling deregistration.
|
|
996
996
|
/// </summary>
|
|
997
997
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
998
998
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -1020,7 +1020,7 @@
|
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
1022
|
/// <summary>
|
|
1023
|
-
/// Registers this MessageHandler to accept fast BroadcastMessage regardless of source via their MessageBus, properly handling
|
|
1023
|
+
/// Registers this MessageHandler to accept fast BroadcastMessage regardless of source via their MessageBus, properly handling deregistration.
|
|
1024
1024
|
/// </summary>
|
|
1025
1025
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
1026
1026
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -1048,7 +1048,7 @@
|
|
|
1048
1048
|
}
|
|
1049
1049
|
|
|
1050
1050
|
/// <summary>
|
|
1051
|
-
/// Registers this MessageHandler to post
|
|
1051
|
+
/// Registers this MessageHandler to post-processes BroadcastMessage messages.
|
|
1052
1052
|
/// </summary>
|
|
1053
1053
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
1054
1054
|
/// <param name="source">Source object to listen for BroadcastMessages on.</param>
|
|
@@ -1112,7 +1112,7 @@
|
|
|
1112
1112
|
}
|
|
1113
1113
|
|
|
1114
1114
|
/// <summary>
|
|
1115
|
-
/// Registers this MessageHandler to post
|
|
1115
|
+
/// Registers this MessageHandler to post-processes BroadcastMessage messages for all messages of the provided type.
|
|
1116
1116
|
/// </summary>
|
|
1117
1117
|
/// <typeparam name="T">Type of Message to be handled.</typeparam>
|
|
1118
1118
|
/// <param name="messageHandler">Function that actually handles the message.</param>
|
|
@@ -1174,7 +1174,7 @@
|
|
|
1174
1174
|
/// </summary>
|
|
1175
1175
|
/// <typeparam name="T">Type of the UntargetedMessage to intercept.</typeparam>
|
|
1176
1176
|
/// <param name="interceptor">Interceptor to register.</param>
|
|
1177
|
-
/// <param name="priority">Priority to register the interceptor at (interceptors are
|
|
1177
|
+
/// <param name="priority">Priority to register the interceptor at (interceptors are run from low -> high priority)</param>
|
|
1178
1178
|
/// <param name="messageBus">Message bus to register the interceptor on.</param>
|
|
1179
1179
|
/// <returns>The de-registration action.</returns>
|
|
1180
1180
|
public Action RegisterUntargetedInterceptor<T>(
|
|
@@ -1192,7 +1192,7 @@
|
|
|
1192
1192
|
/// </summary>
|
|
1193
1193
|
/// <typeparam name="T">Type of the BroadcastMessage to intercept.</typeparam>
|
|
1194
1194
|
/// <param name="interceptor">Interceptor to register.</param>
|
|
1195
|
-
/// <param name="priority">Priority to register the interceptor at (interceptors are
|
|
1195
|
+
/// <param name="priority">Priority to register the interceptor at (interceptors are run from low -> high priority)</param>
|
|
1196
1196
|
/// <param name="messageBus">Message bus to register the interceptor on.</param>
|
|
1197
1197
|
/// <returns>The de-registration action.</returns>
|
|
1198
1198
|
public Action RegisterBroadcastInterceptor<T>(
|
|
@@ -1210,7 +1210,7 @@
|
|
|
1210
1210
|
/// </summary>
|
|
1211
1211
|
/// <typeparam name="T">Type of the TargetedMessage to intercept.</typeparam>
|
|
1212
1212
|
/// <param name="interceptor">Interceptor to register.</param>
|
|
1213
|
-
/// <param name="priority">Priority to register the interceptor at (interceptors are
|
|
1213
|
+
/// <param name="priority">Priority to register the interceptor at (interceptors are run from low -> high priority)</param>
|
|
1214
1214
|
/// <param name="messageBus">Message bus to register the interceptor on.</param>
|
|
1215
1215
|
/// <returns>The de-registration action.</returns>
|
|
1216
1216
|
public Action RegisterTargetedInterceptor<T>(
|
|
@@ -1280,7 +1280,7 @@
|
|
|
1280
1280
|
}
|
|
1281
1281
|
|
|
1282
1282
|
/// <summary>
|
|
1283
|
-
/// Retrieves an existing Handler for the specific type
|
|
1283
|
+
/// Retrieves an existing Handler for the specific type if it exists, or creates a new Handler if none exist.
|
|
1284
1284
|
/// </summary>
|
|
1285
1285
|
/// <typeparam name="T">Type of Message to retrieve a Handler for.</typeparam>
|
|
1286
1286
|
/// <returns>Non-Null Handler for the specific type.</returns>
|
|
@@ -1311,12 +1311,12 @@
|
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
1313
1313
|
/// <summary>
|
|
1314
|
-
/// Gets an existing Handler for the specific type
|
|
1314
|
+
/// Gets an existing Handler for the specific type if it exists.
|
|
1315
1315
|
/// </summary>
|
|
1316
1316
|
/// <param name="type">Message type to get the handler for.</param>
|
|
1317
1317
|
/// <param name="messageBus">The specific MessageBus to use.</param>
|
|
1318
1318
|
/// <param name="existingTypedHandler">Existing typed message handler, if one exists.</param>
|
|
1319
|
-
/// <returns>Existing handler for the specific type, or null if none exists
|
|
1319
|
+
/// <returns>Existing handler for the specific type, or null if none exists.</returns>
|
|
1320
1320
|
private bool GetHandlerForType<T>(
|
|
1321
1321
|
Type type,
|
|
1322
1322
|
IMessageBus messageBus,
|
|
@@ -1526,7 +1526,7 @@
|
|
|
1526
1526
|
}
|
|
1527
1527
|
|
|
1528
1528
|
/// <summary>
|
|
1529
|
-
/// Emits the BroadcastMessage without source to all subscribed listeners.
|
|
1529
|
+
/// Emits the BroadcastMessage without a source to all subscribed listeners.
|
|
1530
1530
|
/// </summary>
|
|
1531
1531
|
/// <param name="source">Source the message is from.</param>
|
|
1532
1532
|
/// <param name="message">Message to emit.</param>
|
|
@@ -1790,13 +1790,13 @@
|
|
|
1790
1790
|
}
|
|
1791
1791
|
|
|
1792
1792
|
/// <summary>
|
|
1793
|
-
/// Adds a TargetedHandler to listen to Messages of the given type, returning a
|
|
1793
|
+
/// Adds a TargetedHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1794
1794
|
/// </summary>
|
|
1795
1795
|
/// <param name="target">Target the handler is for.</param>
|
|
1796
1796
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1797
1797
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1798
1798
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1799
|
-
/// <returns>De-registration action to
|
|
1799
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1800
1800
|
public Action AddTargetedHandler(
|
|
1801
1801
|
InstanceId target,
|
|
1802
1802
|
Action<T> handler,
|
|
@@ -1808,13 +1808,13 @@
|
|
|
1808
1808
|
}
|
|
1809
1809
|
|
|
1810
1810
|
/// <summary>
|
|
1811
|
-
/// Adds a fast TargetedHandler to listen to Messages of the given type, returning a
|
|
1811
|
+
/// Adds a fast TargetedHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1812
1812
|
/// </summary>
|
|
1813
1813
|
/// <param name="target">Target the handler is for.</param>
|
|
1814
1814
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1815
1815
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1816
1816
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1817
|
-
/// <returns>De-registration action to
|
|
1817
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1818
1818
|
public Action AddTargetedHandler(
|
|
1819
1819
|
InstanceId target,
|
|
1820
1820
|
FastHandler<T> handler,
|
|
@@ -1832,12 +1832,12 @@
|
|
|
1832
1832
|
}
|
|
1833
1833
|
|
|
1834
1834
|
/// <summary>
|
|
1835
|
-
/// Adds a TargetedWithoutTargetingHandler to listen to Messages of the given type, returning a
|
|
1835
|
+
/// Adds a TargetedWithoutTargetingHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1836
1836
|
/// </summary>
|
|
1837
1837
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1838
1838
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1839
1839
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1840
|
-
/// <returns>De-registration action to
|
|
1840
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1841
1841
|
public Action AddTargetedWithoutTargetingHandler(
|
|
1842
1842
|
Action<InstanceId, T> handler,
|
|
1843
1843
|
Action deregistration,
|
|
@@ -1853,12 +1853,12 @@
|
|
|
1853
1853
|
}
|
|
1854
1854
|
|
|
1855
1855
|
/// <summary>
|
|
1856
|
-
/// Adds a fast TargetedWithoutTargetingHandler to listen to Messages of the given type, returning a
|
|
1856
|
+
/// Adds a fast TargetedWithoutTargetingHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1857
1857
|
/// </summary>
|
|
1858
1858
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1859
1859
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1860
1860
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1861
|
-
/// <returns>De-registration action to
|
|
1861
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1862
1862
|
public Action AddTargetedWithoutTargetingHandler(
|
|
1863
1863
|
FastHandlerWithContext<T> handler,
|
|
1864
1864
|
Action deregistration,
|
|
@@ -1874,12 +1874,12 @@
|
|
|
1874
1874
|
}
|
|
1875
1875
|
|
|
1876
1876
|
/// <summary>
|
|
1877
|
-
/// Adds a UntargetedHandler to listen to Messages of the given type, returning a
|
|
1877
|
+
/// Adds a UntargetedHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1878
1878
|
/// </summary>
|
|
1879
1879
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1880
1880
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1881
1881
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1882
|
-
/// <returns>De-registration action to
|
|
1882
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1883
1883
|
public Action AddUntargetedHandler(
|
|
1884
1884
|
Action<T> handler,
|
|
1885
1885
|
Action deregistration,
|
|
@@ -1890,12 +1890,12 @@
|
|
|
1890
1890
|
}
|
|
1891
1891
|
|
|
1892
1892
|
/// <summary>
|
|
1893
|
-
/// Adds a fast UntargetedHandler to listen to Messages of the given type, returning a
|
|
1893
|
+
/// Adds a fast UntargetedHandler to listen to Messages of the given type, returning a deregistration action.
|
|
1894
1894
|
/// </summary>
|
|
1895
1895
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1896
1896
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1897
1897
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1898
|
-
/// <returns>De-registration action to
|
|
1898
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1899
1899
|
public Action AddUntargetedHandler(
|
|
1900
1900
|
FastHandler<T> handler,
|
|
1901
1901
|
Action deregistration,
|
|
@@ -1906,13 +1906,13 @@
|
|
|
1906
1906
|
}
|
|
1907
1907
|
|
|
1908
1908
|
/// <summary>
|
|
1909
|
-
/// Adds a SourcedBroadcastHandler to listen to Messages of the given type from an entity, returning a
|
|
1909
|
+
/// Adds a SourcedBroadcastHandler to listen to Messages of the given type from an entity, returning a deregistration action.
|
|
1910
1910
|
/// </summary>
|
|
1911
|
-
/// <param name="source">Source of the handler is for.</param>
|
|
1911
|
+
/// <param name="source">The Source of the handler is for.</param>
|
|
1912
1912
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1913
1913
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1914
1914
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1915
|
-
/// <returns>De-registration action to
|
|
1915
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1916
1916
|
public Action AddSourcedBroadcastHandler(
|
|
1917
1917
|
InstanceId source,
|
|
1918
1918
|
Action<T> handler,
|
|
@@ -1930,13 +1930,13 @@
|
|
|
1930
1930
|
}
|
|
1931
1931
|
|
|
1932
1932
|
/// <summary>
|
|
1933
|
-
/// Adds a fast SourcedBroadcastHandler to listen to Messages of the given type from an entity, returning a
|
|
1933
|
+
/// Adds a fast SourcedBroadcastHandler to listen to Messages of the given type from an entity, returning a deregistration action.
|
|
1934
1934
|
/// </summary>
|
|
1935
|
-
/// <param name="source">Source of the handler is for.</param>
|
|
1935
|
+
/// <param name="source">The Source of the handler is for.</param>
|
|
1936
1936
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1937
1937
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1938
1938
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1939
|
-
/// <returns>De-registration action to
|
|
1939
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1940
1940
|
public Action AddSourcedBroadcastHandler(
|
|
1941
1941
|
InstanceId source,
|
|
1942
1942
|
FastHandler<T> handler,
|
|
@@ -1954,12 +1954,12 @@
|
|
|
1954
1954
|
}
|
|
1955
1955
|
|
|
1956
1956
|
/// <summary>
|
|
1957
|
-
/// Adds a SourcedBroadcastWithoutSourceHandler to listen to Messages of the given type from an entity, returning a
|
|
1957
|
+
/// Adds a SourcedBroadcastWithoutSourceHandler to listen to Messages of the given type from an entity, returning a deregistration action.
|
|
1958
1958
|
/// </summary>
|
|
1959
1959
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1960
1960
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1961
1961
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1962
|
-
/// <returns>De-registration action to
|
|
1962
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1963
1963
|
public Action AddSourcedBroadcastWithoutSourceHandler(
|
|
1964
1964
|
Action<InstanceId, T> handler,
|
|
1965
1965
|
Action deregistration,
|
|
@@ -1975,12 +1975,12 @@
|
|
|
1975
1975
|
}
|
|
1976
1976
|
|
|
1977
1977
|
/// <summary>
|
|
1978
|
-
/// Adds a fast SourcedBroadcastWithoutSourceHandler to listen to Messages of the given type from an entity, returning a
|
|
1978
|
+
/// Adds a fast SourcedBroadcastWithoutSourceHandler to listen to Messages of the given type from an entity, returning a deregistration action.
|
|
1979
1979
|
/// </summary>
|
|
1980
1980
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
1981
1981
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
1982
1982
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
1983
|
-
/// <returns>De-registration action to
|
|
1983
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
1984
1984
|
public Action AddSourcedBroadcastWithoutSourceHandler(
|
|
1985
1985
|
FastHandlerWithContext<T> handler,
|
|
1986
1986
|
Action deregistration,
|
|
@@ -1996,11 +1996,11 @@
|
|
|
1996
1996
|
}
|
|
1997
1997
|
|
|
1998
1998
|
/// <summary>
|
|
1999
|
-
/// Adds a Global UntargetedHandler to listen to all Untargeted Messages of all types, returning the
|
|
1999
|
+
/// Adds a Global UntargetedHandler to listen to all Untargeted Messages of all types, returning the deregistration action.
|
|
2000
2000
|
/// </summary>
|
|
2001
2001
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2002
2002
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2003
|
-
/// <returns>De-registration action to
|
|
2003
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2004
2004
|
public Action AddGlobalUntargetedHandler(
|
|
2005
2005
|
Action<IUntargetedMessage> handler,
|
|
2006
2006
|
Action deregistration
|
|
@@ -2010,11 +2010,11 @@
|
|
|
2010
2010
|
}
|
|
2011
2011
|
|
|
2012
2012
|
/// <summary>
|
|
2013
|
-
/// Adds a Global fast UntargetedHandler to listen to all Untargeted Messages of all types, returning the
|
|
2013
|
+
/// Adds a Global fast UntargetedHandler to listen to all Untargeted Messages of all types, returning the deregistration action.
|
|
2014
2014
|
/// </summary>
|
|
2015
2015
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2016
2016
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2017
|
-
/// <returns>De-registration action to
|
|
2017
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2018
2018
|
|
|
2019
2019
|
public Action AddGlobalUntargetedHandler(
|
|
2020
2020
|
FastHandler<IUntargetedMessage> handler,
|
|
@@ -2025,11 +2025,11 @@
|
|
|
2025
2025
|
}
|
|
2026
2026
|
|
|
2027
2027
|
/// <summary>
|
|
2028
|
-
/// Adds a Global TargetedHandler to listen to all Targeted Messages of all types for all entities, returning the
|
|
2028
|
+
/// Adds a Global TargetedHandler to listen to all Targeted Messages of all types for all entities, returning the deregistration action.
|
|
2029
2029
|
/// </summary>
|
|
2030
2030
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2031
2031
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2032
|
-
/// <returns>De-registration action to
|
|
2032
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2033
2033
|
public Action AddGlobalTargetedHandler(
|
|
2034
2034
|
Action<InstanceId, ITargetedMessage> handler,
|
|
2035
2035
|
Action deregistration
|
|
@@ -2039,11 +2039,11 @@
|
|
|
2039
2039
|
}
|
|
2040
2040
|
|
|
2041
2041
|
/// <summary>
|
|
2042
|
-
/// Adds a Global fast TargetedHandler to listen to all Targeted Messages of all types for all entities (along with the target instance id), returning the
|
|
2042
|
+
/// Adds a Global fast TargetedHandler to listen to all Targeted Messages of all types for all entities (along with the target instance id), returning the deregistration action.
|
|
2043
2043
|
/// </summary>
|
|
2044
2044
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2045
2045
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2046
|
-
/// <returns>De-registration action to
|
|
2046
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2047
2047
|
|
|
2048
2048
|
public Action AddGlobalTargetedHandler(
|
|
2049
2049
|
FastHandlerWithContext<ITargetedMessage> handler,
|
|
@@ -2054,11 +2054,11 @@
|
|
|
2054
2054
|
}
|
|
2055
2055
|
|
|
2056
2056
|
/// <summary>
|
|
2057
|
-
/// Adds a Global BroadcastHandler to listen to all Targeted Messages of all types for all entities, returning the
|
|
2057
|
+
/// Adds a Global BroadcastHandler to listen to all Targeted Messages of all types for all entities, returning the deregistration action.
|
|
2058
2058
|
/// </summary>
|
|
2059
2059
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2060
2060
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2061
|
-
/// <returns>De-registration action to
|
|
2061
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2062
2062
|
public Action AddGlobalBroadcastHandler(
|
|
2063
2063
|
Action<InstanceId, IBroadcastMessage> handler,
|
|
2064
2064
|
Action deregistration
|
|
@@ -2068,11 +2068,11 @@
|
|
|
2068
2068
|
}
|
|
2069
2069
|
|
|
2070
2070
|
/// <summary>
|
|
2071
|
-
/// Adds a Global fast BroadcastHandler to listen to all Targeted Messages of all types for all entities (along with the source instance id), returning the
|
|
2071
|
+
/// Adds a Global fast BroadcastHandler to listen to all Targeted Messages of all types for all entities (along with the source instance id), returning the deregistration action.
|
|
2072
2072
|
/// </summary>
|
|
2073
2073
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2074
2074
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2075
|
-
/// <returns>De-registration action to
|
|
2075
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2076
2076
|
public Action AddGlobalBroadcastHandler(
|
|
2077
2077
|
FastHandlerWithContext<IBroadcastMessage> handler,
|
|
2078
2078
|
Action deregistration
|
|
@@ -2082,12 +2082,12 @@
|
|
|
2082
2082
|
}
|
|
2083
2083
|
|
|
2084
2084
|
/// <summary>
|
|
2085
|
-
/// Adds an Untargeted post
|
|
2085
|
+
/// Adds an Untargeted post-processor to be called after all other handlers have been called.
|
|
2086
2086
|
/// </summary>
|
|
2087
2087
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2088
2088
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2089
2089
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2090
|
-
/// <returns>De-registration action to
|
|
2090
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2091
2091
|
public Action AddUntargetedPostProcessor(
|
|
2092
2092
|
Action<T> handler,
|
|
2093
2093
|
Action deregistration,
|
|
@@ -2103,12 +2103,12 @@
|
|
|
2103
2103
|
}
|
|
2104
2104
|
|
|
2105
2105
|
/// <summary>
|
|
2106
|
-
/// Adds a fast Untargeted post
|
|
2106
|
+
/// Adds a fast Untargeted post-processor to be called after all other handlers have been called.
|
|
2107
2107
|
/// </summary>
|
|
2108
2108
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2109
2109
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2110
2110
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2111
|
-
/// <returns>De-registration action to
|
|
2111
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2112
2112
|
public Action AddUntargetedPostProcessor(
|
|
2113
2113
|
FastHandler<T> handler,
|
|
2114
2114
|
Action deregistration,
|
|
@@ -2124,13 +2124,13 @@
|
|
|
2124
2124
|
}
|
|
2125
2125
|
|
|
2126
2126
|
/// <summary>
|
|
2127
|
-
/// Adds
|
|
2127
|
+
/// Adds a Targeted post-processor to be called after all other handlers have been called.
|
|
2128
2128
|
/// </summary>
|
|
2129
2129
|
/// <param name="target">Target the handler is for.</param>
|
|
2130
2130
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2131
2131
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2132
2132
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2133
|
-
/// <returns>De-registration action to
|
|
2133
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2134
2134
|
public Action AddTargetedPostProcessor(
|
|
2135
2135
|
InstanceId target,
|
|
2136
2136
|
Action<T> handler,
|
|
@@ -2148,13 +2148,13 @@
|
|
|
2148
2148
|
}
|
|
2149
2149
|
|
|
2150
2150
|
/// <summary>
|
|
2151
|
-
/// Adds a Targeted post
|
|
2151
|
+
/// Adds a Targeted post-processor to be called after all other handlers have been called.
|
|
2152
2152
|
/// </summary>
|
|
2153
2153
|
/// <param name="target">Target the handler is for.</param>
|
|
2154
2154
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2155
2155
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2156
2156
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2157
|
-
/// <returns>De-registration action to
|
|
2157
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2158
2158
|
public Action AddTargetedPostProcessor(
|
|
2159
2159
|
InstanceId target,
|
|
2160
2160
|
FastHandler<T> handler,
|
|
@@ -2172,12 +2172,12 @@
|
|
|
2172
2172
|
}
|
|
2173
2173
|
|
|
2174
2174
|
/// <summary>
|
|
2175
|
-
/// Adds a Targeted post
|
|
2175
|
+
/// Adds a Targeted post-processor to be called after all other handlers have been called after every message of the given type.
|
|
2176
2176
|
/// </summary>
|
|
2177
2177
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2178
2178
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2179
2179
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2180
|
-
/// <returns>De-registration action to
|
|
2180
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2181
2181
|
public Action AddTargetedWithoutTargetingPostProcessor(
|
|
2182
2182
|
Action<InstanceId, T> handler,
|
|
2183
2183
|
Action deregistration,
|
|
@@ -2193,12 +2193,12 @@
|
|
|
2193
2193
|
}
|
|
2194
2194
|
|
|
2195
2195
|
/// <summary>
|
|
2196
|
-
/// Adds a Targeted post
|
|
2196
|
+
/// Adds a Targeted post-processor to be called after all other handlers have been called after every message of the given type.
|
|
2197
2197
|
/// </summary>
|
|
2198
2198
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2199
2199
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2200
2200
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2201
|
-
/// <returns>De-registration action to
|
|
2201
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2202
2202
|
public Action AddTargetedWithoutTargetingPostProcessor(
|
|
2203
2203
|
FastHandlerWithContext<T> handler,
|
|
2204
2204
|
Action deregistration,
|
|
@@ -2214,13 +2214,13 @@
|
|
|
2214
2214
|
}
|
|
2215
2215
|
|
|
2216
2216
|
/// <summary>
|
|
2217
|
-
/// Adds a Broadcast post
|
|
2217
|
+
/// Adds a Broadcast post-processor to be called after all other handlers have been called.
|
|
2218
2218
|
/// </summary>
|
|
2219
|
-
/// <param name="source">Source the handler is for.</param>
|
|
2219
|
+
/// <param name="source">The Source the handler is for.</param>
|
|
2220
2220
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2221
2221
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2222
2222
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2223
|
-
/// <returns>De-registration action to
|
|
2223
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2224
2224
|
public Action AddBroadcastPostProcessor(
|
|
2225
2225
|
InstanceId source,
|
|
2226
2226
|
Action<T> handler,
|
|
@@ -2238,13 +2238,13 @@
|
|
|
2238
2238
|
}
|
|
2239
2239
|
|
|
2240
2240
|
/// <summary>
|
|
2241
|
-
/// Adds a fast Broadcast post
|
|
2241
|
+
/// Adds a fast Broadcast post-processor to be called after all other handlers have been called.
|
|
2242
2242
|
/// </summary>
|
|
2243
|
-
/// <param name="source">Source the handler is for.</param>
|
|
2243
|
+
/// <param name="source">The Source the handler is for.</param>
|
|
2244
2244
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2245
2245
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2246
2246
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2247
|
-
/// <returns>De-registration action to
|
|
2247
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2248
2248
|
public Action AddBroadcastPostProcessor(
|
|
2249
2249
|
InstanceId source,
|
|
2250
2250
|
FastHandler<T> handler,
|
|
@@ -2262,12 +2262,12 @@
|
|
|
2262
2262
|
}
|
|
2263
2263
|
|
|
2264
2264
|
/// <summary>
|
|
2265
|
-
/// Adds a Broadcast post
|
|
2265
|
+
/// Adds a Broadcast post-processor to be called after all other handlers have been called for every message of the given type.
|
|
2266
2266
|
/// </summary>
|
|
2267
2267
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2268
2268
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2269
2269
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2270
|
-
/// <returns>De-registration action to
|
|
2270
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2271
2271
|
public Action AddBroadcastWithoutSourcePostProcessor(
|
|
2272
2272
|
Action<InstanceId, T> handler,
|
|
2273
2273
|
Action deregistration,
|
|
@@ -2283,12 +2283,12 @@
|
|
|
2283
2283
|
}
|
|
2284
2284
|
|
|
2285
2285
|
/// <summary>
|
|
2286
|
-
/// Adds a fast Broadcast post
|
|
2286
|
+
/// Adds a fast Broadcast post-processor to be called after all other handlers have been called.
|
|
2287
2287
|
/// </summary>
|
|
2288
2288
|
/// <param name="handler">Relevant MessageHandler.</param>
|
|
2289
2289
|
/// <param name="deregistration">Deregistration action for the handler.</param>
|
|
2290
2290
|
/// <param name="priority">Priority at which to add the handler.</param>
|
|
2291
|
-
/// <returns>De-registration action to
|
|
2291
|
+
/// <returns>De-registration action to unregister the handler.</returns>
|
|
2292
2292
|
public Action AddBroadcastWithoutSourcePostProcessor(
|
|
2293
2293
|
FastHandlerWithContext<T> handler,
|
|
2294
2294
|
Action deregistration,
|
|
@@ -2391,28 +2391,28 @@
|
|
|
2391
2391
|
}
|
|
2392
2392
|
}
|
|
2393
2393
|
|
|
2394
|
-
private static void RunFastHandlers<TMessage,
|
|
2395
|
-
Stack<List<FastHandler<
|
|
2396
|
-
Dictionary<FastHandler<
|
|
2394
|
+
private static void RunFastHandlers<TMessage, TU>(
|
|
2395
|
+
Stack<List<FastHandler<TU>>> stack,
|
|
2396
|
+
Dictionary<FastHandler<TU>, int> fastHandlers,
|
|
2397
2397
|
ref TMessage message
|
|
2398
2398
|
)
|
|
2399
2399
|
where TMessage : IMessage
|
|
2400
|
-
where
|
|
2400
|
+
where TU : IMessage
|
|
2401
2401
|
{
|
|
2402
2402
|
if (fastHandlers is not { Count: > 0 })
|
|
2403
2403
|
{
|
|
2404
2404
|
return;
|
|
2405
2405
|
}
|
|
2406
2406
|
|
|
2407
|
-
ref
|
|
2407
|
+
ref TU typedMessage = ref Unsafe.As<TMessage, TU>(ref message);
|
|
2408
2408
|
|
|
2409
|
-
List<FastHandler<
|
|
2409
|
+
List<FastHandler<TU>> handlers = GetOrAddNewHandlerStack(
|
|
2410
2410
|
ref stack,
|
|
2411
2411
|
fastHandlers.Keys
|
|
2412
2412
|
);
|
|
2413
2413
|
try
|
|
2414
2414
|
{
|
|
2415
|
-
foreach (FastHandler<
|
|
2415
|
+
foreach (FastHandler<TU> fastHandler in handlers)
|
|
2416
2416
|
{
|
|
2417
2417
|
fastHandler(ref typedMessage);
|
|
2418
2418
|
}
|
|
@@ -2423,29 +2423,29 @@
|
|
|
2423
2423
|
}
|
|
2424
2424
|
}
|
|
2425
2425
|
|
|
2426
|
-
private static void RunFastHandlers<TMessage,
|
|
2426
|
+
private static void RunFastHandlers<TMessage, TU>(
|
|
2427
2427
|
ref InstanceId context,
|
|
2428
|
-
ref Stack<List<FastHandlerWithContext<
|
|
2429
|
-
Dictionary<FastHandlerWithContext<
|
|
2428
|
+
ref Stack<List<FastHandlerWithContext<TU>>> stack,
|
|
2429
|
+
Dictionary<FastHandlerWithContext<TU>, int> priorityHandlers,
|
|
2430
2430
|
ref TMessage message
|
|
2431
2431
|
)
|
|
2432
2432
|
where TMessage : IMessage
|
|
2433
|
-
where
|
|
2433
|
+
where TU : IMessage
|
|
2434
2434
|
{
|
|
2435
2435
|
if (priorityHandlers is not { Count: > 0 })
|
|
2436
2436
|
{
|
|
2437
2437
|
return;
|
|
2438
2438
|
}
|
|
2439
2439
|
|
|
2440
|
-
ref
|
|
2440
|
+
ref TU typedMessage = ref Unsafe.As<TMessage, TU>(ref message);
|
|
2441
2441
|
|
|
2442
|
-
List<FastHandlerWithContext<
|
|
2442
|
+
List<FastHandlerWithContext<TU>> handlers = GetOrAddNewHandlerStack(
|
|
2443
2443
|
ref stack,
|
|
2444
2444
|
priorityHandlers.Keys
|
|
2445
2445
|
);
|
|
2446
2446
|
try
|
|
2447
2447
|
{
|
|
2448
|
-
foreach (FastHandlerWithContext<
|
|
2448
|
+
foreach (FastHandlerWithContext<TU> fastHandler in handlers)
|
|
2449
2449
|
{
|
|
2450
2450
|
fastHandler(ref context, ref typedMessage);
|
|
2451
2451
|
}
|
|
@@ -2456,15 +2456,15 @@
|
|
|
2456
2456
|
}
|
|
2457
2457
|
}
|
|
2458
2458
|
|
|
2459
|
-
private static void RunFastHandlers<TMessage,
|
|
2459
|
+
private static void RunFastHandlers<TMessage, TU>(
|
|
2460
2460
|
ref InstanceId context,
|
|
2461
|
-
ref Stack<List<FastHandlerWithContext<
|
|
2462
|
-
Dictionary<int, Dictionary<FastHandlerWithContext<
|
|
2461
|
+
ref Stack<List<FastHandlerWithContext<TU>>> stack,
|
|
2462
|
+
Dictionary<int, Dictionary<FastHandlerWithContext<TU>, int>> fastHandlers,
|
|
2463
2463
|
ref TMessage message,
|
|
2464
2464
|
int priority
|
|
2465
2465
|
)
|
|
2466
2466
|
where TMessage : IMessage
|
|
2467
|
-
where
|
|
2467
|
+
where TU : IMessage
|
|
2468
2468
|
{
|
|
2469
2469
|
if (fastHandlers is not { Count: > 0 })
|
|
2470
2470
|
{
|
|
@@ -2474,22 +2474,22 @@
|
|
|
2474
2474
|
if (
|
|
2475
2475
|
!fastHandlers.TryGetValue(
|
|
2476
2476
|
priority,
|
|
2477
|
-
out Dictionary<FastHandlerWithContext<
|
|
2477
|
+
out Dictionary<FastHandlerWithContext<TU>, int> priorityHandlers
|
|
2478
2478
|
)
|
|
2479
2479
|
)
|
|
2480
2480
|
{
|
|
2481
2481
|
return;
|
|
2482
2482
|
}
|
|
2483
2483
|
|
|
2484
|
-
ref
|
|
2484
|
+
ref TU typedMessage = ref Unsafe.As<TMessage, TU>(ref message);
|
|
2485
2485
|
|
|
2486
|
-
List<FastHandlerWithContext<
|
|
2486
|
+
List<FastHandlerWithContext<TU>> handlers = GetOrAddNewHandlerStack(
|
|
2487
2487
|
ref stack,
|
|
2488
2488
|
priorityHandlers.Keys
|
|
2489
2489
|
);
|
|
2490
2490
|
try
|
|
2491
2491
|
{
|
|
2492
|
-
foreach (FastHandlerWithContext<
|
|
2492
|
+
foreach (FastHandlerWithContext<TU> fastHandler in handlers)
|
|
2493
2493
|
{
|
|
2494
2494
|
fastHandler(ref context, ref typedMessage);
|
|
2495
2495
|
}
|
|
@@ -2603,50 +2603,50 @@
|
|
|
2603
2603
|
}
|
|
2604
2604
|
}
|
|
2605
2605
|
|
|
2606
|
-
private static List<
|
|
2607
|
-
ref Stack<List<
|
|
2608
|
-
Dictionary<
|
|
2606
|
+
private static List<TU> GetOrAddNewHandlerStack<TU>(
|
|
2607
|
+
ref Stack<List<TU>> stack,
|
|
2608
|
+
Dictionary<TU, int>.KeyCollection handlers
|
|
2609
2609
|
)
|
|
2610
2610
|
{
|
|
2611
|
-
stack ??= new Stack<List<
|
|
2612
|
-
if (!stack.TryPop(out List<
|
|
2611
|
+
stack ??= new Stack<List<TU>>();
|
|
2612
|
+
if (!stack.TryPop(out List<TU> typedHandlerStack))
|
|
2613
2613
|
{
|
|
2614
|
-
return new List<
|
|
2614
|
+
return new List<TU>(handlers);
|
|
2615
2615
|
}
|
|
2616
2616
|
|
|
2617
2617
|
typedHandlerStack.Clear();
|
|
2618
|
-
foreach (
|
|
2618
|
+
foreach (TU handler in handlers)
|
|
2619
2619
|
{
|
|
2620
2620
|
typedHandlerStack.Add(handler);
|
|
2621
2621
|
}
|
|
2622
2622
|
return typedHandlerStack;
|
|
2623
2623
|
}
|
|
2624
2624
|
|
|
2625
|
-
private static Action AddHandler<
|
|
2625
|
+
private static Action AddHandler<TU>(
|
|
2626
2626
|
InstanceId context,
|
|
2627
|
-
ref Dictionary<InstanceId, Dictionary<int, Dictionary<
|
|
2628
|
-
|
|
2627
|
+
ref Dictionary<InstanceId, Dictionary<int, Dictionary<TU, int>>> handlersByContext,
|
|
2628
|
+
TU handler,
|
|
2629
2629
|
Action deregistration,
|
|
2630
2630
|
int priority
|
|
2631
2631
|
)
|
|
2632
2632
|
{
|
|
2633
2633
|
handlersByContext ??=
|
|
2634
|
-
new Dictionary<InstanceId, Dictionary<int, Dictionary<
|
|
2634
|
+
new Dictionary<InstanceId, Dictionary<int, Dictionary<TU, int>>>();
|
|
2635
2635
|
|
|
2636
2636
|
if (
|
|
2637
2637
|
!handlersByContext.TryGetValue(
|
|
2638
2638
|
context,
|
|
2639
|
-
out Dictionary<int, Dictionary<
|
|
2639
|
+
out Dictionary<int, Dictionary<TU, int>> sortedHandlers
|
|
2640
2640
|
)
|
|
2641
2641
|
)
|
|
2642
2642
|
{
|
|
2643
|
-
sortedHandlers = new Dictionary<int, Dictionary<
|
|
2643
|
+
sortedHandlers = new Dictionary<int, Dictionary<TU, int>>();
|
|
2644
2644
|
handlersByContext[context] = sortedHandlers;
|
|
2645
2645
|
}
|
|
2646
2646
|
|
|
2647
|
-
if (!sortedHandlers.TryGetValue(priority, out Dictionary<
|
|
2647
|
+
if (!sortedHandlers.TryGetValue(priority, out Dictionary<TU, int> handlers))
|
|
2648
2648
|
{
|
|
2649
|
-
handlers = new Dictionary<
|
|
2649
|
+
handlers = new Dictionary<TU, int>();
|
|
2650
2650
|
sortedHandlers[priority] = handlers;
|
|
2651
2651
|
}
|
|
2652
2652
|
|
|
@@ -2654,8 +2654,10 @@
|
|
|
2654
2654
|
|
|
2655
2655
|
handlers[handler] = count + 1;
|
|
2656
2656
|
|
|
2657
|
-
Dictionary<
|
|
2658
|
-
|
|
2657
|
+
Dictionary<
|
|
2658
|
+
InstanceId,
|
|
2659
|
+
Dictionary<int, Dictionary<TU, int>>
|
|
2660
|
+
> localHandlersByContext = handlersByContext;
|
|
2659
2661
|
|
|
2660
2662
|
return () =>
|
|
2661
2663
|
{
|
|
@@ -2680,31 +2682,38 @@
|
|
|
2680
2682
|
if (count <= 1)
|
|
2681
2683
|
{
|
|
2682
2684
|
_ = handlers.Remove(handler);
|
|
2685
|
+
if (0 < handlers.Count)
|
|
2686
|
+
{
|
|
2687
|
+
return;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
_ = sortedHandlers.Remove(priority);
|
|
2691
|
+
if (0 < sortedHandlers.Count)
|
|
2692
|
+
{
|
|
2693
|
+
return;
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
localHandlersByContext.Remove(context);
|
|
2683
2697
|
return;
|
|
2684
2698
|
}
|
|
2685
2699
|
|
|
2686
2700
|
handlers[handler] = count - 1;
|
|
2687
|
-
|
|
2688
|
-
if (handlers.Count <= 0)
|
|
2689
|
-
{
|
|
2690
|
-
_ = localHandlersByContext.Remove(context);
|
|
2691
|
-
}
|
|
2692
2701
|
};
|
|
2693
2702
|
}
|
|
2694
2703
|
|
|
2695
|
-
private static Action AddHandler<
|
|
2696
|
-
ref Dictionary<
|
|
2697
|
-
|
|
2704
|
+
private static Action AddHandler<TU>(
|
|
2705
|
+
ref Dictionary<TU, int> handlersByPriority,
|
|
2706
|
+
TU handler,
|
|
2698
2707
|
Action deregistration
|
|
2699
2708
|
)
|
|
2700
2709
|
{
|
|
2701
|
-
handlersByPriority ??= new Dictionary<
|
|
2710
|
+
handlersByPriority ??= new Dictionary<TU, int>();
|
|
2702
2711
|
|
|
2703
2712
|
int count = handlersByPriority.GetValueOrDefault(handler, 0);
|
|
2704
2713
|
|
|
2705
2714
|
handlersByPriority[handler] = count + 1;
|
|
2706
2715
|
|
|
2707
|
-
Dictionary<
|
|
2716
|
+
Dictionary<TU, int> localHandlers = handlersByPriority;
|
|
2708
2717
|
|
|
2709
2718
|
return () =>
|
|
2710
2719
|
{
|
|
@@ -2725,20 +2734,23 @@
|
|
|
2725
2734
|
};
|
|
2726
2735
|
}
|
|
2727
2736
|
|
|
2728
|
-
private static Action AddHandler<
|
|
2729
|
-
ref Dictionary<int, Dictionary<
|
|
2730
|
-
|
|
2737
|
+
private static Action AddHandler<TU>(
|
|
2738
|
+
ref Dictionary<int, Dictionary<TU, int>> sortedHandlers,
|
|
2739
|
+
TU handler,
|
|
2731
2740
|
Action deregistration,
|
|
2732
2741
|
int priority
|
|
2733
2742
|
)
|
|
2734
2743
|
{
|
|
2735
|
-
sortedHandlers ??= new Dictionary<int, Dictionary<
|
|
2744
|
+
sortedHandlers ??= new Dictionary<int, Dictionary<TU, int>>();
|
|
2736
2745
|
|
|
2737
2746
|
if (
|
|
2738
|
-
!sortedHandlers.TryGetValue(
|
|
2747
|
+
!sortedHandlers.TryGetValue(
|
|
2748
|
+
priority,
|
|
2749
|
+
out Dictionary<TU, int> handlersByPriority
|
|
2750
|
+
)
|
|
2739
2751
|
)
|
|
2740
2752
|
{
|
|
2741
|
-
handlersByPriority = new Dictionary<
|
|
2753
|
+
handlersByPriority = new Dictionary<TU, int>();
|
|
2742
2754
|
sortedHandlers[priority] = handlersByPriority;
|
|
2743
2755
|
}
|
|
2744
2756
|
|
|
@@ -2746,12 +2758,16 @@
|
|
|
2746
2758
|
|
|
2747
2759
|
handlersByPriority[handler] = count + 1;
|
|
2748
2760
|
|
|
2749
|
-
Dictionary<int, Dictionary<
|
|
2750
|
-
Dictionary<U, int> localHandlers = handlersByPriority;
|
|
2761
|
+
Dictionary<int, Dictionary<TU, int>> localSortedHandlers = sortedHandlers;
|
|
2751
2762
|
|
|
2752
2763
|
return () =>
|
|
2753
2764
|
{
|
|
2754
|
-
if (!
|
|
2765
|
+
if (!localSortedHandlers.TryGetValue(priority, out handlersByPriority))
|
|
2766
|
+
{
|
|
2767
|
+
return;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
if (!handlersByPriority.TryGetValue(handler, out count))
|
|
2755
2771
|
{
|
|
2756
2772
|
return;
|
|
2757
2773
|
}
|
|
@@ -2760,17 +2776,15 @@
|
|
|
2760
2776
|
deregistration?.Invoke();
|
|
2761
2777
|
if (count <= 1)
|
|
2762
2778
|
{
|
|
2763
|
-
_ =
|
|
2764
|
-
|
|
2765
|
-
if (localHandlers.Count <= 0)
|
|
2779
|
+
_ = handlersByPriority.Remove(handler);
|
|
2780
|
+
if (handlersByPriority.Count <= 0)
|
|
2766
2781
|
{
|
|
2767
2782
|
_ = localSortedHandlers.Remove(priority);
|
|
2768
2783
|
}
|
|
2769
|
-
|
|
2770
2784
|
return;
|
|
2771
2785
|
}
|
|
2772
2786
|
|
|
2773
|
-
|
|
2787
|
+
handlersByPriority[handler] = count - 1;
|
|
2774
2788
|
};
|
|
2775
2789
|
}
|
|
2776
2790
|
}
|