Pioneer
Loading...
Searching...
No Matches
DeleteEmitter.h
Go to the documentation of this file.
1// Copyright © 2008-2023 Pioneer Developers. See AUTHORS.txt for details
2// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
3
4#ifndef _DELETEEMITTER_H
5#define _DELETEEMITTER_H
6
7// inherit from this class to be able to get notifications when an object is
8// destroyed. the LuaObject tracking layer uses this to properly "forget"
9// about objects that are currently exposed to lua
10
11// including sigc++ directly so we don't get circular dependencies
12#include <sigc++/sigc++.h>
13
14#include "lua/LuaWrappable.h"
15
17public:
20 {
21 onDelete.emit();
22 }
23
24 // onDelete is mutable since its not unusual to want to know when a const
25 // object is deleted, and attaching this signal does not conceptually
26 // affect the object's state
27 mutable sigc::signal<void> onDelete;
28
29private:
30 // sigc++ signals cannot be copied, but long-standing design flaw means
31 // they don't have a private copy constructor. we protect them ourselves
33};
34
35#endif
Definition DeleteEmitter.h:16
virtual ~DeleteEmitter()
Definition DeleteEmitter.h:19
DeleteEmitter()
Definition DeleteEmitter.h:18
sigc::signal< void > onDelete
Definition DeleteEmitter.h:27
Definition LuaWrappable.h:13