42 #ifndef TEUCHOS_ARRAY_VIEW_HPP 43 #define TEUCHOS_ARRAY_VIEW_HPP 57 template<
class T>
inline 64 template<
class T>
inline 73 template<
class T>
inline 77 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 84 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 87 template<
class T>
inline 91 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 98 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 102 template<
class T>
inline 105 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
110 template<
class T>
inline 113 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK
119 template<
class T>
inline 128 template<
class T>
inline 138 template<
class T>
inline 147 template<
class T>
inline 157 template<
class T>
inline 162 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 168 template<
class T>
inline 173 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 180 template<
class T>
inline 184 template<
class T>
inline 207 template<
class T>
inline 214 template<
class T>
inline 226 std::ostringstream ss;
234 if (i + 1 < size ()) {
246 std::ostringstream ss;
254 if (i + 1 < size ()) {
291 template<
class T>
inline 298 template<
class T>
inline 306 template<
class T>
inline 314 template<
class T>
inline 323 template<
class T>
inline 331 template<
class T>
inline 339 template<
class T>
inline 347 template<
class T>
inline 359 template<
class T>
inline 367 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 368 return arcp_(offset, size_in);
375 template<
class T>
inline 383 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 384 return arcp_(offset, size_in);
392 template<
class T>
inline 395 return view(offset, size_in);
398 template<
class T>
inline 401 return view(offset, size_in);
405 template<
class T>
inline 412 template<
class T>
inline 420 template<
class T>
inline 424 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 425 return arcp_.getConst()();
430 template<
class T>
inline 436 template<
class T>
inline 467 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 468 return arcp_.create_weak();
478 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 479 return arcp_.create_weak();
490 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 491 return arcp_.create_weak() +
size_;
501 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 502 return arcp_.create_weak() +
size_;
516 throw_null_ptr_error(
typeName(*
this));
524 throw_null_ptr_error(
typeName(*
this));
535 "Error, size=0 is not allowed!" );
538 ( 0 <= offset && offset+size_in <= this->
size() )
543 typeName(*
this)<<
"::assert_in_range():" 544 " Error, [offset,offset+size) = ["<<offset<<
","<<(offset+size_in)<<
")" 545 " does not lie in the range [0,"<<this->
size()<<
")!" 556 "Error, size=0 is not allowed!" );
559 ( 0 <= offset && offset+size_in <= this->
size() )
564 typeName(*
this)<<
"::assert_in_range():" 565 " Error, [offset,offset+size) = ["<<offset<<
","<<(offset+size_in)<<
")" 566 " does not lie in the range [0,"<<this->
size()<<
")!" 572 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 596 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 605 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 606 if (
ptr_ && arcp_.is_null()) {
610 (void) rcpNodeLookup;
611 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 617 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 618 if (
ptr_ && arcp_.is_null()) {
622 (void) rcpNodeLookup;
623 #endif // HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 635 template<
class T>
inline 645 template<
class T>
inline 654 template<
class T>
inline 665 template<
class T>
inline 666 std::vector<T> Teuchos::createVector(
const ArrayView<T> &av )
668 std::vector<T> v(av.
begin(), av.
end());
675 template<
class T>
inline 678 std::vector<T> v(av.
begin(), av.
end());
683 template<
class T>
inline 690 template<
class T>
inline 698 std::ostream& Teuchos::operator<<( std::ostream& out, const ArrayView<T>& p )
700 return out << p.toString();
704 template<
class T2,
class T1>
709 T2 *ptr2 =
const_cast<T2*
>(p1.
getRawPtr());
715 template<
class T2,
class T1>
721 const int sizeOfT1 =
sizeof(T1);
722 const int sizeOfT2 =
sizeof(T2);
723 size_type size2 = (p1.
size()*sizeOfT1) / sizeOfT2;
724 T2 *ptr2 =
reinterpret_cast<T2*
>(p1.
getRawPtr());
727 #ifdef HAVE_TEUCHOS_ARRAY_BOUNDSCHECK 728 ,arcp_reinterpret_cast<T2>(p1.access_private_arcp())
735 #endif // TEUCHOS_ARRAY_VIEW_HPP
std::string toString() const
Convert an ArrayView<T> to an std::string
void setUpIterators(const ERCPNodeLookup rcpNodeLookup=RCP_ENABLE_NODE_LOOKUP)
T & front() const
Get the first element.
std::string typeName(const T &t)
Template function for returning the concrete type name of a passed-in object.
bool is_null(const boost::shared_ptr< T > &p)
Returns true if p.get()==NULL.
pointer iterator
Type of a nonconst iterator.
bool is_null() const
Returns true if the underlying pointer is null.
const ArrayView< T > & assert_in_range(size_type offset, size_type size) const
Throws NullReferenceError if this->get()==NULL orthis->get()!=NULL, throws RangeError if (offset < 0 ...
Partial specialization of ArrayRCP for const T.
iterator begin() const
Return an iterator to beginning of the array of data.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Macro for throwing an exception with breakpointing to ease debugging.
UnConst< T >::Result NonConstType
T * getRawPtr() const
Get the raw C++ pointer to the underlying object.
Ordinal size_type
Type representing the number of elements in an ArrayRCP or view thereof.
size_type size() const
The total number of items in the managed array.
#define REFCOUNTPTR_INLINE
ERCPNodeLookup
Used to determine if RCPNode lookup is performed or not.
size_type size() const
The total number of entries in the array.
const T * getRawPtr() const
void assign(const ArrayView< const T > &array) const
Copy the data from one array view object to this array view object.
void debug_assert_in_range(size_type offset, size_type size_in) const
void debug_assert_not_null() const
#define TEUCHOSCORE_LIB_DLL_EXPORT
T * getRawPtr() const
Return a raw pointer to beginning of array or NULL if unsized.
TypeTo as(const TypeFrom &t)
Convert from one value type to another.
const ArrayView< T > & assert_not_null() const
Throws NullReferenceError if this->get()==NULL, otherwise returns reference to *this.
void debug_assert_valid_ptr() const
const ArrayView< T > & operator()() const
Return *this (just for compatibility with Array and ArrayPtr).
bool nonnull(const boost::shared_ptr< T > &p)
Returns true if p.get()!=NULL.
ArrayView(ENull null_arg=null)
Constructor that initializes to NULL (implicitly or explicitly).
iterator end() const
Return an iterator to past the end of the array of data.
ArrayView< T > view(size_type offset, size_type size) const
Return a view of a contiguous range of elements.
Partial specialization of ArrayView for const T.
Range error exception class.
T & operator[](size_type i) const
Random object access.
ArrayView< T > & operator=(const ArrayView< T > &array)
Shallow copy assignment operator.
Definition of Teuchos::as, for conversions between types.
ArrayView< const T > getConst() const
Return a const view of a possibly nonconst view.
T & back() const
Get the last element.
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
This macro is designed to be a short version of TEUCHOS_TEST_FOR_EXCEPTION() that is easier to call...
const T * getRawPtr() const
Reference-counted smart pointer for managing arrays.