Class SBCReferenceOwnerSingleton#
ClassList > SBCReferenceOwnerSingleton
This class is the base class of reference owners to a single class.
#include <SBCReferenceOwnerSingleton.hpp>
Inherits the following classes: SBCReferenceOwner
Inherited by the following classes: SBCReferencePointer
Public Functions#
| Type | Name |
|---|---|
| SBCReferenceOwnerSingleton () Default constructor. |
|
| SBCReferenceOwnerSingleton (SBCReferenceTarget * referenceTarget) Builds a reference owner referencing the target referenceTarget . |
|
| SBCReferenceOwnerSingleton (const SBCReferenceOwnerSingleton & p) Copy constructor. |
|
| virtual void | deleteReferenceTarget () Deletes the reference target. |
| unsigned int | getMemoryFootprint () const Returns the memory footprint. |
| SBCReferenceTarget * | getReferenceTarget () const Returns the reference target. |
| bool | isValid () noexcept const Returns true if and only if the reference target is non null. |
| virtual void | print (std::ostream & os) const Prints debugging information. |
| virtual void | print () const Prints debugging information. |
| void | setReferenceTarget (SBCReferenceTarget * referenceTarget) Sets the reference target. |
| virtual | ~SBCReferenceOwnerSingleton () Destructor. |
Protected Attributes#
| Type | Name |
|---|---|
| SBCReferenceToTarget | referenceToTarget The reference to the target. |
Protected Functions#
| Type | Name |
|---|---|
| virtual void | detachReferenceTarget () Detaches the reference target. |
Protected Functions inherited from SBCReferenceOwner#
| Type | Name |
|---|---|
| SBCReferenceOwner () noexcept Constructs a reference owner. |
|
| virtual | ~SBCReferenceOwner () Destructs the reference owner. |
Public Functions Documentation#
function SBCReferenceOwnerSingleton [1/3]#
Default constructor.
Constructs a SBCReferenceOwnerSingleton object with no reference target.
function SBCReferenceOwnerSingleton [2/3]#
Builds a reference owner referencing the target referenceTarget .
Constructs a reference owner referencing the given target.
Parameters:
targetPointer to the SBCReferenceTarget to be referenced. May be nullptr.
function SBCReferenceOwnerSingleton [3/3]#
Copy constructor.
Constructs a new SBCReferenceOwnerSingleton as a copy of the given object.
Parameters:
pReference to the SBCReferenceOwnerSingleton to copy.
function deleteReferenceTarget#
Deletes the reference target.
Deletes the referenced target object.
If a reference target is set, it is removed from all owners and deleted.
function getMemoryFootprint#
Returns the memory footprint.
Returns the memory footprint of the reference owner.
Returns:
The size in bytes of the reference owner's memory usage.
function getReferenceTarget#
Returns the reference target.
Returns the current reference target.
Returns:
Pointer to the SBCReferenceTarget currently referenced, or nullptr if none.
function isValid#
Returns true if and only if the reference target is non null.
Checks whether the reference target is valid.
Returns:
true if the reference target is non-null; false otherwise.
function print [1/2]#
Prints debugging information.
Prints debugging information to the provided output stream.
Parameters:
osOutput stream to which debugging information is written.
function print [2/2]#
Prints debugging information.
Prints debugging information to standard output.
Calls the overload that takes an output stream with std::cout.
function setReferenceTarget#
Sets the reference target.
Updates the reference to point to the specified target, handling necessary reference bookkeeping.
Parameters:
targetPointer to the new SBCReferenceTarget. May be nullptr.
function ~SBCReferenceOwnerSingleton#
Destructor.
Destroys the SBCReferenceOwnerSingleton and releases any owned references.
Protected Attributes Documentation#
variable referenceToTarget#
The reference to the target.
Protected Functions Documentation#
function detachReferenceTarget#
Detaches the reference target.
Clears the internal reference to the target without deleting the target object.