DP3
Namespaces | Macros | Functions
BlobArray.h File Reference
#include "BlobOStream.h"
#include "BlobIStream.h"
#include <vector>
#include "BlobArray.tcc"

Go to the source code of this file.

Namespaces

 dp3
 This file has generic helper routines for testing steps.
 
 dp3::blob
 

Macros

#define BLOBARRAY_PUTGET_SPEC(TP)
 Specializations for the standard types (including complex and string). More...
 

Functions

void dp3::blob::convertArrayHeader (common::DataFormat, char *header, bool useBlobHeader)
 Convert the array header data. More...
 
template<typename T >
BlobIStream & dp3::blob::getBlobArray (BlobIStream &bs, T *&arr, std::vector< uint64_t > &shape, bool fortranOrder)
 
template<typename T >
void dp3::blob::getBlobArrayData (BlobIStream &bs, T *data, uint64_t nr)
 Helper function to get an array of data. More...
 
uint64_t dp3::blob::getBlobArrayShape (BlobIStream &bs, uint64_t *shape, unsigned int ndim, bool swapAxes, unsigned int nalign)
 
unsigned int dp3::blob::getBlobArrayStart (BlobIStream &bs, bool &fortranOrder, uint16_t &ndim)
 
template<typename T >
uint64_t dp3::blob::getSpaceBlobArray (BlobIStream &bs, bool useBlobHeader, std::vector< uint64_t > &shape, bool fortranOrder)
 
template<typename T >
void dp3::blob::putBlobArrayData (BlobOStream &bs, const T *data, uint64_t nr)
 
uint64_t dp3::blob::putBlobArrayHeader (BlobOStream &bs, bool useBlobHeader, const std::string &headerName, const uint64_t *shape, uint16_t ndim, bool fortranOrder, unsigned int alignment)
 
General function to write a data array

Usually it is used by the other functions, but it can be used on its own to write, say, a C-style array. A 1-dim C-style array can be written with putBlobVector.

template<typename T >
BlobOStream & dp3::blob::putBlobArray (BlobOStream &bs, const T *data, const uint64_t *shape, uint16_t ndim, bool fortranOrder)
 
template<typename T >
BlobOStream & dp3::blob::putBlobVector (BlobOStream &bs, const T *vec, uint64_t size)
 Put a C-style vector of values as an array. More...
 
Reserve space for an array with the given shape

The axes ordering (Fortran or C-style) has to be given. It returns the offset of the array in the blob. It is useful for allocating a static blob in a dynamic way. It is only possible if the underlying buffer is seekable. It is meant for use with the BlobOBufString buffer. The function getPointer in that class can be used to turn the position into a pointer. The data will be aligned on the given alignment which defaults to sizeof(T) bytes with a maximum of 8.

template<typename T >
uint64_t dp3::blob::setSpaceBlobArray (BlobOStream &bs, bool useBlobHeader, const std::vector< uint64_t > &shape, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t dp3::blob::setSpaceBlobArray (BlobOStream &bs, bool useBlobHeader, const uint64_t *shape, uint16_t ndim, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t dp3::blob::setSpaceBlobArray1 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, unsigned int alignment)
 Reserve space for a 1-dim array of the given size. More...
 
template<typename T >
uint64_t dp3::blob::setSpaceBlobArray2 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, uint64_t size1, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t dp3::blob::setSpaceBlobArray3 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, uint64_t size1, uint64_t size2, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t dp3::blob::setSpaceBlobArray4 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, uint64_t size1, uint64_t size2, uint64_t size3, bool fortranOrder, unsigned int alignment=0)
 
Write a vector of objects
BlobOStream & dp3::blob::operator<< (BlobOStream &, const std::vector< bool > &)
 
template<typename T >
BlobOStream & dp3::blob::operator<< (BlobOStream &bs, const std::vector< T > &vec)
 Put a vector object as an array. More...
 
Read back a vector of objects

The dimensionality found in the stream has to be 1. The vector is resized as needed.

BlobIStream & dp3::blob::operator>> (BlobIStream &, std::vector< bool > &)
 
template<typename T >
BlobIStream & dp3::blob::operator>> (BlobIStream &, std::vector< T > &)