|
Teuchos - Trilinos Tools Package Version of the Day
|
Full specialization of ArrayRCP for T = void. More...
#include <Teuchos_ArrayRCPDecl.hpp>
Public Types | |
| typedef void * | pointer |
Public typedefs | |
| typedef void & | reference |
| Type of a (nonconstant) reference to an array element. | |
| typedef const void & | const_reference |
| Type of a (constant) reference to an array element. | |
| typedef void * | iterator |
| Nonconstant iterator type used if bounds checking is disabled. | |
| typedef const void * | const_iterator |
| Constant iterator type used if bounds checking is disabled. | |
Public Member Functions | |
| ArrayRCP () | |
| Default constructor; thows an exception. | |
Constructors/Destructors/Initializers | |
| ~ArrayRCP () | |
| Destructor, that decrements the reference count. | |
| ArrayRCP< void > & | operator= (const ArrayRCP< void > &r_ptr) |
| Assignment operator: Makes *this reference the input array. | |
Object/Pointer Access Functions | |
| void * | operator-> () const |
| Pointer (->) access to members of underlying object for current position. | |
| void & | operator* () const |
| Dereference the underlying object for the current pointer position. | |
| void * | get () const |
| Get the raw C++ pointer to the underlying object. | |
| void * | getRawPtr () const |
| Get the raw C++ pointer to the underlying object. | |
| void & | operator[] (size_type offset) const |
| Random object access. | |
Pointer Arithmetic Functions | |
| ArrayRCP< void > & | operator++ () |
| Prefix increment of pointer (i.e. ++ptr). | |
| ArrayRCP< void > & | operator-- () |
| Prefix decrement of pointer (i.e. –ptr). | |
| ArrayRCP< void > & | operator+= (size_type offset) |
| Pointer integer increment (i.e. ptr+=offset). | |
| ArrayRCP< void > & | operator-= (size_type offset) |
| Pointer integer increment (i.e. ptr-=offset). | |
| ArrayRCP< void > | operator+ (size_type offset) const |
| Pointer integer increment (i.e. ptr+offset). | |
Standard Container-Like Functions | |
| iterator | begin () const |
| Return an iterator to beginning of the array of data. | |
| iterator | end () const |
| Return an iterator to past the end of the array of data. | |
ArrayRCP Views | |
| ArrayRCP< const void > | getConst () const |
| Return object for only const access to data. | |
| ArrayRCP< void > | persistingView (size_type lowerOffset, size_type size) const |
| Return a persisting view of a contiguous range of elements. | |
Size and extent query functions | |
| size_type | lowerOffset () const |
| Return the lower offset to valid data. | |
| size_type | upperOffset () const |
| Return the upper offset to valid data. | |
| size_type | size () const |
| The total number of entries in the array. | |
ArrayView views | |
| ArrayView< void > | view (size_type lowerOffset, size_type size) const |
| Return a nonpersisting view of a contiguous range of elements. | |
| ArrayView< void > | operator() (size_type lowerOffset, size_type size) const |
| Return a nonpersisting view of a contiguous range of elements. | |
Implicit conversions | |
| operator ArrayRCP< const void > () const | |
| Convert from ArrayRCP<T> to ArrayRCP<const T>. | |
std::vector like and other misc functions | |
| void | assign (size_type n, const void &val) |
| Resize and assign n elements of val. | |
| void | deepCopy (const ArrayView< const void > &av) |
| Deep copy the elements from one ArrayView object into this object. | |
| void | resize (const size_type n, const void &val=void()) |
| Resize and append new elements if necessary. | |
| void | clear () |
| Resize to zero. | |
Reference counting | |
| ERCPStrength | strength () const |
| Strength of the pointer. | |
| bool | is_valid_ptr () const |
| Return whether the underlying object pointer is still valid. | |
| 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 deallocate it. | |
| void * | release () |
| Release the ownership of the underlying array. | |
| ArrayRCP< void > | create_weak () const |
| Create a new weak reference from another (strong) reference. | |
| ArrayRCP< void > | create_strong () const |
| Create a new strong RCP object from another (weak) RCP object. | |
| bool | shares_resource (const ArrayRCP< T2 > &r_ptr) const |
| Returns true if the smart pointers share the same underlying reference-counted object. | |
Related Symbols | |
(Note that these are not member symbols.) | |
| ArrayRCP< void > | arcp (const RCP< Array< void > > &v) |
| Wrap an RCP<Array<T> > object as an ArrayRCP<T> object. | |
| ArrayRCP< const void > | arcp (const RCP< const Array< void > > &v) |
| Wrap a RCP<const Array<T> > object as an ArrayRCP<const T> object. | |
| ArrayRCP< void > | arcpFromArray (Array< void > &a) |
| Wrap an Array<T> object as a non-owning ArrayRCP<T> object. | |
| ArrayRCP< const void > | arcpFromArray (const Array< void > &a) |
| Wrap a const Array<T> object as a non-owning ArrayRCP<T> object. | |
| ArrayRCP< void > | arcp (void *p, typename ArrayRCP< void >::size_type lowerOffset, typename ArrayRCP< void >::size_type size, bool owns_mem=true) |
| Wraps a preallocated array of data with the assumption to call the array version of delete. | |
| ArrayRCP< void > | arcp (void *p, typename ArrayRCP< void >::size_type lowerOffset, typename ArrayRCP< void >::size_type size, Dealloc_T dealloc, bool owns_mem) |
| Wraps a preallocated array of data and uses a templated deallocation strategy object to define deletion . | |
| ArrayRCP< void > | arcp (typename ArrayRCP< void >::size_type size) |
| Allocate a new array just given a dimension. | |
| ArrayRCP< void > | arcpCloneNode (const ArrayRCP< void > &a) |
| Allocate a new ArrayRCP object with a new RCPNode with memory pointing to the initial node. | |
| ArrayRCP< void > | arcpClone (const ArrayView< const void > &v) |
| Allocate a new array by cloning data from an input array view. | |
| ArrayRCP< void > | arcpWithEmbeddedObjPreDestroy (void *p, typename ArrayRCP< void >::size_type lowerOffset, typename ArrayRCP< void >::size_type size, const Embedded &embedded, bool owns_mem=true) |
| Create an ArrayRCP with and also put in an embedded object. | |
| ArrayRCP< void > | arcpWithEmbeddedObjPostDestroy (void *p, typename ArrayRCP< void >::size_type lowerOffset, typename ArrayRCP< void >::size_type size, const Embedded &embedded, bool owns_mem=true) |
| Create an ArrayRCP with and also put in an embedded object. | |
| ArrayRCP< void > | arcpWithEmbeddedObj (void *p, typename ArrayRCP< void >::size_type lowerOffset, typename ArrayRCP< void >::size_type size, const Embedded &embedded, bool owns_mem=true) |
| Create an ArrayRCP with and also put in an embedded object. | |
| ArrayRCP< void > | arcp (const RCP< std::vector< void > > &v) |
| Wrap an std::vector<T> object as an ArrayRCP<T> object. | |
| ArrayRCP< const void > | arcp (const RCP< const std::vector< void > > &v) |
| Wrap a const std::vector<T> object as an ArrayRCP<const T> object. | |
| ArrayRCP< void > | arcpFromArrayView (const ArrayView< void > &av) |
| Get an ArrayRCP object out of an ArrayView object. | |
| RCP< std::vector< void > > | get_std_vector (const ArrayRCP< void > &ptr) |
| Get an std::vector<T> object out of an ArrayRCP<T> object that was created using the arcp() function above to wrap the std::vector in the first place.. | |
| RCP< const std::vector< void > > | get_std_vector (const ArrayRCP< const void > &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. | |
| bool | is_null (const ArrayRCP< void > &p) |
| Returns true if p.get()==NULL. | |
| bool | nonnull (const ArrayRCP< void > &p) |
| Returns true if p.get()!=NULL. | |
| bool | operator== (const ArrayRCP< void > &p, ENull) |
| Returns true if p.get()==NULL. | |
| bool | operator!= (const ArrayRCP< void > &p, ENull) |
| Returns true if p.get()!=NULL. | |
| bool | operator== (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare two ArrayRCP objects for equality (by pointers). | |
| bool | operator!= (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare two ArrayRCP objects for inequality (by pointers). | |
| bool | operator< (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare the two ArrayRCP objects' pointers using <. | |
| bool | operator<= (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare the two ArrayRCP objects' pointers using <=. | |
| bool | operator> (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare the two ArrayRCP objects' pointers using >. | |
| bool | operator>= (const ArrayRCP< T1 > &p1, const ArrayRCP< T2 > &p2) |
| Compare the two ArrayRCP objects' pointers using >=. | |
| ArrayRCP< void >::difference_type | operator- (const ArrayRCP< void > &p1, const ArrayRCP< void > &p2) |
| Return the difference of two ArrayRCP objects. | |
| ArrayRCP< T2 > | arcp_const_cast (const ArrayRCP< T1 > &p1) |
| Const cast of underlying ArrayRCP type from const T* to T*. | |
| ArrayRCP< T2 > | arcp_reinterpret_cast (const ArrayRCP< T1 > &p1) |
| Reinterpret cast of underlying ArrayRCP type from T1* to T2*. | |
| ArrayRCP< T2 > | arcp_reinterpret_cast_nonpod (const ArrayRCP< T1 > &p1, const T2 &val=T2()) |
| Reinterpret cast of underlying ArrayRCP type from T1* to T2* where T2 is a non-POD (non-plain-old-data). | |
| ArrayRCP< T2 > | arcp_implicit_cast (const ArrayRCP< T1 > &p1) |
| Implicit case the underlying ArrayRCP type from T1* to 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. | |
| T1 & | get_extra_data (ArrayRCP< T2 > &p, const std::string &name) |
| Get a non-const reference to extra data associated with a ArrayRCP object. | |
| 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. | |
| 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. | |
| 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. | |
| Dealloc_T & | get_nonconst_dealloc (const ArrayRCP< void > &p) |
| Return a non-const reference to the underlying deallocator object. | |
| const Dealloc_T & | get_dealloc (const ArrayRCP< void > &p) |
| Return a const reference to the underlying deallocator object. | |
| const Dealloc_T * | get_optional_dealloc (const ArrayRCP< void > &p) |
| Return a pointer to the underlying non-const deallocator object if it exists. | |
| Dealloc_T * | get_optional_nonconst_dealloc (const ArrayRCP< void > &p) |
| Return a pointer to the underlying const deallocator object if it exists. | |
| const Embedded & | getEmbeddedObj (const ArrayRCP< void > &p) |
| Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj(). | |
| Embedded & | getNonconstEmbeddedObj (const ArrayRCP< void > &p) |
| Get a const reference to an embedded object that was set by calling arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj(). | |
| std::ostream & | operator<< (std::ostream &out, const ArrayRCP< void > &p) |
| Output stream inserter. | |
Assertion Functions. | |
| const ArrayRCP< void > & | assert_not_null () const |
| Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this. | |
| const ArrayRCP< void > & | assert_in_range (size_type lowerOffset, size_type 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< void > & | assert_valid_ptr () const |
| If the object pointer is non-null, assert that it is still valid. | |
Full specialization of ArrayRCP for T = void.
The generic implementation of ArrayRCP<T> does not make syntactic sense for T = void, because the reference and const_reference typedefs would resolve to the invalid "types" void& resp. const void&. This full template specialization ArrayRCP<void> neglects these invalid "types."
Definition at line 948 of file Teuchos_ArrayRCPDecl.hpp.
| typedef void* Teuchos::ArrayRCP< void >::pointer |
Definition at line 960 of file Teuchos_ArrayRCPDecl.hpp.
| typedef void& Teuchos::ArrayRCP< void >::reference |
Type of a (nonconstant) reference to an array element.
Definition at line 118 of file Teuchos_ArrayRCPDecl.hpp.
| typedef const void& Teuchos::ArrayRCP< void >::const_reference |
Type of a (constant) reference to an array element.
Definition at line 121 of file Teuchos_ArrayRCPDecl.hpp.
| typedef void* Teuchos::ArrayRCP< void >::iterator |
Nonconstant iterator type used if bounds checking is disabled.
Definition at line 139 of file Teuchos_ArrayRCPDecl.hpp.
| typedef const void* Teuchos::ArrayRCP< void >::const_iterator |
Constant iterator type used if bounds checking is disabled.
Definition at line 141 of file Teuchos_ArrayRCPDecl.hpp.
|
inline |
Default constructor; thows an exception.
Definition at line 1217 of file Teuchos_ArrayRCP.hpp.
|
inline |
Destructor, that decrements the reference count.
If this->get() == NULL then the destructor does nothing. Otherwise, it decrements the reference count of this and all other references to the array. If the final reference count is zero, it also deallocates the array if owned (i.e., if this->has_ownership() returns true). Deallocation uses the custom deallocator if one was supplied; otherwise it uses delete [].
Definition at line 259 of file Teuchos_ArrayRCP.hpp.
|
inline |
Assignment operator: Makes *this reference the input array.
If the input array is a reference to *this (that is, if this->getRawPtr() == r_ptr.getRawPtr()), then this method does nothing. Otherwise, it does the following:
For example, after the following sample code is done, the array to which x originally pointed on construction will have reference count 2, and the array to which y originally pointed on constructor will have reference count 0 (and will thus be deallocated).
Definition at line 288 of file Teuchos_ArrayRCP.hpp.
|
inline |
Pointer (->) access to members of underlying object for current position.
Definition at line 304 of file Teuchos_ArrayRCP.hpp.
|
inline |
Dereference the underlying object for the current pointer position.
Definition at line 313 of file Teuchos_ArrayRCP.hpp.
|
inline |
Get the raw C++ pointer to the underlying object.
Definition at line 320 of file Teuchos_ArrayRCP.hpp.
|
inline |
Get the raw C++ pointer to the underlying object.
Definition at line 327 of file Teuchos_ArrayRCP.hpp.
|
inline |
Random object access.
Definition at line 334 of file Teuchos_ArrayRCP.hpp.
|
inline |
Prefix increment of pointer (i.e. ++ptr).
Does nothing if this->get() == NULL.
Definition at line 348 of file Teuchos_ArrayRCP.hpp.
|
inline |
Prefix decrement of pointer (i.e. –ptr).
Does nothing if this->get() == NULL.
Definition at line 368 of file Teuchos_ArrayRCP.hpp.
|
inline |
Pointer integer increment (i.e. ptr+=offset).
Does nothing if this->get() == NULL.
Definition at line 388 of file Teuchos_ArrayRCP.hpp.
|
inline |
Pointer integer increment (i.e. ptr-=offset).
Does nothing if this->get() == NULL.
Definition at line 398 of file Teuchos_ArrayRCP.hpp.
|
inline |
Pointer integer increment (i.e. ptr+offset).
Returns a null pointer if this->get() == NULL.
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 412 of file Teuchos_ArrayRCP.hpp.
|
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.
Definition at line 442 of file Teuchos_ArrayRCP.hpp.
|
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.
Definition at line 454 of file Teuchos_ArrayRCP.hpp.
|
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 465 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return a persisting view of a contiguous range of elements.
Definition at line 480 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return the lower offset to valid data.
Definition at line 487 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return the upper offset to valid data.
Definition at line 490 of file Teuchos_ArrayRCP.hpp.
|
inline |
The total number of entries in the array.
x.upperOffset() - x.lowerOffset() + 1 == x.size() for any ArrayRCP x.
Definition at line 496 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return a nonpersisting view of a contiguous range of elements.
Definition at line 515 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return a nonpersisting view of a contiguous range of elements.
This is equivalent to calling view (offset, size).
Definition at line 521 of file Teuchos_ArrayRCP.hpp.
|
inline |
Convert from ArrayRCP<T> to ArrayRCP<const T>.
Definition at line 539 of file Teuchos_ArrayRCP.hpp.
|
inline |
Resize and assign n elements of val.
\postconditions size() == n
Definition at line 549 of file Teuchos_ArrayRCP.hpp.
|
inline |
Deep copy the elements from one ArrayView object into this object.
This is equivalent to calling assign (av.begin (), av.end ())
Definition at line 566 of file Teuchos_ArrayRCP.hpp.
|
inline |
Resize and append new elements if necessary.
Definition at line 569 of file Teuchos_ArrayRCP.hpp.
|
inline |
|
inline |
Strength of the pointer.
Return values:
Definition at line 592 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return whether the underlying object pointer is still valid.
The underlying object will not be valid if the strong count has gone to zero but the weak count has 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 603 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return the number of active RCP<> objects that have a "strong" reference to the underlying reference-counted object.
Definition at line 610 of file Teuchos_ArrayRCP.hpp.
|
inline |
Return the number of active RCP<> objects that have a "weak" reference to the underlying reference-counted object.
Definition at line 617 of file Teuchos_ArrayRCP.hpp.
|
inline |
Total count (strong_count() + weak_count()).
Definition at line 620 of file Teuchos_ArrayRCP.hpp.
|
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 639 of file Teuchos_ArrayRCP.hpp.
|
inline |
Returns true if this has ownership of object pointed to by this->get() in order to deallocate it.
See the above documentation for the destructor.
Definition at line 652 of file Teuchos_ArrayRCP.hpp.
|
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:
Definition at line 674 of file Teuchos_ArrayRCP.hpp.
|
inline |
Create a new weak reference from another (strong) reference.
A "weak" reference gives access to the array, without incrementing its (strong) reference count. This lets you have access to the array, without affecting when it gets deallocated.
Definition at line 690 of file Teuchos_ArrayRCP.hpp.
|
inline |
Create a new strong RCP object from another (weak) RCP object.
A "weak" reference gives access to the array, without incrementing its (strong) reference count. This method lets you "promote" a weak reference into a strong reference. If the array has been deallocated, the returned reference is null.
Definition at line 707 of file Teuchos_ArrayRCP.hpp.
|
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 716 of file Teuchos_ArrayRCP.hpp.
|
inline |
Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
Definition at line 725 of file Teuchos_ArrayRCP.hpp.
|
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 732 of file Teuchos_ArrayRCP.hpp.
|
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 743 of file Teuchos_ArrayRCP.hpp.
Wrap an RCP<Array<T> > object as an ArrayRCP<T> object.
Definition at line 512 of file Teuchos_Array.hpp.
Wrap a RCP<const Array<T> > object as an ArrayRCP<const T> object.
Definition at line 529 of file Teuchos_Array.hpp.
Wrap an Array<T> object as a non-owning ArrayRCP<T> object.
Definition at line 546 of file Teuchos_Array.hpp.
Wrap a const Array<T> object as a non-owning ArrayRCP<T> object.
Definition at line 564 of file Teuchos_Array.hpp.
|
Wraps a preallocated array of data with the assumption to call the array version of delete.
|
Wraps a preallocated array of data and uses a templated deallocation strategy object to define deletion .
Allocate a new ArrayRCP object with a new RCPNode with memory pointing to the initial node.
The purpose of this function is to create a new "handle" to the array of memory with its own seprate reference count. The new ArrayRCP object will have a new RCPNodeTmpl object that has a copy of the input ArrayRCP object embedded in it. This maintains the correct reference counting behaviors but now gives a private count. One would want to use arcpCloneNode(...) whenever it is important to keep a private reference count which is needed for some types of use cases.
Allocate a new array by cloning data from an input array view.
|
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().
|
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().
|
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().
Wrap an std::vector<T> object as an ArrayRCP<T> object.
Wrap a const std::vector<T> object as an ArrayRCP<const T> object.
Get an std::vector<T> object out of an ArrayRCP<T> object that was created using the arcp() function above to wrap the std::vector in the first place..
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.
|
Returns true if p.get()==NULL.
|
Returns true if p.get()!=NULL.
|
Returns true if p.get()==NULL.
|
Returns true if p.get()!=NULL.
Compare two ArrayRCP objects for equality (by pointers).
Compare two ArrayRCP objects for inequality (by pointers).
Compare the two ArrayRCP objects' pointers using <.
Compare the two ArrayRCP objects' pointers using <=.
Compare the two ArrayRCP objects' pointers using >.
Compare the two ArrayRCP objects' pointers using >=.
Const cast of underlying ArrayRCP type from const T* to T*.
The function will compile only if the following code compiles:
Reinterpret cast of underlying ArrayRCP type from T1* to T2*.
The function will compile only if the following code compiles:
Reinterpret cast of underlying ArrayRCP type from T1* to T2* where T2 is a non-POD (non-plain-old-data).
The function will compile only if (reinterpret_cast<T2*>(p1.get());) compiles.
This function is used to reinterpret-cast an array of plain-old-data (POD) (e.g. int or char) into an array of objects of type T2, which is not a plain-old-data type. The constructors will be called on each of the memory locations with placement new and the destructors will get called when the last ArrayRCP goes away.
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
is always legal and safe to do.
|
Set extra data associated with a ArrayRCP object.
| 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:
Note, this function is made a non-member function to be consistent with the non-member get_extra_data() functions.
|
Get a non-const reference to extra data associated with a ArrayRCP object.
| p | [in] Smart pointer object that extra data is being extracted from. |
| name | [in] Name of the extra data. |
Preconditions:
Note, this function must be a non-member function since the client must manually select the first template argument.
|
Get a const reference to extra data associated with a ArrayRCP object.
| p | [in] Smart pointer object that extra data is being extracted from. |
| name | [in] Name of the extra data. |
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.
|
Get a pointer to non-const extra data (if it exists) associated with a ArrayRCP object.
| p | [in] Smart pointer object that extra data is being extracted from. |
| name | [in] Name of the extra data. |
Preconditions:
Postconditions:
Note, this function must be a non-member function since the client must manually select the first template argument.
|
Get a pointer to const extra data (if it exists) associated with a ArrayRCP object.
| p | [in] Smart pointer object that extra data is being extracted from. |
| name | [in] Name of the extra data. |
Preconditions:
Postconditions:
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.
|
Return a non-const reference to the underlying deallocator object.
Preconditions:
|
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.
|
Return a pointer to the underlying non-const deallocator object if it exists.
Preconditions:
Postconditions:
|
Return a pointer to the underlying const deallocator object if it exists.
Preconditions:
Postconditions:
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.
|
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 arcpWithEmbeddedObjPreDestroy(), arcpWithEmbeddedObjPostDestory(), or arcpWithEmbeddedObj().
|
Output stream inserter.
The implementation of this function just print pointer addresses and therefore puts not restrictions on the data types involved.