Teuchos::ArrayRCP< T > Class Template Reference

Array reference-counted pointer class. More...

#include <Teuchos_ArrayRCPDecl.hpp>

List of all members.

Public Member Functions

template<class T>
 ArrayRCP (T *p, Ordinal lowerOffset_in, Ordinal upperOffset_in, const RCPNodeHandle &node)

Private Member Functions

void debug_assert_not_null () const
void debug_assert_in_range (Ordinal lowerOffset_in, Ordinal size_in) const
void debug_assert_valid_ptr () const

Private Attributes

T * ptr_
RCPNodeHandle node_
Ordinal lowerOffset_
Ordinal upperOffset_

Related Functions

(Note that these are not member functions.)



template<class T >
ArrayRCP< T > arcp (const RCP< Array< T > > &v)
 Wrap an Array<T> object as an ArrayRCP<T> object.
template<class T >
ArrayRCP< const T > arcp (const RCP< const Array< T > > &v)
 Wrap a const Array<T> object as an ArrayRCP<const T> object.
template<class T >
ArrayRCP< T > arcp (T *p, typename ArrayRCP< T >::Ordinal lowerOffset, typename ArrayRCP< T >::Ordinal size, bool owns_mem=true)
 Wraps a preallocated array of data with the assumption to call the array version of delete.
template<class T , class Dealloc_T >
ArrayRCP< T > arcp (T *p, typename ArrayRCP< T >::Ordinal lowerOffset, typename ArrayRCP< T >::Ordinal size, Dealloc_T dealloc, bool owns_mem)
 Wraps a preallocated array of data and uses a templated deallocation strategy object to define deletion .
template<class T >
ArrayRCP< T > arcp (typename ArrayRCP< T >::Ordinal size)
 Allocate a new array just given a dimension.
template<class T >
ArrayRCP< T > arcpClone (const ArrayView< const T > &v)
 Allocate a new array by cloning data from an input array view.
template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObjPreDestroy (T *p, typename ArrayRCP< T >::Ordinal lowerOffset, typename ArrayRCP< T >::Ordinal size, const Embedded &embedded, bool owns_mem=true)
 Create an ArrayRCP with and also put in an embedded object.
template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObjPostDestroy (T *p, typename ArrayRCP< T >::Ordinal lowerOffset, typename ArrayRCP< T >::Ordinal size, const Embedded &embedded, bool owns_mem=true)
 Create an ArrayRCP with and also put in an embedded object.
template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObj (T *p, typename ArrayRCP< T >::Ordinal lowerOffset, typename ArrayRCP< T >::Ordinal size, const Embedded &embedded, bool owns_mem=true)
 Create an ArrayRCP with and also put in an embedded object.
template<class T >
ArrayRCP< T > arcp (const RCP< std::vector< T > > &v)
 Wrap an std::vector<T> object as an ArrayRCP<T> object.
template<class T >
ArrayRCP< const T > arcp (const RCP< const std::vector< T > > &v)
 Wrap a const std::vector<T> object as an ArrayRCP<const T> object.
template<class T >
ArrayRCP< T > arcpFromArrayView (const ArrayView< T > &av)
 Get an ArrayRCP object out of an ArrayView object.
template<class T >
RCP< std::vector< T > > get_std_vector (const ArrayRCP< T > &ptr)
 Get an std::vector<T> object out of an ArrayRCP<T> object that was created using the arcp() above to wrap the std::vector in the first place..
template<class T >
RCP< const std::vector< T > > get_std_vector (const ArrayRCP< const T > &ptr)
 Get a const std::vector<T> object out of an ArrayRCP<const T> object that was created using the arcp() above to wrap the std::vector in the first place.
template<class T >
bool is_null (const ArrayRCP< T > &p)
 Returns true if p.get()==NULL.
template<class T >
bool nonnull (const ArrayRCP< T > &p)
 Returns true if p.get()!=NULL.
template<class T >
bool operator== (const ArrayRCP< T > &p, ENull)
 Returns true if p.get()==NULL.
template<class T >
bool operator!= (const ArrayRCP< T > &p, ENull)
 Returns true if p.get()!=NULL.
template<class T >
ArrayRCP< T >::difference_type operator- (const ArrayRCP< T > &p1, const ArrayRCP< T > &p2)
 Returns difference of two ArrayRCP object.
template<class T2 , class T1 >
ArrayRCP< T2 > arcp_const_cast (const ArrayRCP< T1 > &p1)
 Const cast of underlying ArrayRCP type from const T* to T*.
template<class T2 , class T1 >
ArrayRCP< T2 > arcp_reinterpret_cast (const ArrayRCP< T1 > &p1)
 Reinterpret cast of underlying ArrayRCP type from T1* to T2*.
template<class T2 , class T1 >
ArrayRCP< T2 > arcp_implicit_cast (const ArrayRCP< T1 > &p1)
 Implicit case the underlying ArrayRCP type from T1* to T2*.
template<class T1 , class T2 >
void set_extra_data (const T1 &extra_data, const std::string &name, const Ptr< ArrayRCP< T2 > > &p, EPrePostDestruction destroy_when=POST_DESTROY, bool force_unique=true)
 Set extra data associated with a ArrayRCP object.
template<class T1 , class T2 >
T1 & get_extra_data (ArrayRCP< T2 > &p, const std::string &name)
 Get a non-const reference to extra data associated with a ArrayRCP object.
template<class T1 , class T2 >
const T1 & get_extra_data (const ArrayRCP< T2 > &p, const std::string &name)
 Get a const reference to extra data associated with a ArrayRCP object.
template<class T1 , class T2 >
T1 * get_optional_extra_data (ArrayRCP< T2 > &p, const std::string &name)
 Get a pointer to non-const extra data (if it exists) associated with a ArrayRCP object.
template<class T1 , class T2 >
const T1 * get_optional_extra_data (const ArrayRCP< T2 > &p, const std::string &name)
 Get a pointer to const extra data (if it exists) associated with a ArrayRCP object.
template<class Dealloc_T , class T >
Dealloc_T & get_nonconst_dealloc (const ArrayRCP< T > &p)
 Return a non-const reference to the underlying deallocator object.
template<class Dealloc_T , class T >
const Dealloc_T & get_dealloc (const ArrayRCP< T > &p)
 Return a const reference to the underlying deallocator object.
