#include <CountedPtr.h>
Inheritance diagram for casa::SimpleCountedConstPtr< t >:

Part of API
This class is Simple because it does not have the operator->() operator. This means that it puts less demands on the underlying type. It is Counted because it is reference counted, and it is Const because the underlying value is non-modifiable.
This class implements a simple reference counting mechanism. It allows SimpleCountedConstPtrs to be passed around freely, incrementing or decrementing the reference count as needed when one SimpleCountedConstPtr is assigned to another. When the reference count reaches zero the internal storage is deleted by default, but this behavior can be overridden.
This class is used as a pointer to constant data. As such, it only has the subset of the CountedConstPtr functions which are relevant for constant data.
Reference counting
Definition at line 148 of file CountedPtr.h.
Public Member Functions | |
| SimpleCountedConstPtr () | |
This constructor allows for the creation of a null SimpleCountedConstPtr. | |
| SimpleCountedConstPtr (t *val, Bool delit=True) | |
This constructor sets up a reference count for the val pointer. | |
| SimpleCountedConstPtr (const t *val) | |
This constructor sets up a reference count for the val pointer. | |
| SimpleCountedConstPtr (const SimpleCountedConstPtr< t > &val) | |
This copy constructor allows SimpleCountedConstPtrs to be initialized from other SimpleCountedConstPtrs. | |
| virtual | ~SimpleCountedConstPtr () |
| This destructor only deletes the really stored data when it was initialized as deletable and the reference count is zero. | |
| const t & | operator * () const |
The SimpleCountedConstPtr indirection operator simply returns a reference to the value being protected. | |
| Bool | operator== (const SimpleCountedConstPtr< t > &other) const |
Equality operator which checks to see if two SimpleCountedConstPtrs are pointing at the same thing. | |
| Bool | operator!= (const SimpleCountedConstPtr< t > &other) const |
Non-equality operator which checks to see if two SimpleCountedConstPtrs are not pointing at the same thing. | |
| SimpleCountedConstPtr< t > & | operator= (const SimpleCountedConstPtr< t > &val) |
This assignment operator allows SimpleCountedConstPtrs to be freely assigned to each other. | |
| SimpleCountedConstPtr< t > & | operator= (t *v) |
This assignment operator allows the object to which the current SimpleCountedConstPtr points to be changed. | |
| uInt | nrefs () const |
| Sometimes it is useful to know if there is more than one reference made. | |
| void | replace (t *v, Bool delit=True) |
This function changes the value for this SimpleCountedConstPtr and all of the other SimpleCountedConstPtrs which point to this same value. | |
| Bool | null () const |
Check to see if this SimpleCountedConstPtr is un-initialized, null. | |
Protected Attributes | |
| PtrRep< t > * | ref |
| casa::SimpleCountedConstPtr< t >::SimpleCountedConstPtr | ( | ) | [inline] |
This constructor allows for the creation of a null SimpleCountedConstPtr.
The assignment operator can be used to assign a null SimpleCountedConstPtr from another pointer.
Definition at line 157 of file CountedPtr.h.
| casa::SimpleCountedConstPtr< t >::SimpleCountedConstPtr | ( | t * | val, | |
| Bool | delit = True | |||
| ) | [inline] |
This constructor sets up a reference count for the val pointer.
By default, the data pointed to by val will be deleted when it is no longer referenced. Passing in False for delit will prevent the data from being deleted when the reference count reaches zero.
Warning: After the counted pointer is initialized the value should no longer be manipulated by the raw pointer of type t*.
Definition at line 170 of file CountedPtr.h.
| casa::SimpleCountedConstPtr< t >::SimpleCountedConstPtr | ( | const t * | val | ) | [inline] |
This constructor sets up a reference count for the val pointer.
Since val is a pointer to constant data, the data will not be deleted when the reference count reaches zero.
Tip: Since the constant data will NOT be cleaned up when the reference count reaches zero, the use of this class for pointers to constant data may not be desirable.
Definition at line 184 of file CountedPtr.h.
| casa::SimpleCountedConstPtr< t >::SimpleCountedConstPtr | ( | const SimpleCountedConstPtr< t > & | val | ) | [inline] |
This copy constructor allows SimpleCountedConstPtrs to be initialized from other SimpleCountedConstPtrs.
Definition at line 191 of file CountedPtr.h.
| virtual casa::SimpleCountedConstPtr< t >::~SimpleCountedConstPtr | ( | ) | [virtual] |
This destructor only deletes the really stored data when it was initialized as deletable and the reference count is zero.
| const t& casa::SimpleCountedConstPtr< t >::operator * | ( | ) | const [inline] |
The SimpleCountedConstPtr indirection operator simply returns a reference to the value being protected.
If the pointer is un-initialized (null), an exception will be thrown. The member function null () can be used to catch such a condition in time.
Tip: The address of the reference returned should not be stored for later use.
Definition at line 216 of file CountedPtr.h.
| Bool casa::SimpleCountedConstPtr< t >::operator== | ( | const SimpleCountedConstPtr< t > & | other | ) | const [inline] |
Equality operator which checks to see if two SimpleCountedConstPtrs are pointing at the same thing.
Definition at line 224 of file CountedPtr.h.
| Bool casa::SimpleCountedConstPtr< t >::operator!= | ( | const SimpleCountedConstPtr< t > & | other | ) | const [inline] |
Non-equality operator which checks to see if two SimpleCountedConstPtrs are not pointing at the same thing.
Definition at line 231 of file CountedPtr.h.
| SimpleCountedConstPtr<t>& casa::SimpleCountedConstPtr< t >::operator= | ( | const SimpleCountedConstPtr< t > & | val | ) | [inline] |
This assignment operator allows SimpleCountedConstPtrs to be freely assigned to each other.
Definition at line 238 of file CountedPtr.h.
| SimpleCountedConstPtr<t>& casa::SimpleCountedConstPtr< t >::operator= | ( | t * | v | ) |
This assignment operator allows the object to which the current SimpleCountedConstPtr points to be changed.
| uInt casa::SimpleCountedConstPtr< t >::nrefs | ( | ) | const [inline] |
Sometimes it is useful to know if there is more than one reference made.
This is a way of getting that. Of course the point of these classes is that this information is normally not required.
Definition at line 257 of file CountedPtr.h.
Referenced by casa::COWPtr< T >::isUnique().
| void casa::SimpleCountedConstPtr< t >::replace | ( | t * | v, | |
| Bool | delit = True | |||
| ) | [inline] |
This function changes the value for this SimpleCountedConstPtr and all of the other SimpleCountedConstPtrs which point to this same value.
Warning: This is dangerous, and generally should not be done.
Definition at line 267 of file CountedPtr.h.
| Bool casa::SimpleCountedConstPtr< t >::null | ( | ) | const [inline] |
Check to see if this SimpleCountedConstPtr is un-initialized, null.
Definition at line 278 of file CountedPtr.h.
Referenced by casa::PlotFactory::areaFill(), casa::PlotFactory::color(), casa::PlotFactory::font(), casa::COWPtr< T >::isNull(), casa::PlotFactory::line(), casa::PlotFactory::plotter(), casa::HistogramPlot::setAreaFill(), casa::PlotShape::setAreaFill(), casa::PlotSymbol::setAreaFill(), casa::BarPlot::setAreaFill(), casa::PlotCanvas::setAxisFont(), casa::PlotAnnotation::setBackground(), casa::PlotCanvas::setBackground(), casa::Plotter::setCanvas(), casa::ErrorPlot::setErrorLine(), casa::PlotAnnotation::setFont(), casa::PlotCanvas::setGridMajorLine(), casa::PlotCanvas::setGridMinorLine(), casa::PlotCanvas::setLegendFill(), casa::PlotCanvas::setLegendFont(), casa::PlotCanvas::setLegendLine(), casa::Plot::setLine(), casa::PlotShape::setLine(), casa::PlotSymbol::setLine(), casa::PlotAnnotation::setOutline(), casa::PlotPoint::setSymbol(), casa::ScatterPlot::setSymbol(), casa::PlotCanvas::setTitleFont(), and casa::PlotFactory::symbol().
PtrRep<t>* casa::SimpleCountedConstPtr< t >::ref [protected] |
Definition at line 282 of file CountedPtr.h.
Referenced by casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::nrefs(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::null(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::operator *(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::operator!=(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::operator=(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::operator==(), casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::replace(), and casa::SimpleCountedConstPtr< casa::Block< std::complex< float > > >::SimpleCountedConstPtr().
1.5.1