reference


A nonintrusive reference counting mechanism for automatic object management.

Library

Helper<ToolKit>

Declaration

#include <ospace/helper/reference.h>

template< class T >
class os_reference

Interface

Constructor
os_reference( T* ptr )
Constructs a reference to the object pointed to by ptr (default 0 ).
Constructor
os_reference( const T& object )
Constructs a reference to a new object with the same value as object .
Constructor
os_reference( const os_reference& reference )
Constructs a reference to the same object managed by reference .
Destructor
~os_reference()
Destroys this reference and decrements the managed object's reference count by one. If the managed object is no longer referred to by another os_reference instance, then destroys the managed object.
=
os_reference& operator=( const os_reference& reference )
Assigns this reference to manage the same object managed by reference . If no other os_reference instance is managing the object previously managed by this reference, the previous object is destroyed.
*
const T& operator*() const
Returns a constant reference to the managed object.
*
T& operator*()
Returns a reference to the managed object.
->
const T* operator->() const
Returns a constant pointer to the managed object.
->
T* operator->()
Returns a pointer to the managed object.

Universal Streaming Service

#include <ospace/uss/helper.h>

<<
os_bstream& operator<<( os_bstream& stream , const os_reference& reference )
Writes reference to stream .
>>
os_bstream& operator>>( os_bstream& stream , os_reference& reference )
Reads reference from stream .

Copyright©1994-2026 Recursion Software LLC
All Rights Reserved - For use by licensed users only.