template<class Dealloc_T , class T >
const Dealloc_T * get_optional_dealloc (const ArrayRCP< T > &p)
 Return a pointer to the underlying non-const deallocator object if it exists.
template<class Dealloc_T , class T >
Dealloc_T * get_optional_nonconst_dealloc (const ArrayRCP< T > &p)
 Return a pointer to the underlying const deallocator object if it exists.
template<class TOrig , class Embedded , class T >
const Embedded & getEmbeddedObj (const ArrayRCP< T > &p)
 Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj().
template<class TOrig , class Embedded , class T >
Embedded & getNonconstEmbeddedObj (const ArrayRCP< T > &p)
 Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj().

Public types



typedef
std::random_access_iterator_tag 
iterator_category
 
typedef T * iterator_type
 
typedef T value_type
 
typedef T & reference
 
typedef T * pointer
 
typedef ptrdiff_t difference_type
 
typedef T element_type
 
typedef Teuchos_Index Ordinal
 
typedef T * iterator
typedef T * const_iterator

Constructors/Destructors/Initializers



 ArrayRCP (ENull null_arg=null)
 Initialize ArrayRCP<T> to NULL.
 ArrayRCP (T *p, Ordinal lowerOffset, Ordinal upperOffset, bool has_ownership)
 Construct from a raw pointer and a valid range.
template<class Dealloc_T >
 ArrayRCP (T *p, Ordinal lowerOffset, Ordinal upperOffset, Dealloc_T dealloc, bool has_ownership)
 Construct from a raw pointer, a valid range, and a deallocator.
 ArrayRCP (Ordinal lowerOffset, const T &val=T())
 Construct allocating an array of size n and filling.
 ArrayRCP (const ArrayRCP< T > &r_ptr)
 Initialize from another ArrayRCP<T> object.
 ~ArrayRCP ()
 Removes a reference to a dynamically allocated array and possibly deletes the array if owned.
ArrayRCP< T > & operator= (const ArrayRCP< T > &r_ptr)
 Copy the pointer to the referenced array and increment the reference count.

Object/Pointer Access Functions



bool is_null () const
 Returns true if the underlying pointer is null.
T * operator-> () const
 Pointer (->) access to members of underlying object for current position.
T & operator* () const
 Dereference the underlying object for the current pointer position.
T * get () const
 Get the raw C++ pointer to the underlying object.
T * getRawPtr () const
 Get the raw C++ pointer to the underlying object.
T & operator[] (Ordinal offset) const
 Random object access.

Pointer Arithmetic Functions



ArrayRCP< T > & operator++ ()
 Prefix increment of pointer (i.e. ++ptr).
ArrayRCP< T > operator++ (int)
 Postfix increment of pointer (i.e. ptr++).
ArrayRCP< T > & operator-- ()
 Prefix deincrement of pointer (i.e. --ptr).
ArrayRCP< T > operator-- (int)
 Postfix deincrement of pointer (i.e. ptr--).
ArrayRCP< T > & operator+= (Ordinal offset)
 Pointer integer increment (i.e. ptr+=offset).
ArrayRCP< T > & operator-= (Ordinal offset)
 Pointer integer increment (i.e. ptr-=offset).
ArrayRCP< T > operator+ (Ordinal offset) const
 Pointer integer increment (i.e. ptr+offset).
ArrayRCP< T > operator- (Ordinal offset) const
 Pointer integer deincrement (i.e. ptr-offset).

Standard Container-Like Functions



const_iterator begin () const
 Return an iterator to beginning of the array of data.
const_iterator end () const
 Return an iterator to past the end of the array of data.

ArrayRCP Views



ArrayRCP< const T > getConst () const
 Return object for only const access to data.
ArrayRCP< T > persistingView (Ordinal lowerOffset, Ordinal size) const
 Return a persisting view of a contiguous range of elements.

Size and extent query functions



Ordinal lowerOffset () const
 Return the lower offset to valid data.
Ordinal upperOffset () const
 Return the upper offset to valid data.
Ordinal size () const
 The total number of items in the managed array (i.e. upperOffset()-lowerOffset()+1).

ArrayView views



ArrayView< T > view (Ordinal lowerOffset, Ordinal size) const
 Return view of a contiguous range of elements.
ArrayView< T > operator() (Ordinal lowerOffset, Ordinal size) const
 Return a view of a contiguous range of elements (calls view(offset,size)).
ArrayView< T > operator() () const
 Return an ArrayView of *this.

Implicit conversions



 operator ArrayView< T > () const
 Perform an implicit conversion to a ArrayView<T> (calls operator()()).
 operator ArrayRCP< const T > () const
 Convert from ArrayRCP<T> to ArrayRCP<const T>.

std::vector like and other misc functions



void assign (Ordinal n, const T &val)
 Resize and assign n elements of val.
template<class Iter >
void assign (Iter first, Iter last)
 Resize and assign to iterator sequence [first, last).
void deepCopy (const ArrayView< const T > &av)
 Deep copy the elements from one ArrayView object into this object.
void resize (const Ordinal n, const T &val=T())
 Resize and append new elements if enlarging.
void clear ()
 Resize to zero..

Reference counting



ERCPStrength strength () const
 Strength of the pointer.
bool is_valid_ptr () const
 Return if the underlying object pointer is still valid or not.
int strong_count () const
 Return the number of active RCP<> objects that have a "strong" reference to the underlying reference-counted object.
int weak_count () const
 Return the number of active RCP<> objects that have a "weak" reference to the underlying reference-counted object.
int total_count () const
 Total count (strong_count() + weak_count()).
void set_has_ownership ()
 Give this and other ArrayRCP<> objects ownership of the underlying referenced array to delete it.
bool has_ownership () const
 Returns true if this has ownership of object pointed to by this->get() in order to delete it.
T * release ()
 Release the ownership of the underlying array.
ArrayRCP< T > create_weak () const
 Create a new weak RCP object from another (strong) RCP object.
ArrayRCP< T > create_strong () const
 Create a new strong RCP object from another (weak) RCP object.
template<class T2 >
bool shares_resource (const ArrayRCP< T2 > &r_ptr) const
 Returns true if the smart pointers share the same underlying reference-counted object.

Assertion Functions.



