GEOSX
|
Implements the Buffer interface using CHAI. More...
#include <ChaiBuffer.hpp>
Public Types | |
using | value_type = T |
Alias for T used used in the bufferManipulation functions. | |
using | T_non_const = std::remove_const_t< T > |
An alias for the non const version of T. | |
Public Member Functions | |
constexpr | ChaiBuffer () |
Default constructor, creates an uninitialized ChaiBuffer. More... | |
ChaiBuffer (bool) | |
Constructor for creating an empty Buffer. More... | |
ChaiBuffer (ChaiBuffer const &src) | |
Copy constructor. More... | |
ChaiBuffer (ChaiBuffer const &src, std::ptrdiff_t const size) | |
Copy constructor. More... | |
constexpr | ChaiBuffer (ChaiBuffer &&src) |
Move constructor. More... | |
template<typename _T = T, typename = std::enable_if_t< std::is_const< _T >::value >> | |
constexpr | ChaiBuffer (ChaiBuffer< std::remove_const_t< T > > const &src) |
Create a copy of src with const T. More... | |
LVARRAY_INTEL_CONSTEXPR ChaiBuffer & | operator= (ChaiBuffer const &src) |
Copy assignment operator. More... | |
LVARRAY_INTEL_CONSTEXPR ChaiBuffer & | operator= (ChaiBuffer &&src) |
Move assignment operator. More... | |
void | reallocate (std::ptrdiff_t const size, std::ptrdiff_t const newCapacity) |
Reallocate the buffer to the new capacity. More... | |
void | free () |
Free the data in the buffer but does not destroy any values. More... | |
constexpr std::ptrdiff_t | capacity () const |
constexpr T * | data () const |
constexpr chai::PointerRecord & | pointerRecord () const |
Return a reference to the associated CHAI PointerRecord. More... | |
template<typename INDEX_TYPE > | |
constexpr T & | operator[] (INDEX_TYPE const i) const |
void | moveNested (MemorySpace const space, std::ptrdiff_t const size, bool const touch) const |
Move the buffer to the given execution space, optionally touching it. More... | |
void | move (MemorySpace const space, bool const touch) const |
Move the buffer to the given execution space, optionally touching it. More... | |
constexpr void | registerTouch (MemorySpace const space) const |
Touch the buffer in the given space. More... | |
template<typename U = ChaiBuffer< T >> | |
void | setName (std::string const &name) |
Set the name associated with this buffer which is used in the chai callback. More... | |
Static Public Attributes | |
static constexpr bool | hasShallowCopy = true |
A flag indicating that the ChaiBuffer's copy semantics are shallow. | |
Implements the Buffer interface using CHAI.
T | type of data that is contained in the buffer. |
The ChaiBuffer's allocation can exist in multiple memory spaces. If the chai execution space is set the copy constructor will ensure that the newly constructed ChaiBuffer's pointer points to memory in that space. If the memory does exist it will be allocated and the data copied over. If the memory exists but the data has been touched (modified) in the current space it will be copied over. The data is touched in the new space if T is non const and is not touched if T is const.
Definition at line 104 of file ChaiBuffer.hpp.
|
inline |
Default constructor, creates an uninitialized ChaiBuffer.
An uninitialized ChaiBuffer is an undefined state and may only be assigned to. An uninitialized ChaiBuffer holds no recources and does not need to be free'd.
Definition at line 123 of file ChaiBuffer.hpp.
|
inline |
Constructor for creating an empty Buffer.
An empty buffer may hold resources and needs to be free'd.
Definition at line 134 of file ChaiBuffer.hpp.
|
inline |
Copy constructor.
src | The buffer to copy. |
In addition to performing a shallow copy of src
if the chai execution space is set *this will contain a pointer the the allocation in that space.
Definition at line 155 of file ChaiBuffer.hpp.
|
inline |
Copy constructor.
src | The buffer to copy. |
In addition to performing a shallow copy of src
if the chai execution space is set *this will contain a pointer the the allocation in that space.
size | The number of values in the allocation. |
src
if the chai execution space is set *this will contain a pointer the the allocation in that space. It will also move any nested objects. Definition at line 173 of file ChaiBuffer.hpp.
|
inline |
Move constructor.
src | The ChaiBuffer to be moved from, is uninitialized after this call. |
Definition at line 190 of file ChaiBuffer.hpp.
|
inline |
Create a copy of src
with const T.
_T | A dummy parameter to allow enable_if, do not specify. |
src | The buffer to copy. |
Definition at line 207 of file ChaiBuffer.hpp.
|
inline |
Definition at line 300 of file ChaiBuffer.hpp.
|
inline |
Definition at line 307 of file ChaiBuffer.hpp.
|
inline |
Free the data in the buffer but does not destroy any values.
Definition at line 287 of file ChaiBuffer.hpp.
|
inline |
Move the buffer to the given execution space, optionally touching it.
space | The space to move the buffer to. |
touch | If the buffer should be touched in the new space or not. |
Definition at line 365 of file ChaiBuffer.hpp.
|
inline |
Move the buffer to the given execution space, optionally touching it.
space | The space to move the buffer to. |
size | The size of the buffer. |
touch | If the buffer should be touched in the new space or not. |
space
, touch
) on each sub object. Definition at line 337 of file ChaiBuffer.hpp.
|
inline |
Copy assignment operator.
src | The ChaiBuffer to be copied. |
Definition at line 219 of file ChaiBuffer.hpp.
|
inline |
Move assignment operator.
src | The ChaiBuffer to be moved from, is uninitialized after this call. |
Definition at line 233 of file ChaiBuffer.hpp.
|
inline |
INDEX_TYPE | the type used to index into the values. |
i
. i | The position of the value to access. |
Definition at line 326 of file ChaiBuffer.hpp.
|
inline |
Return a reference to the associated CHAI PointerRecord.
Definition at line 315 of file ChaiBuffer.hpp.
|
inline |
Reallocate the buffer to the new capacity.
size | the number of values that are initialized in the buffer. Values between [0, size) are destroyed. |
newCapacity | the new capacity of the buffer. |
Definition at line 254 of file ChaiBuffer.hpp.
|
inline |
Touch the buffer in the given space.
space | the space to touch. |
Definition at line 391 of file ChaiBuffer.hpp.
|
inline |
Set the name associated with this buffer which is used in the chai callback.
U | The type of the owning class, will be displayed in the callback. |
name | the of the buffer. |
Definition at line 404 of file ChaiBuffer.hpp.