ucommon  7.0.0
About: GNU uCommon C++ is a portable and optimized class framework for writing C++ applications that need to use threads and support concurrent synchronization, and that use sockets, XML parsing, object serialization, thread-optimized string and data structure classes, etc..
  Fossies Dox: ucommon-7.0.0.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

Loading...
Searching...
No Matches
ucommon::object_pointer< T > Class Template Reference

Typed smart pointer class. More...

#include <object.h>

Inheritance diagram for ucommon::object_pointer< T >:
[legend]
Collaboration diagram for ucommon::object_pointer< T >:
[legend]

Public Member Functions

 object_pointer ()
 Create a pointer with no reference. More...
 
 object_pointer (T *object)
 Create a pointer with a reference to a heap object. More...
 
 object_pointer (const object_pointer &copy)
 
T * operator* () const
 Reference object we are pointing to through pointer indirection. More...
 
T & operator() () const
 Reference object we are pointing to through function reference. More...
 
T * operator-> () const
 Reference member of object we are pointing to. More...
 
T * get (void) const
 Get pointer to object. More...
 
object_pointeroperator= (T *typed)
 Perform assignment operator to existing object. More...
 
object_pointeroperator= (const object_pointer &from)
 
 operator bool () const
 See if pointer is set. More...
 
bool operator! () const
 See if pointer is not set. More...
 
- Public Member Functions inherited from ucommon::AutoObject
void release (void)
 Manually release the pointer. More...
 
bool operator! () const
 Test if the pointer is not set. More...
 
 operator bool () const
 Test if the pointer is referencing an object. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ucommon::AutoObject
 AutoObject ()
 
 AutoObject (ObjectProtocol *object)
 Construct an auto-pointer referencing an existing object. More...
 
 AutoObject (const AutoObject &pointer)
 Construct an auto-pointer as a copy of another pointer. More...
 
 ~AutoObject ()
 Delete auto pointer. More...
 
void set (ObjectProtocol *object)
 Set our pointer to a specific object. More...
 
- Protected Attributes inherited from ucommon::AutoObject
ObjectProtocolobject
 

Detailed Description

template<class T>
class ucommon::object_pointer< T >

Typed smart pointer class.

This is used to manage references to a specific typed object on the heap that is derived from the base Object class. This is most commonly used to manage references to reference counted heap objects so their heap usage can be auto-managed while there is active references to such objects. Pointers are usually created on the stack frame and used to reference an object during the life of a member function. They can be created in other objects that live on the heap and can be used to maintain active references so long as the object they are contained in remains in scope as well.

Author
David Sugar dyfet.nosp@m.@gnu.nosp@m.telep.nosp@m.hony.nosp@m..org

Definition at line 328 of file object.h.

Constructor & Destructor Documentation

◆ object_pointer() [1/3]

template<class T >
ucommon::object_pointer< T >::object_pointer ( )
inline

Create a pointer with no reference.

Definition at line 334 of file object.h.

◆ object_pointer() [2/3]

template<class T >
ucommon::object_pointer< T >::object_pointer ( T *  object)
inline

Create a pointer with a reference to a heap object.

Parameters
objectwe are referencing.

Definition at line 340 of file object.h.

◆ object_pointer() [3/3]

template<class T >
ucommon::object_pointer< T >::object_pointer ( const object_pointer< T > &  copy)
inline

Definition at line 342 of file object.h.

Member Function Documentation

◆ get()

template<class T >
T * ucommon::object_pointer< T >::get ( void  ) const
inline

Get pointer to object.

Returns
pointer or NULL if we are not referencing an object.

Definition at line 372 of file object.h.

◆ operator bool()

template<class T >
ucommon::object_pointer< T >::operator bool ( ) const
inline

See if pointer is set.

Definition at line 393 of file object.h.

◆ operator!()

template<class T >
bool ucommon::object_pointer< T >::operator! ( ) const
inline

See if pointer is not set.

Definition at line 400 of file object.h.

◆ operator()()

template<class T >
T & ucommon::object_pointer< T >::operator() ( ) const
inline

Reference object we are pointing to through function reference.

Returns
object we are pointing to.

Definition at line 356 of file object.h.

◆ operator*()

template<class T >
T * ucommon::object_pointer< T >::operator* ( ) const
inline

Reference object we are pointing to through pointer indirection.

Returns
pointer to object we are pointing to.

Definition at line 348 of file object.h.

◆ operator->()

template<class T >
T * ucommon::object_pointer< T >::operator-> ( ) const
inline

Reference member of object we are pointing to.

Returns
reference to member of pointed object.

Definition at line 364 of file object.h.

◆ operator=() [1/2]

template<class T >
object_pointer & ucommon::object_pointer< T >::operator= ( const object_pointer< T > &  from)
inline

Definition at line 385 of file object.h.

References ucommon::AutoObject::object, and ucommon::AutoObject::set().

Here is the call graph for this function:

◆ operator=() [2/2]

template<class T >
object_pointer & ucommon::object_pointer< T >::operator= ( T *  typed)
inline

Perform assignment operator to existing object.

Parameters
typedobject to assign.

Definition at line 380 of file object.h.

References ucommon::AutoObject::set().

Here is the call graph for this function:

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