diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2015-01-16 16:34:09 +0100 |
---|---|---|
committer | Andreas Stöckel <andreas@somweyr.de> | 2015-01-16 16:34:09 +0100 |
commit | e3caf907184286b795fadc1991cf69348f97d192 (patch) | |
tree | 1167037d70ab4dfa23676ca5c8a23682b16b23b8 /src/core/managed/Managed.hpp | |
parent | 9ea137094077eee7f7e80f25871cc91592982e4b (diff) | |
parent | 9929838e62d9c17647d74be54af5853e8b613c4b (diff) |
Merge branch 'master' of somweyr.de:ousia
Diffstat (limited to 'src/core/managed/Managed.hpp')
-rw-r--r-- | src/core/managed/Managed.hpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/core/managed/Managed.hpp b/src/core/managed/Managed.hpp index dd1a23a..e98e95e 100644 --- a/src/core/managed/Managed.hpp +++ b/src/core/managed/Managed.hpp @@ -94,6 +94,24 @@ public: Manager &getManager() { return mgr; } /** + * Returns the unique identifier (UID) of this object. Valid UIDs are + * positive non-zero values. + * + * @return the unique id of the object. + */ + ManagedUid getUid() const + { + /* + * Dear Bjarne Stroustroup, dear gods of C++, please excuse this + * const_cast, for I did try other means but was not able to apply them + * and in my despair turned to this folly, this ugliness, this heresy! + * I pledge my life to better programming and promise that this cast + * will do no harm to anyone. + */ + return mgr.getUid(const_cast<Managed *>(this)); + } + + /** * Acquires a reference to the object wraped in the given handle -- creates * a new Owned handle instance with this Managed instance as owner and the * given object handle as the referenced object. @@ -151,8 +169,7 @@ public: * object. The event id must be used when unregistering event handlers. */ EventId registerEvent(EventType type, EventHandler handler, - Handle<Managed> owner, - void *data = nullptr); + Handle<Managed> owner, void *data = nullptr); /** * Unregisters the event handler with the given signature. |