VL
VLNotifications.h
Go to the documentation of this file.
1#pragma once
2// Notify all subscriptors
3// Send "before" notification
4#define INIT_NOTIFY_BEFORE \
5 vl::Object nfInfObj; \
6 auto nInfPtr = vl::MakePtr(nfInfObj); \
7 nfInfObj.Set("before", true);
8
9#define INIT_NOTIFY \
10 vl::Object nfInfObj; \
11 auto nInfPtr = vl::MakePtr(nfInfObj); \
12
13#define SEND_NOTIFY(observable) \
14 observable->Notify(nInfPtr);
15
16#define SEND_NOTIFY_BEFORE(cmd, arg, observable) \
17 nfInfObj.Set(cmd, arg); \
18 observable->Notify(nInfPtr);
19
20#define NOTIFY_BEFORE(cmd, arg, observable) \
21 vl::Object nfInfObj; \
22 auto nInfPtr = vl::MakePtr(nfInfObj); \
23 nfInfObj.Set(cmd, arg); \
24 nfInfObj.Set("before", true); \
25 observable->Notify(nInfPtr);
26
27#define NOTIFY_ADD(id, val) \
28 nfInfObj.Set(id, val);
29
30// Send "after" notification
31#define NOTIFY_AFTER(observable) \
32 nfInfObj.RemoveProperty("before"); \
33 nfInfObj.Set("after", true); \
34 observable->Notify(nInfPtr);