DP3
Classes | Typedefs | Functions
dp3::blob Namespace Reference

Classes

class  BlobAipsIO
 A Blob buffer for Aips++ ByteIO. More...
 
class  BlobHeader
 Standard header for a blob. More...
 
class  BlobIBuffer
 Abstract base class for input buffer for a blob. More...
 
class  BlobIBufStream
 Input buffer for a blob using an istream. More...
 
class  BlobIStream
 Input stream for a blob. More...
 
class  BlobOBuffer
 Abstract base class for output buffer for a blob. More...
 
class  BlobOBufStream
 Output buffer for a blob using an ostream. More...
 
class  BlobOStream
 Output stream for a blob. More...
 
class  BlobStreamable
 Interface for classes that can be streamed using blobs. More...
 

Typedefs

typedef std::runtime_error BlobException
 Blob Exception class. More...
 

Functions

void convertArrayHeader (common::DataFormat, char *header, bool useBlobHeader)
 Convert the array header data. More...
 
template<typename T >
BlobIStreamgetBlobArray (BlobIStream &bs, T *&arr, std::vector< uint64_t > &shape, bool fortranOrder)
 
template<typename T >
void getBlobArrayData (BlobIStream &bs, T *data, uint64_t nr)
 Helper function to get an array of data. More...
 
uint64_t getBlobArrayShape (BlobIStream &bs, uint64_t *shape, unsigned int ndim, bool swapAxes, unsigned int nalign)
 
unsigned int getBlobArrayStart (BlobIStream &bs, bool &fortranOrder, uint16_t &ndim)
 
template<typename T >
uint64_t getSpaceBlobArray (BlobIStream &bs, bool useBlobHeader, std::vector< uint64_t > &shape, bool fortranOrder)
 
template<typename T >
void putBlobArrayData (BlobOStream &bs, const T *data, uint64_t nr)
 
uint64_t 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 >
BlobOStreamputBlobArray (BlobOStream &bs, const T *data, const uint64_t *shape, uint16_t ndim, bool fortranOrder)
 
