EinsumsPy/TestUtils/BadBuffer.hpp#
Defined in header EinsumsPy/TestUtils/BadBuffer.hpp.
See Overview for a list of names and headers that are part of the public Einsums API.
-
namespace einsums
-
namespace python
-
namespace testing#
-
struct BadBuffer#
- #include <BadBuffer.hpp>
A buffer with settable properties to allow for coverage of failure code.
All of the fields of the buffer can be modified. The only one with restrictions is the data pointer, which can only be set on initialization or cleared to NULL later.
Public Functions
-
BadBuffer() = default#
-
BadBuffer(pybind11::buffer const &buffer)#
Construct a BadBuffer using the data from another Python buffer, such as a NumPy array.
-
~BadBuffer()#
-
void *get_ptr()#
Get the pointer to the data.
-
void const *get_ptr() const#
Get the pointer to the data, but make it const.
-
void clear_ptr()#
Set the pointer to the data to NULL. If there is anything stored in the old pointer, it will be freed.
-
size_t get_itemsize() const#
Get the number of bytes per item.
-
void set_itemsize(size_t size)#
Set the number of bytes per item.
-
size_t get_ndim() const#
Get the number of dimensions.
-
void set_ndim_noresize(size_t dim)#
Set the number of dimensions. This does not affect the shape or strides.
-
void set_ndim(size_t dim)#
Set the number of dimensions and resize _dims and _strides to contain that many items.
-
void set_dim(int i, size_t dim)#
Set the dimension of the buffer along a given axis.
-
void change_dims_size(size_t new_size)#
Change the number of dimensions without affecting _ndim or _strides.
-
void set_stride(int i, size_t stride)#
Set the stride of the buffer along the given axis.
-
void change_strides_size(size_t new_size)#
Change the number of strides without affecting _ndim or _dims.
Private Members
-
void *_ptr = {nullptr}#
-
size_t _itemsize = {0}#
Where the data is stored.
-
size_t _ndim = {0}#
Format string.
-
size_t _size = {0}#
The dimensions and strides. Strides are in bytes, dimensions are in elements.
The actual size of the buffer object. It can not be changed and is not dependent on the dimensions or strides. This is because it is needed for copying the object itself in the copy constructor, as well as other management duties.
-
BadBuffer() = default#
-
struct BadBuffer#
-
namespace testing#
-
namespace python