Workspace 6.21.5
Public Member Functions | List of all members
ConnectionReference Class Reference

A class which stores a reference to a connection in a way that is agnostic to the connection instance that is supplied (referenced connection's memory location). More...

#include <Workspace/DataExecution/Connections/connectionreference.h>

Public Member Functions

 ConnectionReference (Connection &connection)
 
ConnectiongetConnection () const
 

Detailed Description

This class stores a reference to the connection in such a way that it is able to be retrieved even if the actual underlying connection reference is destroyed and replaced.

We can't store an actual reference to the connection as some operations destroy the original reference. For example an operation workflow where this currently happens is where the connection is removed but then recreated. Specifically if you currently remove the connection, but then reverse the removal (undo) the connection reference will have changed and operations in the undo stack that occurred on the connection prior to the removal (if not using a reference agnostic method) would be referring to a stale connection reference rather then the new connection created when the removal was reversed in the undo.

Note however that the current implementation obtains and stores the current root workspace and as a result this must not change for the lifetime of the reference (although it should be possible to relax this constraint in future if it is required - its just presently more effort to implement then required by the use cases for this class presently).

Constructor & Destructor Documentation

◆ ConnectionReference()

ConnectionReference ( Connection connection)

Constructs a ConnectionReference to the supplied connection.

Parameters
connectionThe connection to reference.

Member Function Documentation

◆ getConnection()

Connection & getConnection ( ) const

Gets a reference to the connection.

Returns
The current reference to the connection that was originally supplied.