Follow this link to skip to the main content

claraty::const_Auto_Ref< T > Class Template Reference

#include <auto_reference.h>

Collaboration diagram for claraty::const_Auto_Ref< T >:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 const_Auto_Ref ()
 const_Auto_Ref (const const_Auto_Ref &rhs)
 const_Auto_Ref (const Auto_Ref< T > &rhs)
 ~const_Auto_Ref ()
const void * get_const_representation_pointer () const
const_Auto_Refoperator= (const const_Auto_Ref &rhs)
template<class S>
void cast_to (const_Auto_Ref< S > &rhs)
void cast_to (const_Auto_Ref< T > &rhs)
void reset_rc (ref_counter< T > *new_rc)
template<class R>
bool operator== (const const_Auto_Ref< R > &rhs) const
template<class R>
bool operator!= (const const_Auto_Ref< R > &rhs) const
const T & operator * () const
const T * operator-> () const
 operator bool () const
bool operator! () const

Private Attributes

ref_counter< T > * _rc

Detailed Description

template<class T>
class claraty::const_Auto_Ref< T >

Definition at line 228 of file auto_reference.h.


Constructor & Destructor Documentation

template<class T>
claraty::const_Auto_Ref< T >::const_Auto_Ref (  )  [inline]

Definition at line 231 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc.

00231 { _rc = new ref_counter<T>(); }

template<class T>
claraty::const_Auto_Ref< T >::const_Auto_Ref ( const const_Auto_Ref< T > &  rhs  )  [inline]

Definition at line 232 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::inc().

00232                                             {
00233     _rc = rhs._rc;
00234     _rc->inc();
00235   }

Here is the call graph for this function:

template<class T>
claraty::const_Auto_Ref< T >::const_Auto_Ref ( const Auto_Ref< T > &  rhs  )  [inline]

Definition at line 236 of file auto_reference.h.

References claraty::Auto_Ref< T >::_rc, claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::inc().

00236                                          {
00237     _rc = rhs._rc;
00238     _rc->inc();
00239   }

Here is the call graph for this function:

template<class T>
claraty::const_Auto_Ref< T >::~const_Auto_Ref (  )  [inline]

Definition at line 240 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::dec().

00240                     {
00241     if (_rc->dec() == 0) delete _rc;
00242   }

Here is the call graph for this function:


Member Function Documentation

template<class T>
const void* claraty::const_Auto_Ref< T >::get_const_representation_pointer (  )  const [inline]

Definition at line 247 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc.

Referenced by claraty::const_Auto_Ref< T >::operator==().

00247 { return _rc; }

template<class T>
const_Auto_Ref& claraty::const_Auto_Ref< T >::operator= ( const const_Auto_Ref< T > &  rhs  )  [inline]

Definition at line 249 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, claraty::ref_counter< RT >::dec(), and claraty::ref_counter< RT >::inc().

00249                                                        {
00250     if (_rc != rhs._rc) {
00251       if (_rc->dec() == 0) delete _rc;
00252       _rc = rhs._rc;
00253       _rc->inc();
00254     }
00255     return *this;
00256   }

Here is the call graph for this function:

template<class T>
template<class S>
void claraty::const_Auto_Ref< T >::cast_to ( const_Auto_Ref< S > &  rhs  )  [inline]

Definition at line 262 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, claraty::ref_counter< RT >::_rep, and claraty::const_Auto_Ref< T >::reset_rc().

00262                                        {
00263     if (dynamic_cast<S*>(_rc->_rep) == NULL) {
00264       std::cerr << "Illegal attempt to cast an Auto_Ref<T> to an Auto_Ref<U> where "
00265         "U is not castable from T (or from a NULL Auto_Ref)" << std::endl;
00266       S& dummy = dynamic_cast<S&>(*_rc->_rep); // will throw bad_cast
00267     }
00268     ref_counter<S> *rc_subclass = reinterpret_cast<ref_counter<S>*>(_rc);
00269     rhs.reset_rc(rc_subclass);
00270   }

Here is the call graph for this function:

template<class T>
void claraty::const_Auto_Ref< T >::cast_to ( const_Auto_Ref< T > &  rhs  )  [inline]

Definition at line 273 of file auto_reference.h.

00273                                        {
00274     rhs = *this;
00275   }

template<class T>
void claraty::const_Auto_Ref< T >::reset_rc ( ref_counter< T > *  new_rc  )  [inline]

Definition at line 280 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, claraty::ref_counter< RT >::dec(), and claraty::ref_counter< RT >::inc().

Referenced by claraty::const_Auto_Ref< T >::cast_to().

00280                                         {
00281     if (_rc->dec() == 0) delete _rc;
00282     _rc = new_rc;
00283     _rc->inc();
00284   }

Here is the call graph for this function:

template<class T>
template<class R>
bool claraty::const_Auto_Ref< T >::operator== ( const const_Auto_Ref< R > &  rhs  )  const [inline]

Definition at line 287 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::const_Auto_Ref< T >::get_const_representation_pointer().

Referenced by claraty::const_Auto_Ref< T >::operator!=().

00287                                                       {
00288     return static_cast<void*>(_rc) == rhs.get_const_representation_pointer();
00289   }

Here is the call graph for this function:

template<class T>
template<class R>
bool claraty::const_Auto_Ref< T >::operator!= ( const const_Auto_Ref< R > &  rhs  )  const [inline]

Definition at line 292 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::operator==().

00292                                                       {
00293     return !operator==(rhs);
00294   }

Here is the call graph for this function:

template<class T>
const T& claraty::const_Auto_Ref< T >::operator * (  )  const [inline]

Definition at line 295 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::_rep.

00295                              {
00296     return *_rc->_rep;
00297   }

template<class T>
const T* claraty::const_Auto_Ref< T >::operator-> (  )  const [inline]

Definition at line 299 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::_rep.

00299                               {
00300     return _rc->_rep;
00301   }

template<class T>
claraty::const_Auto_Ref< T >::operator bool (  )  const [inline]

Definition at line 303 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::_rep.

00303                         {
00304     return !!_rc->_rep;
00305   }

template<class T>
bool claraty::const_Auto_Ref< T >::operator! (  )  const [inline]

Definition at line 306 of file auto_reference.h.

References claraty::const_Auto_Ref< T >::_rc, and claraty::ref_counter< RT >::_rep.

00306                          {
00307     return !_rc->_rep;
00308   }


Member Data Documentation


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