const ArrayRCP< T > & assert_not_null () const
 Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
const ArrayRCP< T > & assert_in_range (Ordinal lowerOffset, Ordinal size) const
 Throws NullReferenceError if this->get()==NULL orthis->get()!=NULL, throws RangeError if (lowerOffset < this->lowerOffset() || this->upperOffset() < upperOffset, otherwise returns reference to *this.
const ArrayRCP< T > & assert_valid_ptr () const
 If the object pointer is non-null, assert that it is still valid.

Deprecated



int count () const
 Returns strong_count() [deprecated].

Detailed Description

template<class T>
class Teuchos::ArrayRCP< T >

Array reference-counted pointer class.

This is a reference-counted class similar to RCP except that it is designed to use reference counting to manage an array of objects that use value semantics. Managing an array of objects is very different from managing a pointer to an individual, possibly polymorphic, object. For example, while implicit conversions from derived to base types is a good thing when dealing with pointers to single objects, it is a very bad thing when working with arrays of objects. Therefore, this class contains those capabilities of raw pointers that are good dealing with arrays of objects but excludes those that are bad, such as implicit conversions from derived to base types.

Note that all access will be checked at runtime to avoid reading invalid memory if HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is defined which it is if --enable-teuchos-abc is given to the configure script. In order to be able to check access, every ArrayRCP must be constructed given a range. When HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is defined, this class simply does not give up a raw pointer or raw reference to any internally referenced object if that object does not fall with the range of valid data.

Type T requirements:

ToDo: Finish documentation!

Definition at line 73 of file Teuchos_ArrayRCPDecl.hpp.


Member Typedef Documentation

template<class T>
typedef std::random_access_iterator_tag Teuchos::ArrayRCP< T >::iterator_category

Definition at line 80 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T* Teuchos::ArrayRCP< T >::iterator_type

Definition at line 82 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T Teuchos::ArrayRCP< T >::value_type

Definition at line 84 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T& Teuchos::ArrayRCP< T >::reference

Definition at line 86 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T* Teuchos::ArrayRCP< T >::pointer

Definition at line 88 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef ptrdiff_t Teuchos::ArrayRCP< T >::difference_type

Definition at line 90 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T Teuchos::ArrayRCP< T >::element_type

Definition at line 93 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef Teuchos_Index Teuchos::ArrayRCP< T >::Ordinal

Definition at line 95 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T* Teuchos::ArrayRCP< T >::iterator

Definition at line 100 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
typedef T* Teuchos::ArrayRCP< T >::const_iterator

Definition at line 106 of file Teuchos_ArrayRCPDecl.hpp.


Constructor & Destructor Documentation

template<class T >
Teuchos::ArrayRCP< T >::ArrayRCP ( ENull  null_arg = null  )  [inline]

Initialize ArrayRCP<T> to NULL.

This allows clients to write code like:

   ArrayRCP<int> p = null;

or

   ArrayRCP<int> p;

and construct to NULL

Definition at line 71 of file Teuchos_ArrayRCP.hpp.

template<class T>
Teuchos::ArrayRCP< T >::ArrayRCP ( T *  p,
Ordinal  lowerOffset,
Ordinal  upperOffset,
bool  has_ownership 
) [inline]

Construct from a raw pointer and a valid range.

Postconditions:

WARNING! You should avoid manipulating raw pointers and use other methods to construct an ArrayRCP object instead!

Definition at line 88 of file Teuchos_ArrayRCP.hpp.

template<class T>
template<class Dealloc_T >
REFCOUNTPTR_INLINE Teuchos::ArrayRCP< T >::ArrayRCP ( T *  p,
Ordinal  lowerOffset,
Ordinal  upperOffset,
Dealloc_T  dealloc,
bool  has_ownership 
) [inline]

Construct from a raw pointer, a valid range, and a deallocator.

Postconditions:

WARNING! You should avoid manipulating raw pointers and use other methods to construct an ArrayRCP object instead!

Definition at line 113 of file Teuchos_ArrayRCP.hpp.

template<class T>
Teuchos::ArrayRCP< T >::ArrayRCP ( Ordinal  lowerOffset,
const T &  val = T() 
) [inline, explicit]

Construct allocating an array of size n and filling.

Postconditions:

Definition at line 78 of file Teuchos_ArrayRCP.hpp.

template<class T>
REFCOUNTPTR_INLINE Teuchos::ArrayRCP< T >::ArrayRCP ( const ArrayRCP< T > &  r_ptr  )  [inline]

Initialize from another ArrayRCP<T> object.

After construction, this and r_ptr will reference the same array.

This form of the copy constructor is required even though the below more general templated version is sufficient since some compilers will generate this function automatically which will give an incorrect implementation.

Postconditions:

  • this->get() == r_ptr.get()
  • this->count() == r_ptr.count()
  • this->has_ownership() == r_ptr.has_ownership()
  • If r_ptr.get() != NULL then r_ptr.count() is incremented by 1

Definition at line 138 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE Teuchos::ArrayRCP< T >::~ArrayRCP (  )  [inline]

Removes a reference to a dynamically allocated array and possibly deletes the array if owned.

Deallocates array if this->has_ownership() == true and this->count() == 1. If this->count() == 1 but this->has_ownership() == false then the array is not deleted (usually using delete []). If this->count() > 1 then the internal reference count shared by all the other related ArrayRCP<...> objects for this shared array is deincremented by one. If this->get() == NULL then nothing happens.

Definition at line 148 of file Teuchos_ArrayRCP.hpp.

template<class T>
template<class T>
Teuchos::ArrayRCP< T >::ArrayRCP ( T *  p,
Ordinal  lowerOffset_in,
Ordinal  upperOffset_in,
const RCPNodeHandle node 
) [inline]

Definition at line 709 of file Teuchos_ArrayRCP.hpp.


Member Function Documentation

template<class T>
REFCOUNTPTR_INLINE ArrayRCP< T > & Teuchos::ArrayRCP< T >::operator= ( const ArrayRCP< T > &  r_ptr  )  [inline]

Copy the pointer to the referenced array and increment the reference count.

If this->has_ownership() == true and this->count() == 1 before this operation is called, then the array will be deleted prior to binding to the pointer (possibly NULL) pointed to in r_ptr. Assignment to self (i.e. this->get() == r_ptr.get()) is harmless and this function does nothing.

Postconditions:

  • this->get() == r_ptr.get()
  • this->count() == r_ptr.count()
  • this->has_ownership() == r_ptr.has_ownership()
  • If r_ptr.get() != NULL then r_ptr.count() is incremented by 1

Definition at line 154 of file Teuchos_ArrayRCP.hpp.

template<class T >
bool Teuchos::ArrayRCP< T >::is_null (  )  const [inline]

Returns true if the underlying pointer is null.

Definition at line 173 of file Teuchos_ArrayRCP.hpp.

template<class T >
T * Teuchos::ArrayRCP< T >::operator-> (  )  const [inline]

Pointer (->) access to members of underlying object for current position.

Preconditions:

Definition at line 181 of file Teuchos_ArrayRCP.hpp.

template<class T >
T & Teuchos::ArrayRCP< T >::operator* (  )  const [inline]

Dereference the underlying object for the current pointer position.

Preconditions:

Definition at line 191 of file Teuchos_ArrayRCP.hpp.

template<class T >
T * Teuchos::ArrayRCP< T >::get (  )  const [inline]

Get the raw C++ pointer to the underlying object.

Preconditions:

Definition at line 201 of file Teuchos_ArrayRCP.hpp.

template<class T >
T * Teuchos::ArrayRCP< T >::getRawPtr (  )  const [inline]

Get the raw C++ pointer to the underlying object.

Preconditions:

Definition at line 213 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE T & Teuchos::ArrayRCP< T >::operator[] ( Ordinal  offset  )  const [inline]

Random object access.

Preconditions:

Definition at line 221 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > & Teuchos::ArrayRCP< T >::operator++ (  )  [inline]

Prefix increment of pointer (i.e. ++ptr).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 234 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > Teuchos::ArrayRCP< T >::operator++ ( int   )  [inline]

Postfix increment of pointer (i.e. ptr++).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 248 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > & Teuchos::ArrayRCP< T >::operator-- (  )  [inline]

Prefix deincrement of pointer (i.e. --ptr).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 259 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > Teuchos::ArrayRCP< T >::operator-- ( int   )  [inline]

Postfix deincrement of pointer (i.e. ptr--).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 273 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > & Teuchos::ArrayRCP< T >::operator+= ( Ordinal  offset  )  [inline]

Pointer integer increment (i.e. ptr+=offset).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 284 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > & Teuchos::ArrayRCP< T >::operator-= ( Ordinal  offset  )  [inline]

Pointer integer increment (i.e. ptr-=offset).

Does nothing if this->get() == NULL.

Postconditions:

Definition at line 298 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > Teuchos::ArrayRCP< T >::operator+ ( Ordinal  offset  )  const [inline]

Pointer integer increment (i.e. ptr+offset).

Returns a null pointer if this->get() == NULL.

Postconditions:

Note that since implicit conversion of ArrayRCP<T> objects is not allowed that it does not help at all to make this function into a non-member function.

Definition at line 312 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > Teuchos::ArrayRCP< T >::operator- ( Ordinal  offset  )  const [inline]

Pointer integer deincrement (i.e. ptr-offset).

Returns a null pointer if this->get() == NULL.

Postconditions:

Note that since implicit conversion of ArrayRCP<T> objects is not allowed that it does not help at all to make this function into a non-member function.

Definition at line 322 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T >::const_iterator Teuchos::ArrayRCP< T >::begin (  )  const [inline]

Return an iterator to beginning of the array of data.

If HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is defined then the iterator returned is an ArrayRCP<T> object and all operations are checked at runtime. When HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is not defined, the a raw pointer T* is returned for fast execution.

Postconditions:

  • [this->get()!=NULL] &*return == this->get()
  • [this->get()==NULL] return == (null or NULL)

Definition at line 335 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T >::const_iterator Teuchos::ArrayRCP< T >::end (  )  const [inline]

Return an iterator to past the end of the array of data.

If HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is defined then the iterator returned is an ArrayRCP<T> object and all operations are checked at runtime. When HAVE_TEUCHOS_ARRAY_BOUNDSCHECK is not defined, the a raw pointer T* is returned for fast execution.

Postconditions:

Definition at line 349 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< const T > Teuchos::ArrayRCP< T >::getConst (  )  const [inline]

Return object for only const access to data.

This function should only compile successfully if the type T is not already declared const!

Definition at line 365 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T > Teuchos::ArrayRCP< T >::persistingView ( Ordinal  lowerOffset,
Ordinal  size 
) const [inline]

Return a persisting view of a contiguous range of elements.

Preconditions:

Postconditions:

Definition at line 379 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T >::Ordinal Teuchos::ArrayRCP< T >::lowerOffset (  )  const [inline]

Return the lower offset to valid data.

Definition at line 397 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T >::Ordinal Teuchos::ArrayRCP< T >::upperOffset (  )  const [inline]

Return the upper offset to valid data.

Definition at line 407 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE ArrayRCP< T >::Ordinal Teuchos::ArrayRCP< T >::size (  )  const [inline]

The total number of items in the managed array (i.e. upperOffset()-lowerOffset()+1).

Definition at line 417 of file Teuchos_ArrayRCP.hpp.

template<class T >
ArrayView< T > Teuchos::ArrayRCP< T >::view ( Ordinal  lowerOffset,
Ordinal  size 
) const [inline]

Return view of a contiguous range of elements.

Preconditions:

Postconditions:

Definition at line 428 of file Teuchos_ArrayRCP.hpp.

template<class T >
ArrayView< T > Teuchos::ArrayRCP< T >::operator() ( Ordinal  lowerOffset,
Ordinal  size 
) const [inline]

Return a view of a contiguous range of elements (calls view(offset,size)).

Definition at line 442 of file Teuchos_ArrayRCP.hpp.

template<class T >
ArrayView< T > Teuchos::ArrayRCP< T >::operator() (  )  const [inline]

Return an ArrayView of *this.

NOTE: This will return a null ArrayView if this->size() == 0.

Definition at line 449 of file Teuchos_ArrayRCP.hpp.

template<class T >
Teuchos::ArrayRCP< T >::operator ArrayView< T > (  )  const [inline]

Perform an implicit conversion to a ArrayView<T> (calls operator()()).

Definition at line 461 of file Teuchos_ArrayRCP.hpp.

template<class T >
Teuchos::ArrayRCP< T >::operator ArrayRCP< const T > (  )  const [inline]

Convert from ArrayRCP<T> to ArrayRCP<const T>.

Definition at line 468 of file Teuchos_ArrayRCP.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::assign ( Ordinal  n,
const T &  val 
) [inline]

Resize and assign n elements of val.

size() == n

Definition at line 481 of file Teuchos_ArrayRCP.hpp.

template<class T >
template<class Iter >
void Teuchos::ArrayRCP< T >::assign ( Iter  first,
Iter  last 
) [inline]

Resize and assign to iterator sequence [first, last).

size() == std::distance(first, last)

This will not change the underlying pointer array if the size does not change.

Definition at line 491 of file Teuchos_ArrayRCP.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::deepCopy ( const ArrayView< const T > &  av  )  [inline]

Deep copy the elements from one ArrayView object into this object.

Simply calls assign(av.begin(), av.end())

Definition at line 537 of file Teuchos_ArrayRCP.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::resize ( const Ordinal  n,
const T &  val = T() 
) [inline]

Resize and append new elements if enlarging.

Definition at line 502 of file Teuchos_ArrayRCP.hpp.

template<class T >
void Teuchos::ArrayRCP< T >::clear (  )  [inline]

Resize to zero..

size()==0

Definition at line 527 of file Teuchos_ArrayRCP.hpp.

template<class T >
ERCPStrength Teuchos::ArrayRCP< T >::strength (  )  const [inline]

Strength of the pointer.

Return values:

  • RCP_STRONG: Underlying reference-counted object will be deleted when *this is destroyed if strong_count()==1.
  • RCP_WEAK: Underlying reference-counted object will not be deleted when *this is destroyed if strong_count() > 0.
  • RCP_STRENGTH_INVALID: *this is not strong or weak but is null.

Definition at line 552 of file Teuchos_ArrayRCP.hpp.

template<class T >
bool Teuchos::ArrayRCP< T >::is_valid_ptr (  )  const [inline]

Return if the underlying object pointer is still valid or not.

The underlying object will not be valid if the strong count has gone to zero but the weak count thas not.

NOTE: Null is a valid object pointer. If you want to know if there is a non-null object and it is valid then !is_null() && is_valid_ptr() will be true.

Definition at line 560 of file Teuchos_ArrayRCP.hpp.

template<class T >
int Teuchos::ArrayRCP< T >::strong_count (  )  const [inline]

Return the number of active RCP<> objects that have a "strong" reference to the underlying reference-counted object.

Returns:
If this->get() == NULL then this function returns 0.

Definition at line 570 of file Teuchos_ArrayRCP.hpp.

template<class T >
int Teuchos::ArrayRCP< T >::weak_count (  )  const [inline]

Return the number of active RCP<> objects that have a "weak" reference to the underlying reference-counted object.

Returns:
If this->get() == NULL then this function returns 0.

Definition at line 578 of file Teuchos_ArrayRCP.hpp.

template<class T >
int Teuchos::ArrayRCP< T >::total_count (  )  const [inline]

Total count (strong_count() + weak_count()).

Definition at line 586 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE void Teuchos::ArrayRCP< T >::set_has_ownership (  )  [inline]

Give this and other ArrayRCP<> objects ownership of the underlying referenced array to delete it.

See ~ArrayRCP() above. This function does nothing if this->get() == NULL.

Postconditions:

Definition at line 594 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE bool Teuchos::ArrayRCP< T >::has_ownership (  )  const [inline]

Returns true if this has ownership of object pointed to by this->get() in order to delete it.

See ~ArrayRCP() above.

Returns:
If this->get() == NULL then this function always returns false. Otherwise the value returned from this function depends on which function was called most recently, if any; set_has_ownership() (true) or release() (false).

Definition at line 602 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE T * Teuchos::ArrayRCP< T >::release (  )  [inline]

Release the ownership of the underlying array.

After this function is called then the client is responsible for deleting the returned pointer no matter how many ref_count_ptr<T> objects have a reference to it. If this->get() == NULL, then this call is meaningless.

Note that this function does not have the exact same semantics as does auto_ptr<T>::release(). In auto_ptr<T>::release(), this is set to NULL while here in ArrayRCP<T>:: release() only an ownership flag is set and this still points to the same array. It would be difficult to duplicate the behavior of auto_ptr<T>::release() for this class.

Postconditions:

Returns:
Returns the value of this->get()

Definition at line 610 of file Teuchos_ArrayRCP.hpp.

template<class T >
ArrayRCP< T > Teuchos::ArrayRCP< T >::create_weak (  )  const [inline]

Create a new weak RCP object from another (strong) RCP object.

ToDo: Explain this!

Preconditons:

  • returnVal.is_valid_ptr()==true

Postconditons:

Definition at line 620 of file Teuchos_ArrayRCP.hpp.

template<class T >
ArrayRCP< T > Teuchos::ArrayRCP< T >::create_strong (  )  const [inline]

Create a new strong RCP object from another (weak) RCP object.

ToDo: Explain this!

Preconditons:

  • returnVal.is_valid_ptr()==true

Postconditons:

Definition at line 629 of file Teuchos_ArrayRCP.hpp.

template<class T >
template<class T2 >
REFCOUNTPTR_INLINE bool Teuchos::ArrayRCP< T >::shares_resource ( const ArrayRCP< T2 > &  r_ptr  )  const [inline]

Returns true if the smart pointers share the same underlying reference-counted object.

This method does more than just check if this->get() == r_ptr.get(). It also checks to see if the underlying reference counting machinery is the same.

Definition at line 639 of file Teuchos_ArrayRCP.hpp.

template<class T >
const ArrayRCP< T > & Teuchos::ArrayRCP< T >::assert_not_null (  )  const [inline]

Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.

Definition at line 654 of file Teuchos_ArrayRCP.hpp.

template<class T >
const ArrayRCP< T > & Teuchos::ArrayRCP< T >::assert_in_range ( Ordinal  lowerOffset,
Ordinal  size 
) const [inline]

Throws NullReferenceError if this->get()==NULL orthis->get()!=NULL, throws RangeError if (lowerOffset < this->lowerOffset() || this->upperOffset() < upperOffset, otherwise returns reference to *this.

Definition at line 675 of file Teuchos_ArrayRCP.hpp.

template<class T >
const ArrayRCP< T > & Teuchos::ArrayRCP< T >::assert_valid_ptr (  )  const [inline]

If the object pointer is non-null, assert that it is still valid.

If is_null()==false && strong_count()==0, this will throw DanglingReferenceErorr with a great error message.

If is_null()==true, then this will not throw any exception.

In this context, null is a valid object.

Definition at line 664 of file Teuchos_ArrayRCP.hpp.

template<class T >
REFCOUNTPTR_INLINE int Teuchos::ArrayRCP< T >::count (  )  const [inline]

Returns strong_count() [deprecated].

Definition at line 699 of file Teuchos_ArrayRCP.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::debug_assert_not_null (  )  const [inline, private]

Definition at line 740 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::debug_assert_in_range ( Ordinal  lowerOffset_in,
Ordinal  size_in 
) const [inline, private]

Definition at line 747 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
void Teuchos::ArrayRCP< T >::debug_assert_valid_ptr (  )  const [inline, private]

Definition at line 755 of file Teuchos_ArrayRCPDecl.hpp.


Friends And Related Function Documentation

template<class T >
ArrayRCP< T > arcp ( const RCP< Array< T > > &  v  )  [related]

Wrap an Array<T> object as an ArrayRCP<T> object.

Definition at line 488 of file Teuchos_Array.hpp.

template<class T >
ArrayRCP< const T > arcp ( const RCP< const Array< T > > &  v  )  [related]

Wrap a const Array<T> object as an ArrayRCP<const T> object.

Definition at line 505 of file Teuchos_Array.hpp.

template<class T >
ArrayRCP< T > arcp ( T *  p,
typename ArrayRCP< T >::Ordinal  lowerOffset,
typename ArrayRCP< T >::Ordinal  size,
bool  owns_mem = true 
) [related]

Wraps a preallocated array of data with the assumption to call the array version of delete.

template<class T , class Dealloc_T >
ArrayRCP< T > arcp ( T *  p,
typename ArrayRCP< T >::Ordinal  lowerOffset,
typename ArrayRCP< T >::Ordinal  size,
Dealloc_T  dealloc,
bool  owns_mem 
) [related]

Wraps a preallocated array of data and uses a templated deallocation strategy object to define deletion .

template<class T >
ArrayRCP< T > arcp ( typename ArrayRCP< T >::Ordinal  size  )  [related]

Allocate a new array just given a dimension.

Warning! The memory is allocated using new T[size] and is *not* initialized (unless there is a default constructor for a user-defined type).

When called with 'size == 0' it returns a null ArrayRCP object.

template<class T >
ArrayRCP< T > arcpClone ( const ArrayView< const T > &  v  )  [related]

Allocate a new array by cloning data from an input array view.

template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObjPreDestroy ( T *  p,
typename ArrayRCP< T >::Ordinal  lowerOffset,
typename ArrayRCP< T >::Ordinal  size,
const Embedded &  embedded,
bool  owns_mem = true 
) [related]

Create an ArrayRCP with and also put in an embedded object.

In this case the embedded object is destroyed (by setting to Embedded()) before the object at *p is destroyed.

The embedded object can be extracted using getEmbeddedObj() and getNonconstEmbeddedObject().

template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObjPostDestroy ( T *  p,
typename ArrayRCP< T >::Ordinal  lowerOffset,
typename ArrayRCP< T >::Ordinal  size,
const Embedded &  embedded,
bool  owns_mem = true 
) [related]

Create an ArrayRCP with and also put in an embedded object.

In this case the embedded object is destroyed (by setting to Embedded()) after the object at *p is destroyed.

The embedded object can be extracted using getEmbeddedObj() and getNonconstEmbeddedObject().

template<class T , class Embedded >
ArrayRCP< T > arcpWithEmbeddedObj ( T *  p,
typename ArrayRCP< T >::Ordinal  lowerOffset,
typename ArrayRCP< T >::Ordinal  size,
const Embedded &  embedded,
bool  owns_mem = true 
) [related]

Create an ArrayRCP with and also put in an embedded object.

This function should be called when it is not important when the embedded object is destroyed (by setting to Embedded()) with respect to when *p is destroyed.

The embedded object can be extracted using getEmbeddedObj() and getNonconstEmbeddedObject().

template<class T >
ArrayRCP< T > arcp ( const RCP< std::vector< T > > &  v  )  [related]

Wrap an std::vector<T> object as an ArrayRCP<T> object.

template<class T >
ArrayRCP< const T > arcp ( const RCP< const std::vector< T > > &  v  )  [related]

Wrap a const std::vector<T> object as an ArrayRCP<const T> object.

template<class T >
ArrayRCP< T > arcpFromArrayView ( const ArrayView< T > &  av  )  [related]

Get an ArrayRCP object out of an ArrayView object.

This conversion is required an proper in certain types of situations. In a debug build, a dangling reference will be detected with an exception being thrown.

template<class T >
RCP< std::vector< T > > get_std_vector ( const ArrayRCP< T > &  ptr  )  [related]

Get an std::vector<T> object out of an ArrayRCP<T> object that was created using the arcp() above to wrap the std::vector in the first place..

template<class T >
RCP< const std::vector< T > > get_std_vector ( const ArrayRCP< const T > &  ptr  )  [related]

Get a const std::vector<T> object out of an ArrayRCP<const T> object that was created using the arcp() above to wrap the std::vector in the first place.

template<class T >
bool is_null ( const ArrayRCP< T > &  p  )  [related]

Returns true if p.get()==NULL.

Returns true if av.is_null()==true.

Definition at line 359 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class T >
bool nonnull ( const ArrayRCP< T > &  p  )  [related]

Returns true if p.get()!=NULL.

Definition at line 368 of file Teuchos_ConstNonconstObjectContainer.hpp.

template<class T >
bool operator== ( const ArrayRCP< T > &  p,
ENull   
) [related]

Returns true if p.get()==NULL.

Definition at line 346 of file Teuchos_PtrDecl.hpp.

template<class T >
bool operator!= ( const ArrayRCP< T > &  p,
ENull   
) [related]

Returns true if p.get()!=NULL.

Definition at line 357 of file Teuchos_PtrDecl.hpp.

template<class T >
ArrayRCP< T >::difference_type operator- ( const ArrayRCP< T > &  p1,
const ArrayRCP< T > &  p2 
) [related]

Returns difference of two ArrayRCP object.

template<class T2 , class T1 >
ArrayRCP< T2 > arcp_const_cast ( const ArrayRCP< T1 > &  p1  )  [related]

Const cast of underlying ArrayRCP type from const T* to T*.

The function will compile only if (const_cast<T2*>(p1.get());) compiles.

template<class T2 , class T1 >
ArrayRCP< T2 > arcp_reinterpret_cast ( const ArrayRCP< T1 > &  p1  )  [related]

Reinterpret cast of underlying ArrayRCP type from T1* to T2*.

The function will compile only if (reinterpret_cast<T2*>(p1.get());) compiles.

Warning! Do not use this function unless you absolutely know what you are doing. Doing a reinterpret cast is always a tricking thing and must only be done by developers who are 100% comfortable with what they are doing.

template<class T2 , class T1 >
ArrayRCP< T2 > arcp_implicit_cast ( const ArrayRCP< T1 > &  p1  )  [related]

Implicit case the underlying ArrayRCP type from T1* to T2*.

The function will compile only if (T2 *p = p1.get();) compiles.

Warning! Do not use this function unless you absolutely know what you are doing. While implicit casting of pointers to single objects is usually 100% safe, implicit casting pointers to arrays of objects can be very dangerous. One std::exception that is always safe is when you are implicit casting an array of pointers to non-const objects to an array of const pointers to const objects. For example, the following implicit conversion from a array pointer objects aptr1 of type ArrayRCP<T*> to

 ArrayRCP<const T * const>
 aptr2 = arcp_implicit_cast<const T * const>(ptr1);

is always legal and safe to do.

template<class T1 , class T2 >
void set_extra_data ( const T1 &  extra_data,
const std::string &  name,
const Ptr< ArrayRCP< T2 > > &  p,
EPrePostDestruction  destroy_when = POST_DESTROY,
bool  force_unique = true 
) [related]

Set extra data associated with a ArrayRCP object.

Set extra data associated with a RCP object.

Parameters:
extra_data [in] Data object that will be set (copied)
name [in] The name given to the extra data. The value of name together with the data type T1 of the extra data must be unique from any other such data or the other data will be overwritten.
p [out] On output, will be updated with the input extra_data
destroy_when [in] Determines when extra_data will be destroyed in relation to the underlying reference-counted object. If destroy_when==PRE_DESTROY then extra_data will be deleted before the underlying reference-counted object. If destroy_when==POST_DESTROY (the default) then extra_data will be deleted after the underlying reference-counted object.
force_unique [in] Determines if this type and name pair must be unique in which case if an object with this same type and name already exists, then an std::exception will be thrown. The default is true for safety.

If there is a call to this function with the same type of extra data T1 and same arguments p and name has already been made, then the current piece of extra data already set will be overwritten with extra_data. However, if the type of the extra data T1 is different, then the extra data can be added and not overwrite existing extra data. This means that extra data is keyed on both the type and name. This helps to minimize the chance that clients will unexpectedly overwrite data by accident.

When the last RefcountPtr object is removed and the reference-count node is deleted, then objects are deleted in the following order: (1) All of the extra data that where added with destroy_when==PRE_DESTROY are first, (2) then the underlying reference-counted object is deleted, and (3) the rest of the extra data that was added with destroy_when==PRE_DESTROY is then deleted. The order in which the objects are destroyed is not guaranteed. Therefore, clients should be careful not to add extra data that has deletion dependencies (instead consider using nested ArrayRCP objects as extra data which will guarantee the order of deletion).

Preconditions:

  • p->get() != NULL (throws NullReferenceError)
  • If this function has already been called with the same template type T1 for extra_data and the same std::string name and force_unique==true, then an std::invalid_argument std::exception will be thrown.

Note, this function is made a non-member function to be consistent with the non-member get_extra_data() functions.

Parameters:
extra_data [in] Data object that will be set (copied)
name [in] The name given to the extra data. The value of name together with the data type T1 of the extra data must be unique from any other such data or the other data will be overwritten.
p [out] On output, will be updated with the input extra_data
destroy_when [in] Determines when extra_data will be destroyed in relation to the underlying reference-counted object. If destroy_when==PRE_DESTROY then extra_data will be deleted before the underlying reference-counted object. If destroy_when==POST_DESTROY (the default) then extra_data will be deleted after the underlying reference-counted object.
force_unique [in] Determines if this type and name pair must be unique in which case if an object with this same type and name already exists, then an std::exception will be thrown. The default is true for safety.

If there is a call to this function with the same type of extra data T1 and same arguments p and name has already been made, then the current piece of extra data already set will be overwritten with extra_data. However, if the type of the extra data T1 is different, then the extra data can be added and not overwrite existing extra data. This means that extra data is keyed on both the type and name. This helps to minimize the chance that clients will unexpectedly overwrite data by accident.

When the last RefcountPtr object is removed and the reference-count node is deleted, then objects are deleted in the following order: (1) All of the extra data that where added with destroy_when==PRE_DESTROY are first, (2) then the underlying reference-counted object is deleted, and (3) the rest of the extra data that was added with destroy_when==PRE_DESTROY is then deleted. The order in which the objects are destroyed is not guaranteed. Therefore, clients should be careful not to add extra data that has deletion dependancies (instead consider using nested RCP objects as extra data which will guarantee the order of deletion).

Preconditions:

  • p->get() != NULL (throws NullReferenceError)
  • If this function has already been called with the same template type T1 for extra_data and the same std::string name and force_unique==true, then an std::invalid_argument std::exception will be thrown.

Note, this function is made a non-member function to be consistent with the non-member get_extra_data() functions.

template<class T1 , class T2 >
T1 & get_extra_data ( ArrayRCP< T2 > &  p,
const std::string &  name 
) [related]

Get a non-const reference to extra data associated with a ArrayRCP object.

Parameters:
p [in] Smart pointer object that extra data is being extracted from.
name [in] Name of the extra data.
Returns:
Returns a non-const reference to the extra_data object.

Preconditions:

Note, this function must be a non-member function since the client must manually select the first template argument.

template<class T1 , class T2 >
const T1 & get_extra_data ( const ArrayRCP< T2 > &  p,
const std::string &  name 
) [related]

Get a const reference to extra data associated with a ArrayRCP object.

Get a const reference to extra data associated with a RCP object.

Parameters:
p [in] Smart pointer object that extra data is being extracted from.
name [in] Name of the extra data.
Returns:
Returns a const reference to the extra_data object.

Preconditions:

Note, this function must be a non-member function since the client must manually select the first template argument.

Also note that this const version is a false sense of security since a client can always copy a const ArrayRCP object into a non-const object and then use the non-const version to change the data. However, its presence will help to avoid some types of accidental changes to this extra data.

Parameters:
p [in] Smart pointer object that extra data is being extraced from.
name [in] Name of the extra data.
Returns:
Returns a const reference to the extra_data object.

Preconditions:

Note, this function must be a non-member function since the client must manually select the first template argument.

template<class T1 , class T2 >
T1 * get_optional_extra_data ( ArrayRCP< T2 > &  p,
const std::string &  name 
) [related]

Get a pointer to non-const extra data (if it exists) associated with a ArrayRCP object.

Parameters:
p [in] Smart pointer object that extra data is being extracted from.
name [in] Name of the extra data.
Returns:
Returns a non-const pointer to the extra_data object.

Preconditions:

Postconditions:

  • If name and T1 have been used in a previous call to set_extra_data() then return !=NULL and otherwise return == NULL.

Note, this function must be a non-member function since the client must manually select the first template argument.

template<class T1 , class T2 >
Ptr< const T1 > get_optional_extra_data ( const ArrayRCP< T2 > &  p,
const std::string &  name 
) [related]

Get a pointer to const extra data (if it exists) associated with a ArrayRCP object.

Get a pointer to const extra data (if it exists) associated with a RCP object.

Parameters:
p [in] Smart pointer object that extra data is being extracted from.
name [in] Name of the extra data.
Returns:
Returns a const pointer to the extra_data object if it exists.

Preconditions:

Postconditions:

  • If name and T1 have been used in a previous call to set_extra_data() then return !=NULL and otherwise return == NULL.

Note, this function must be a non-member function since the client must manually select the first template argument.

Also note that this const version is a false sense of security since a client can always copy a const ArrayRCP object into a non-const object and then use the non-const version to change the data. However, its presence will help to avoid some types of accidental changes to this extra data.

Parameters:
p [in] Smart pointer object that extra data is being extraced from.
name [in] Name of the extra data.
Returns:
Returns a const pointer to the extra_data object if it exists.

Preconditions:

Postconditions:

  • If name and T1 have been used in a previous call to set_extra_data() then return !=NULL and otherwise return == NULL.

Note, this function must be a non-member function since the client must manually select the first template argument.

template<class Dealloc_T , class T >
Dealloc_T & get_nonconst_dealloc ( const ArrayRCP< T > &  p  )  [related]

Return a non-const reference to the underlying deallocator object.

Preconditions:

Preconditions:

template<class Dealloc_T , class T >
const Dealloc_T & get_dealloc ( const ArrayRCP< T > &  p  )  [related]

Return a const reference to the underlying deallocator object.

Preconditions:

Note that the const version of this function provides only a very ineffective attempt to avoid accidental changes to the deallocation object. A client can always just create a new non-const ArrayRCP<T> object from any const ArrayRCP<T> object and then call the non-const version of this function.

Preconditions:

template<class Dealloc_T , class T >
Ptr< const Dealloc_T > get_optional_dealloc ( const ArrayRCP< T > &  p  )  [related]

Return a pointer to the underlying non-const deallocator object if it exists.

Return a pointer to the underlying const deallocator object if it exists.

Preconditions:

Postconditions:

  • If the deallocator object type used to construct p is same as Dealloc_T then return!=NULL, otherwise return==NULL

Preconditions:

Postconditions:

  • If the deallocator object type used to construct p is same as Dealloc_T then return!=NULL, otherwise return==NULL
template<class Dealloc_T , class T >
Ptr< Dealloc_T > get_optional_nonconst_dealloc ( const ArrayRCP< T > &  p  )  [related]

Return a pointer to the underlying const deallocator object if it exists.

Return a pointer to the underlying non-const deallocator object if it exists.

Preconditions:

Postconditions:

  • If the deallocator object type used to construct p is same as Dealloc_T then return!=NULL, otherwise return==NULL

Note that the const version of this function provides only a very ineffective attempt to avoid accidental changes to the deallocation object. A client can always just create a new non-const ArrayRCP<T> object from any const ArrayRCP<T> object and then call the non-const version of this function.

Preconditions:

Postconditions:

  • If the deallocator object type used to construct p is same as Dealloc_T then return!=NULL, otherwise return==NULL
template<class TOrig , class Embedded , class T >
const Embedded & getEmbeddedObj ( const ArrayRCP< T > &  p  )  [related]

Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj().

Get a const reference to an embedded object that was set by calling rcpWithEmbeddedObjPreDestroy(), rcpWithEmbeddedObjPostDestory(), or rcpWithEmbeddedObj().

template<class TOrig , class Embedded , class T >
Embedded & getNonconstEmbeddedObj ( const ArrayRCP< T > &  p  )  [related]

Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj().

Get a non-const reference to an embedded object that was set by calling rcpWithEmbeddedObjPreDestroy(), rcpWithEmbeddedObjPostDestory(), or rcpWithEmbeddedObj().


Member Data Documentation

template<class T>
T* Teuchos::ArrayRCP< T >::ptr_ [private]

Definition at line 735 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
RCPNodeHandle Teuchos::ArrayRCP< T >::node_ [private]

Definition at line 736 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
Ordinal Teuchos::ArrayRCP< T >::lowerOffset_ [private]

Definition at line 737 of file Teuchos_ArrayRCPDecl.hpp.

template<class T>
Ordinal Teuchos::ArrayRCP< T >::upperOffset_ [private]

Definition at line 738 of file Teuchos_ArrayRCPDecl.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Tue Oct 20 10:14:03 2009 for Teuchos Package Browser (Single Doxygen Collection) by  doxygen 1.6.1