33 const pybind11::buffer_info&
info;
46 if (dim + 1 < info.ndim) {
47 entrySize = discover(dim + 1);
52 entrySize = info.itemsize;
55 if (info.strides[dim] == entrySize) {
59 packetSize = info.size * info.itemsize;
64 return entrySize * info.shape[dim];
68 firstStridedDim = dim;
69 packetSize = entrySize;
78 void copy(
const uint8_t* inPtr,
int dim = 0) {
79 if (dim > firstStridedDim) {
82 memcpy(outPtr, inPtr,
size);
87 for (
size_t i = 0; i < info.shape[dim]; ++i)
88 copy(inPtr + i * info.strides[dim], dim + 1);
92 Copy(
const pybind11::buffer_info& info,
void* outputBuffer,
size_t limit):
93 info(info), outPtr(static_cast<uint8_t*>(outputBuffer)), limit(limit)
96 copy(
static_cast<const uint8_t*
>(info.ptr));
105 auto it =
data.find(
id);
106 if (it ==
data.cend())
108 auto info = it->second.request();
109 return info.size * info.itemsize;
114 auto it = this->data.find(
id);
115 if (it == this->data.end())
118 return limit -
copy.remaining();
124 for (
auto it : data) {
125 Chunk chunk(*
this, it.first);
126 writer(it.first, chunk(), chunk.
size());
Simply a piece of binary data of a specific size.
std::map< std::string, pybind11::buffer > data
chunksize_t chunkSize(const std::string &id) const
Retrieves size of a specific chunk.
chunksize_t fetch(const std::string &id, void *data, const chunksize_t limit)
Reads a chunk.
void save(const std::string &filename, bool append=false)
Saves the collection to a file.
Copies data from multidimensional strided tensor to a continuous memory space.
uint8_t * outPtr
output pointer
int firstStridedDim
first non-dense dimension
Copy(const pybind11::buffer_info &info, void *outputBuffer, size_t limit)
size_t packetSize
largest continuous packet size
const pybind11::buffer_info & info
void copy(const uint8_t *inPtr, int dim=0)
size_t discover(int dim=0)
size_t limit
number of bytes remaining to copy
Beatmup internal declarations.
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
Beatmup::AbstractBitmap * copy
JNIEnv jlong jstring filename
JNIEnv jlong jstring jboolean append