template<typename T >
BlobOStreamputBlobVector (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 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 setSpaceBlobArray2 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, uint64_t size1, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t 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 setSpaceBlobArray4 (BlobOStream &bs, bool useBlobHeader, uint64_t size0, uint64_t size1, uint64_t size2, uint64_t size3, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t setSpaceBlobArray (BlobOStream &bs, bool useBlobHeader, const std::vector< uint64_t > &shape, bool fortranOrder, unsigned int alignment=0)
 
template<typename T >
uint64_t setSpaceBlobArray (BlobOStream &bs, bool useBlobHeader, const uint64_t *shape, uint16_t ndim, bool fortranOrder, unsigned int alignment=0)
 
Write a vector of objects
BlobOStreamoperator<< (BlobOStream &, const std::vector< bool > &)
 
template<typename T >
BlobOStreamoperator<< (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.

BlobIStreamoperator>> (BlobIStream &, std::vector< bool > &)
 
template<typename T >
BlobIStreamoperator>> (BlobIStream &, std::vector< T > &)
 
Write a map.

Blob handling for STL sequences

Define functions to write a map into a blob and to read it back. The map is preceeded by the header 'map<T,U>', where T and U are the type names as defined in TypeNames.h. Type names are only defined for the basic types. Other types are set to 'unknown'.

template<typename T , typename U >
BlobOStreamoperator<< (BlobOStream &, const std::map< T, U > &)
 
Read back a map.
template<typename T , typename U >
BlobIStreamoperator>> (BlobIStream &, std::map< T, U > &)
 
Write a sequence.

Define helper functions to write any STL sequence into a blob and to read it back. The sequence is preceeded by the header 'array<T>', where T is the type name of Seq::value_type as defined in TypeNames.h. Type names are only defined for the basic types. Other types are set to 'unknown'. All sequences are written in the same way (as 1-dim arrays). It means that they can be read back using any other sequence type.

template<typename Seq >
void sequenceToBlob (BlobOStream &, const Seq &)
 
Read back a sequence.
template<typename Seq >
void sequenceFromBlob (BlobOStream &, Seq &)
 
template<typename T >
void sequenceFromBlob (BlobOStream &, std::set< T > &)
 Specialize for a set. More...
 
Write a list.

Define helper functions to write an STL sequence into a blob and to read it back. The sequence is preceeded by the header 'array<T>', where T is the type name of T as defined in TypeNames.h. Type names are only defined for the basic types. Other types are set to 'unknown'. All sequences are written in the same way (as 1-dim arrays). It means that they can be read back in any other sequence type (including AIPS++ and Blitz arrays).

Note
STL vectors are handled by BlobArray.h.
template<typename T >
BlobOStreamoperator<< (BlobOStream &bs, const std::list< T > &seq)
 
Read back a list.
template<typename T >
BlobIStreamoperator>> (BlobIStream &bs, std::list< T > &seq)
 
Write a set.
template<typename T >
BlobOStreamoperator<< (BlobOStream &bs, const std::set< T > &seq)
 
Read back a set.
template<typename T >
BlobIStreamoperator>> (BlobIStream &bs, std::set< T > &seq)
 
Write a queue.
template<typename T >
BlobOStreamoperator<< (BlobOStream &bs, const std::queue< T > &seq)
 
Read back a queue.
template<typename T >
BlobIStreamoperator>> (BlobIStream &bs, std::queue< T > &seq)
 
Write a deque.
template<typename T >
BlobOStreamoperator<< (BlobOStream &bs, const std::deque< T > &seq)
 
Read back a deque.
template<typename T >
BlobIStreamoperator>> (BlobIStream &bs, std::deque< T > &seq)
 

Typedef Documentation

◆ BlobException

typedef std::runtime_error dp3::blob::BlobException

Blob Exception class.

Function Documentation

◆ operator<<() [1/5]

template<typename T , typename U >
BlobOStream& dp3::blob::operator<< ( BlobOStream ,
const std::map< T, U > &   
)

◆ operator<<() [2/5]

template<typename T >
BlobOStream& dp3::blob::operator<< ( BlobOStream bs,
const std::deque< T > &  seq 
)

◆ operator<<() [3/5]

template<typename T >
BlobOStream& dp3::blob::operator<< ( BlobOStream bs,
const std::list< T > &  seq 
)

◆ operator<<() [4/5]

template<typename T >
BlobOStream& dp3::blob::operator<< ( BlobOStream bs,
const std::queue< T > &  seq 
)

◆ operator<<() [5/5]

template<typename T >
BlobOStream& dp3::blob::operator<< ( BlobOStream bs,
const std::set< T > &  seq 
)

◆ operator>>() [1/5]

template<typename T , typename U >
BlobIStream& dp3::blob::operator>> ( BlobIStream ,
std::map< T, U > &   
)

◆ operator>>() [2/5]

template<typename T >
BlobIStream& dp3::blob::operator>> ( BlobIStream bs,
std::deque< T > &  seq 
)

◆ operator>>() [3/5]

template<typename T >
BlobIStream& dp3::blob::operator>> ( BlobIStream bs,
std::list< T > &  seq 
)

◆ operator>>() [4/5]

template<typename T >
BlobIStream& dp3::blob::operator>> ( BlobIStream bs,
std::queue< T > &  seq 
)

◆ operator>>() [5/5]

template<typename T >
BlobIStream& dp3::blob::operator>> ( BlobIStream bs,
std::set< T > &  seq 
)

◆ sequenceFromBlob() [1/2]

template<typename Seq >
void dp3::blob::sequenceFromBlob ( BlobOStream ,
Seq &   
)

◆ sequenceFromBlob() [2/2]

template<typename T >
void dp3::blob::sequenceFromBlob ( BlobOStream ,
std::set< T > &   
)

Specialize for a set.

◆ sequenceToBlob()

template<typename Seq >
void dp3::blob::sequenceToBlob ( BlobOStream ,
const Seq &   
)