AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
|
Buffer is a container that describes and holds data in memory. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/axom/checkouts/develop/src/axom/sidre/core/Buffer.hpp>
Public Member Functions | |
Basic query and accessor methods | |
IndexType | getIndex () const |
Return the unique index of this Buffer object. More... | |
IndexType | getNumViews () const |
Return number of Views this Buffer is attached to. More... | |
Methods to query and access Buffer data | |
void * | getVoidPtr () |
Return void-pointer to data held by Buffer. More... | |
Node::Value | getData () |
Return data held by Buffer (return type is type caller assigns return value to). More... | |
TypeID | getTypeID () const |
Return type of data owned by this Buffer object. More... | |
IndexType | getNumElements () const |
Return total number of data elements (of its type) owned by this Buffer object. More... | |
IndexType | getTotalBytes () const |
Return total number of bytes of data owned by this Buffer object. More... | |
IndexType | getBytesPerElement () const |
Return the number of bytes per element owned by this Buffer object. More... | |
bool | isAllocated () const |
Return true if Buffer has been (re)allocated with length >= 0, else false. More... | |
bool | isDescribed () const |
Return true if data description exists. More... | |
Friends | |
class | DataStore |
class | Group |
class | View |
Data description and allocation methods | |
Buffer * | describe (TypeID type, IndexType num_elems) |
Describe a Buffer with data given data type and number of elements. More... | |
Buffer * | allocate (int allocID=INVALID_ALLOCATOR_ID) |
Allocate data for a Buffer. More... | |
Buffer * | allocate (TypeID type, IndexType num_elems, int allocID=INVALID_ALLOCATOR_ID) |
Allocate Buffer with data type and number of elements. More... | |
Buffer * | reallocate (IndexType num_elems) |
Reallocate data to given number of elements. More... | |
Buffer * | deallocate () |
Deallocate data in a Buffer. More... | |
Buffer * | copyBytesIntoBuffer (void *src, IndexType nbytes) |
Copy given number of bytes of data from src into Buffer. More... | |
void | copyToConduitNode (Node &n) const |
Copy Buffer description to a Conduit node. More... | |
void | print () const |
Print JSON description of Buffer to std::cout. More... | |
void | print (std::ostream &os) const |
Print JSON description of Buffer to given output stream. More... | |
void | exportTo (conduit::Node &data_holder) |
Exports Buffer's state to a Conduit node. More... | |
void | exportMetadata (conduit::Node &data_holder) |
Exports Buffer's metadata to a Conduit node. More... | |
void | importFrom (conduit::Node &data_holder) |
Import Buffer's state from a Conduit node. More... | |
Buffer is a container that describes and holds data in memory.
The Buffer class has the following properties:
|
inline |
Return the unique index of this Buffer object.
|
inline |
Return number of Views this Buffer is attached to.
|
inline |
Return void-pointer to data held by Buffer.
|
inline |
Return data held by Buffer (return type is type caller assigns return value to).
Note that if Buffer is not allocated, an empty Conduit Node::Value is returned.
References isAllocated(), and SLIC_CHECK_MSG.
|
inline |
Return type of data owned by this Buffer object.
|
inline |
Return total number of data elements (of its type) owned by this Buffer object.
|
inline |
Return total number of bytes of data owned by this Buffer object.
|
inline |
Return the number of bytes per element owned by this Buffer object.
|
inline |
Return true if Buffer has been (re)allocated with length >= 0, else false.
|
inline |
Return true if data description exists.
Describe a Buffer with data given data type and number of elements.
To use the Buffer, the data must be allocated by calling allocate().
If Buffer is already allocated or given number of elements is < 0, method is a no-op.
Buffer* axom::sidre::Buffer::allocate | ( | int | allocID = INVALID_ALLOCATOR_ID | ) |
Buffer* axom::sidre::Buffer::allocate | ( | TypeID | type, |
IndexType | num_elems, | ||
int | allocID = INVALID_ALLOCATOR_ID |
||
) |
Allocate Buffer with data type and number of elements.
This is equivalent to: buff->describe(type, num_elems)->allocate().
Method is a no-op under the same conditions as either of those methods.
Reallocate data to given number of elements.
This is equivalent to: buff->describe(type, num_elems)->allocate() if the Buffer is not allocated.
If given number of elements < 0, or the Buffer is not already described with type information, this method is a no-op.
Buffer* axom::sidre::Buffer::deallocate | ( | ) |
Deallocate data in a Buffer.
If Buffer is attached to Views, it will remain attached to those Views and the descriptions will remain intact. However, the View descriptions will be 'un-applied' since there is no data to apply them to.
If the Buffer is subsequently redescribed and/or re-allocated, the associated Views may need to be re-described. They will need to be re-applied if the Views will be used to access the Buffer data.
If the Buffer is not allocated, method is a no-op.
Copy given number of bytes of data from src into Buffer.
If nbytes < 0 or nbytes > getTotalBytes(), or src is null, method is a no-op.
void axom::sidre::Buffer::copyToConduitNode | ( | Node & | n | ) | const |
Copy Buffer description to a Conduit node.
void axom::sidre::Buffer::print | ( | ) | const |
Print JSON description of Buffer to std::cout.
void axom::sidre::Buffer::print | ( | std::ostream & | os | ) | const |
Print JSON description of Buffer to given output stream.
void axom::sidre::Buffer::exportTo | ( | conduit::Node & | data_holder | ) |
Exports Buffer's state to a Conduit node.
void axom::sidre::Buffer::exportMetadata | ( | conduit::Node & | data_holder | ) |
Exports Buffer's metadata to a Conduit node.
void axom::sidre::Buffer::importFrom | ( | conduit::Node & | data_holder | ) |
Import Buffer's state from a Conduit node.
|
friend |
Friend declarations to constrain usage via controlled access to private members.
|
friend |
|
friend |