Simulant  21.12-194
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
notifies_destruction.h
1 #pragma once
2 
3 #include "../signals/signal.h"
4 #include "../logging.h"
5 
6 namespace smlt {
7 
8 template<typename T>
10  typedef sig::signal<void (T*)> destruction_signal;
11 
12  DEFINE_SIGNAL(destruction_signal, signal_destruction);
13 
14 public:
15  virtual ~NotifiesDestruction() {
16  try {
17  signal_destruction_((T*) this);
18  } catch(...) {
19  S_WARN(_F("Exception while signaling destruction of object {0} at {1}").format(
20  typeid(T).name(), this
21  ));
22  }
23  }
24 };
25 
26 }
smlt
Definition: animation.cpp:25
smlt::Formatter
Definition: formatter.h:11
smlt::NotifiesDestruction
Definition: notifies_destruction.h:9
smlt::sig::signal
Definition: signal.h:319