PandA-2024.02
Data Structures | Public Member Functions | Private Attributes | Friends
refcount< T > Struct Template Reference

Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: http://www.antlr.org/license.html). More...

#include <refcount.hpp>

Inheritance diagram for refcount< T >:
Inheritance graph
[legend]
Collaboration diagram for refcount< T >:
Collaboration graph
[legend]

Data Structures

struct  Ref
 

Public Member Functions

 refcount (T *p=0)
 
template<class null_deleter >
 refcount (T *p, null_deleter &d)
 
 refcount (const refcount< T > &other)
 
 ~refcount ()
 
refcount< T > & operator= (const refcount< T > &other)
 
bool operator== (const refcount< T > &other)
 
 operator T* () const
 
 operator Wrefcount< T > () const
 
T * operator-> () const
 
T * get () const
 
template<class newType >
 operator refcount< newType > ()
 

Private Attributes

struct refcount::Refref
 

Friends

class Wrefcount< T >
 

Detailed Description

template<typename T>
struct refcount< T >

Template borrowed from the ANTLR library by Terence Parr (http://www.jGuru.com - Software rights: http://www.antlr.org/license.html).

refcount is a simple template class useful for passing references to function templates (algorithms) that would usually take copies of their arguments and to get transparent to the programmer all the allocation and deallocation issues. The original class has been extended to support refcount object that does not deallocate the ptr object. This can be useful in case of circular references. In particular, this implementation works similarly to the smart_pointer object when a null deleter is passed to the contructor.

Definition at line 94 of file refcount.hpp.

Constructor & Destructor Documentation

◆ refcount() [1/3]

template<typename T>
refcount< T >::refcount ( T *  p = 0)
inlineexplicit

Definition at line 128 of file refcount.hpp.

◆ refcount() [2/3]

template<typename T>
template<class null_deleter >
refcount< T >::refcount ( T *  p,
null_deleter d 
)
inlineexplicit

Definition at line 132 of file refcount.hpp.

◆ refcount() [3/3]

template<typename T>
refcount< T >::refcount ( const refcount< T > &  other)
inline

Definition at line 136 of file refcount.hpp.

◆ ~refcount()

template<typename T>
refcount< T >::~refcount ( )
inline

Definition at line 139 of file refcount.hpp.

Member Function Documentation

◆ get()

template<typename T>
T* refcount< T >::get ( ) const
inline

◆ operator refcount< newType >()

template<typename T>
template<class newType >
refcount< T >::operator refcount< newType > ( )
inline

Definition at line 174 of file refcount.hpp.

◆ operator T*()

template<typename T>
refcount< T >::operator T* ( ) const
inline

Definition at line 157 of file refcount.hpp.

◆ operator Wrefcount< T >()

template<typename T>
refcount< T >::operator Wrefcount< T > ( ) const
inline

Definition at line 161 of file refcount.hpp.

◆ operator->()

template<typename T>
T* refcount< T >::operator-> ( ) const
inline

Definition at line 165 of file refcount.hpp.

◆ operator=()

template<typename T>
refcount<T>& refcount< T >::operator= ( const refcount< T > &  other)
inline

Definition at line 145 of file refcount.hpp.

◆ operator==()

template<typename T>
bool refcount< T >::operator== ( const refcount< T > &  other)
inline

Definition at line 153 of file refcount.hpp.

Friends And Related Function Documentation

◆ Wrefcount< T >

template<typename T>
friend class Wrefcount< T >
friend

Definition at line 97 of file refcount.hpp.

Field Documentation

◆ ref

template<typename T>
struct refcount::Ref * refcount< T >::ref
private

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

Generated on Mon Feb 12 2024 13:04:02 for PandA-2024.02 by doxygen 1.8.13