Public Types | Public Member Functions

wali::ref_ptr< T > Class Template Reference

A reference counting pointer class. More...

List of all members.

Public Types

typedef unsigned int count_t

Public Member Functions

 ref_ptr (T *t=0)
 ref_ptr (const ref_ptr &rp)
template<typename S >
 ref_ptr (const ref_ptr< S > &rp)
 This will succeed if S is a subclass of T.
 ~ref_ptr ()
ref_ptroperator= (T *t)
ref_ptroperator= (const ref_ptr &rp)
bool operator== (const ref_ptr &that) const
bool operator!= (const ref_ptr &that) const
T * get_ptr () const
T * operator-> () const
T & operator* () const
bool is_empty () const
bool is_valid () const

Detailed Description

template<typename T>
class wali::ref_ptr< T >

A reference counting pointer class.

Warning:
This class is *NOT* thread safe.

The templated class should use the mixin Countable. When using Countable simply pass a boolean true or false to the rcmix constructor. The default value is true and this means the object will be reference counted. A passed in value of false means to not reference count the object (ie. it will never be deleted ).

If you prefer not to inherit from Countable, then the templated class must have a member variable named count that can be accessed from ref_ptr and modified by ref_ptr. the count variable should have operator++(),operator--(), and operator==( int ) defined. As a note, this class was designed with count being an unsigned integer.

Count should be initialized to 0 for proper reference couting to work. If it is desirable for the pointer/object to never be deleted, initialize count >= 1. WARNING: don't forget to initialize count to 0 in the copy constructor! (And don't forget to have a copy constructor.)

See also:
Countable

Member Typedef Documentation

template<typename T>
typedef unsigned int wali::ref_ptr< T >::count_t

Constructor & Destructor Documentation

template<typename T>
wali::ref_ptr< T >::ref_ptr ( T *  t = 0  ) 
template<typename T>
wali::ref_ptr< T >::ref_ptr ( const ref_ptr< T > &  rp  ) 
template<typename T>
template<typename S >
wali::ref_ptr< T >::ref_ptr ( const ref_ptr< S > &  rp  ) 

This will succeed if S is a subclass of T.

template<typename T>
wali::ref_ptr< T >::~ref_ptr (  ) 

Member Function Documentation

template<typename T>
ref_ptr& wali::ref_ptr< T >::operator= ( T *  t  ) 
template<typename T>
ref_ptr& wali::ref_ptr< T >::operator= ( const ref_ptr< T > &  rp  ) 
template<typename T>
bool wali::ref_ptr< T >::operator== ( const ref_ptr< T > &  that  )  const
template<typename T>
bool wali::ref_ptr< T >::operator!= ( const ref_ptr< T > &  that  )  const
template<typename T>
T* wali::ref_ptr< T >::get_ptr (  )  const

Referenced by wali::wpds::ewpds::EWPDS::add_rule(), wali::wfa::epr::EPA::apply(), wali::MergeFn::apply_f(), wali::SemElem::combine(), wali::regex::Regex::combine(), wali::regex::Regex::COMBINE(), wali::graph::RegExp::combine(), wali::SemElem::delta(), wali::SemElem::diff(), wali::ShortestPathWorklist::doRankOf(), wali::witness::WitnessMergeFn::equal(), wali::SemElem::equal(), wali::MergeFn::equal(), wali::wpds::ewpds::ERule::ERule(), wali::SemElem::extend(), wali::regex::Regex::extend(), wali::wpds::rule_t::get_ptr(), wali::witness::witness_t::getWitness(), wali::regex::Regex::isOne(), wali::regex::Regex::isZero(), wali::ref_ptr< Wrapper >::operator!=(), wali::hm_equal< key_src_t >::operator()(), wali::graph::sem_elem_less::operator()(), wali::graph::sem_elem_equal::operator()(), wali::graph::hash_sem_elem::operator()(), wali::graph::hash_reg_exp_key::operator()(), wali::graph::reg_exp_key_t::operator()(), wali::graph::cmp_reg_exp::operator()(), wali::ref_ptr< Wrapper >::operator=(), wali::ref_ptr< Wrapper >::operator==(), wali::graph::InterGraph::path_summary(), wali::graph::SummaryGraph::popWeight(), wali::wpds::fwpds::FWPDS::poststarIGR(), wali::wpds::fwpds::SWPDS::preprocess(), wali::wpds::fwpds::FWPDS::prestar(), wali::witness::VisitorDot::printEdge(), wali::witness::VisitorDot::printNode(), wali::witness::VisitorDot::printNodeName(), wali::witness::WitnessMergeFn::priv_do_apply(), wali::wfa::WFA::setupFixpoint(), wali::witness::WitnessWrapper::unwrap(), wali::witness::VisitorDot::visitExtend(), wali::witness::VisitorDot::visitMerge(), and wali::witness::WitnessWrapper::wrap().

template<typename T>
T* wali::ref_ptr< T >::operator-> (  )  const
template<typename T>
T& wali::ref_ptr< T >::operator* (  )  const
template<typename T>
bool wali::ref_ptr< T >::is_empty (  )  const
template<typename T>
bool wali::ref_ptr< T >::is_valid (  )  const

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