MAK Legion API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Protected Attributes | List of all members
Legion::Span< DATA_TYPE > Class Template Reference

A span represents a contiguous array of objects in memory. More...

+ Collaboration diagram for Legion::Span< DATA_TYPE >:

Public Member Functions

 Span ()
 default constructor More...
 
 Span (const DATA_TYPE *data, int count)
 constructor for raw data More...
 
 Span (const std::vector< DATA_TYPE > &dataVector)
 constructor for complete vector More...
 
 ~Span ()
 destructor More...
 
 Span (const Span &orig)
 copy constructor More...
 
Spanoperator= (const Span &orig)
 assignment operator More...
 
bool operator== (const Span< DATA_TYPE > &rhs) const
 equality operator More...
 
bool operator!= (const Span< DATA_TYPE > &rhs) const
 inequality operator More...
 
int size () const
 Returns the count of objects in the array. More...
 
int sizeInBytes () const
 Returns the size of the array in bytes. More...
 
const DATA_TYPE * data () const
 Returns a pointer to the underlying data. More...
 
const DATA_TYPE & operator[] (int index) const
 Array access to the elements in the array. More...
 
Span slice (int offset)
 Returns a new span that is a subset of the existing span from the offset to the end of the array. More...
 
Span slice (int offset, int count)
 Returns a new span that is a subset of the existing span from the offset for a given count of the array. More...
 
std::vector< DATA_TYPE > & assignTo (std::vector< DATA_TYPE > &destination) const
 Assign the contents of the span to the given vector replacing its contents Return the given vector. More...
 
std::vector< DATA_TYPE > & appendTo (std::vector< DATA_TYPE > &destination) const
 Append the contents of the span to the end of the given vector Return the given vector. More...
 

Protected Attributes

int myCount
 
const DATA_TYPE * myData
 

Detailed Description

template<typename DATA_TYPE>
class Legion::Span< DATA_TYPE >

A span represents a contiguous array of objects in memory.

The Span does not own the memory, but simply provides an array access to the objects contained in the underlying memory. It is a very lightweight class

Constructor & Destructor Documentation

template<typename DATA_TYPE>
Legion::Span< DATA_TYPE >::Span ( )
inline

default constructor

Referenced by Legion::Span< DATA_TYPE >::slice().

template<typename DATA_TYPE>
Legion::Span< DATA_TYPE >::Span ( const DATA_TYPE *  data,
int  count 
)
inline

constructor for raw data

template<typename DATA_TYPE>
Legion::Span< DATA_TYPE >::Span ( const std::vector< DATA_TYPE > &  dataVector)
inline

constructor for complete vector

template<typename DATA_TYPE>
Legion::Span< DATA_TYPE >::~Span ( )
inline

destructor

template<typename DATA_TYPE>
Legion::Span< DATA_TYPE >::Span ( const Span< DATA_TYPE > &  orig)
inline

Member Function Documentation

template<typename DATA_TYPE>
std::vector<DATA_TYPE>& Legion::Span< DATA_TYPE >::appendTo ( std::vector< DATA_TYPE > &  destination) const
inline

Append the contents of the span to the end of the given vector Return the given vector.

References Legion::Span< DATA_TYPE >::data(), and Legion::Span< DATA_TYPE >::size().

template<typename DATA_TYPE>
std::vector<DATA_TYPE>& Legion::Span< DATA_TYPE >::assignTo ( std::vector< DATA_TYPE > &  destination) const
inline

Assign the contents of the span to the given vector replacing its contents Return the given vector.

References Legion::Span< DATA_TYPE >::data(), and Legion::Span< DATA_TYPE >::size().

template<typename DATA_TYPE>
const DATA_TYPE* Legion::Span< DATA_TYPE >::data ( ) const
inline
template<typename DATA_TYPE>
bool Legion::Span< DATA_TYPE >::operator!= ( const Span< DATA_TYPE > &  rhs) const
inline

inequality operator

template<typename DATA_TYPE>
Span& Legion::Span< DATA_TYPE >::operator= ( const Span< DATA_TYPE > &  orig)
inline
template<typename DATA_TYPE>
bool Legion::Span< DATA_TYPE >::operator== ( const Span< DATA_TYPE > &  rhs) const
inline
template<typename DATA_TYPE>
const DATA_TYPE& Legion::Span< DATA_TYPE >::operator[] ( int  index) const
inline

Array access to the elements in the array.

References Legion::Span< DATA_TYPE >::myCount, and Legion::Span< DATA_TYPE >::myData.

template<typename DATA_TYPE>
int Legion::Span< DATA_TYPE >::size ( ) const
inline
template<typename DATA_TYPE>
int Legion::Span< DATA_TYPE >::sizeInBytes ( ) const
inline

Returns the size of the array in bytes.

References Legion::Span< DATA_TYPE >::myCount.

template<typename DATA_TYPE>
Span Legion::Span< DATA_TYPE >::slice ( int  offset)
inline

Returns a new span that is a subset of the existing span from the offset to the end of the array.

References Legion::Span< DATA_TYPE >::myCount, Legion::Span< DATA_TYPE >::myData, and Legion::Span< DATA_TYPE >::Span().

template<typename DATA_TYPE>
Span Legion::Span< DATA_TYPE >::slice ( int  offset,
int  count 
)
inline

Returns a new span that is a subset of the existing span from the offset for a given count of the array.

References Legion::Span< DATA_TYPE >::myCount, Legion::Span< DATA_TYPE >::myData, and Legion::Span< DATA_TYPE >::Span().

Member Data Documentation

template<typename DATA_TYPE>
int Legion::Span< DATA_TYPE >::myCount
protected
template<typename DATA_TYPE>
const DATA_TYPE* Legion::Span< DATA_TYPE >::myData
protected

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

Document ID: Generated on Mon Mar 8 15:11:30 EST 2021 from SVN revision 225633
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)