Public Member Functions
thor::Connection Class Reference

Class that maintains control over a registered object. More...

List of all members.

Public Member Functions

 Connection ()
 Default constructor: Creates an instance which is initially invalid.
bool isConnected () const
 Checks whether the instance currently references a listener.
void invalidate ()
 Invalidates this instance.
void disconnect ()
 Disconnects the referenced listener from its triggering event.

Detailed Description

Class that maintains control over a registered object.

You need a connection if you want to remove event listeners, particle emitters or affectors from their containers. The class Connection uses shared-ownership semantics, that means copying its instances results in multiple references to the same listener. A connection automatically invalidates when the referenced object is removed. Therefore, you don't have to worry about dangling connections.


Constructor & Destructor Documentation

Default constructor: Creates an instance which is initially invalid.

Assign another object to make this instance a valid Connection.


Member Function Documentation

Disconnects the referenced listener from its triggering event.

This action invalidates this and all other Connections to the referenced listener. If no connection exists at the moment, this function has no effect.

Invalidates this instance.

This does not affect the referenced listener (if any) nor other Connection instances. Invalidating an already invalid instance has no effects.
After the invalidation, you can reuse this instance by assigning another one. But normally, it pays off to have as few invalid connections as possible, as this saves you from case differentiations.

Checks whether the instance currently references a listener.

Returns:
true if this instance is currently connected.

The documentation for this class was generated from the following file: