-
Notifications
You must be signed in to change notification settings - Fork 0
ListenMessage family
Every form of registering a listener.
Declared in Plugins/GMP/Source/GMP/GMP/GMPUtils.h (FGMPHelper)
template<typename KeyT, typename T, typename F>
static FGMPKey ListenMessage(const TMSGKEYTyped<KeyT>& K, T* Listener, F&& f,
GMP::FGMPListenOptions Options = {});
template<typename KeyT, typename T, typename F>
static FGMPKey ListenObjectMessage(FSigSource InSigSrc, const TMSGKEYTyped<KeyT>& K, T* Listener, F&& f,
GMP::FGMPListenOptions Options = {});
template<typename KeyT, typename T, typename F>
static FGMPKey ListenWorldMessage(const UWorld* InWorld, const TMSGKEYTyped<KeyT>& K, T* Listener, F&& f,
GMP::FGMPListenOptions Options = {});
template<typename KeyT, typename T, typename F>
static FGMPKey ListenWorldMessage(const UObject* WorldContext, const TMSGKEYTyped<KeyT>& K, T* Listener, F&& f,
GMP::FGMPListenOptions Options = {});Unregistering:
static void UnListenMessage(const FMSGKEYFind& K, FGMPKey id); // one listener
static void UnListenMessage(const FMSGKEYFind& K, const UObject* Owner); // all of an owner'sListener is the lifetime owner, f is what runs. The owner may be:
| Owner | Lifetime handled by |
|---|---|
UObject* |
weak-pointer staleness checked on dispatch |
GMP::FSigHandle* |
its destructor — see FSigHandle |
| shared-pointer types |
CreateSPLambda and friends |
A raw this from a non-UObject, non-handle class has nothing to check. That is the one combination
to avoid.
GMP::FGMPListenOptions — Plugins/GMP/Source/GMP/GMP/GMPKey.h:29:
struct FGMPListenOptions : public FGMPListenOrder
{
int32 Times = -1; // -1 = forever
// int32 Order = 0; // from FGMPListenOrder, under GMP_WITH_SIGNAL_ORDER
static FGMPListenOptions Default;
};ListenMessage(KEY, this, cb, { .Times = 3, .Order = -10 });-
Times— decremented per call; reaching zero unregisters the listener automatically. -
Order— lower runs first, default0. Equal orders keep registration order, because the value is packed into the high bits of the FGMPKey and the pre-fire sort is stable.FGMPListenOrder::MinOrderandMaxOrderare provided for the extremes.

Order is compiled out entirely when GMP_WITH_SIGNAL_ORDER is off.
The callable's parameters determine the signature this listener claims. It may take fewer parameters than
the send provides — see Parameter compatibility. Declaring FGMPResponder& last makes it the
responding listener — see FGMPResponder.
An FGMPKey identifying this registration. Keep it if you intend to unregister that one listener; ignore it if the owner's lifetime is doing the work.
FSigHandle · FGMPKey · Parameter compatibility · Dispatch layers
GMP · Reference wiki — one page per named thing. Guided introduction: project site · 中文站点 · measured dispatch stack Source: repository · README · README 中文
Pages here are generated from wiki/ in the main repository — edit there, not on the wiki.
Concepts
- Why a string key
- Dispatch layers
- Parameter compatibility
- Signature inference
- Key baking
- Transparent rewrite
- Jump tracing
Sending and listening
- NotifyMessage family
- ListenMessage family
- StoreObjectMessage
- MSGKEY
- FSigSource
- FSigHandle
- FGMPKey
- FGMPResponder
Dispatch internals
Reflection and data
Editor
Build