LRAUV  revA
BlobValue Class Reference

Wraps a StrValue as an arbitrary collection of binary values, with units. More...

#include <BlobValue.h>

Inheritance diagram for BlobValue:
Collaboration diagram for BlobValue:

Public Member Functions

 BlobValue (const ElementURI &elementUri)
 ElementURI constructior. More...
 
 BlobValue (const void *bytes, size_t elements, const ElementURI &elementUri)
 raw constructor More...
 
 BlobValue (const Unit &unit, const double *array, size_t elements, const ElementURI &elementUri)
 double array pointer constructor More...
 
 BlobValue (const Unit &unit, const float *array, size_t elements, const ElementURI &elementUri)
 float array pointer constructor More...
 
 BlobValue (const Unit &unit, const int *array, size_t elements, const ElementURI &elementUri)
 int array pointer constructor More...
 
void setFromRaw (const void *bytes, size_t elements)
 
template<typename T >
void setFrom (const Unit &unit, const T *array, size_t elements)
 
template<typename T , size_t m, size_t n>
void setFrom (const Unit &unit, const T(&array)[m][n])
 
template<typename T >
void setFrom (const Unit &unit, const T **array, int m, int n)
 
template<typename T , size_t m, size_t n, size_t o>
void setFrom (const Unit &unit, const T(&array)[m][n][o])
 
template<typename T >
void setFrom (const Unit &unit, const T ***array, int m, int n, int o)
 
bool set (size_t index, const Unit &unit, double value)
 Set an individual value. More...
 
template<typename T >
int copyTo (const Unit &unit, T *array, size_t elements)
 
template<typename T , size_t m, size_t n>
int copyTo (const Unit &unit, T(&array)[m][n])
 
template<typename T >
int copyTo (const Unit &unit, T **array, int m, int n)
 
template<typename T , size_t m, size_t n, size_t o>
int copyTo (const Unit &unit, T(&array)[m][n][o])
 
template<typename T >
int copyTo (const Unit &unit, T ***array, int m, int n, int o)
 
bool get (size_t index, const Unit &unit, double &value)
 Get an individual value. More...
 
size_t getElements ()
 
size_t getByteLength ()
 
void * getBytes ()
 
virtual Str toString (const Unit &unit) const
 
BlobType getBlobType ()
 
- Public Member Functions inherited from StrValue
 StrValue ()
 Default constructior. More...
 
 StrValue (const char *value, size_t length=Str::NO_POS, const Unit &unit=Units::NONE)
 Two value constructior. More...
 
 StrValue (const Str value)
 Single value constructior. More...
 
 StrValue (const StrValue &value)
 Copy Constructor. More...
 
 StrValue (const void *binary)
 Constructor from binary. More...
 
virtual ~StrValue ()
 Destructor. More...
 
void * operator new (size_t size)
 Override new. More...
 
void operator delete (void *p)
 Override delete. More...
 
StrValuecopy () const
 Return a pointer to a new copy. More...
 
virtual void minus (const DataValue *rhs, DataValue *assignTo) const
 Subtraction of another DataValue to yield another DataValue. More...
 
virtual void times (const double rhs, DataValue *assignTo) const
 Multiplication by a double to yield another DataValue. More...
 
virtual double absDiff (const DataValue *rhs) const
 Return the absolute value of this difference from another DataValue. More...
 
virtual bool copyTo (const Unit &unit, unsigned char &assignTo) const
 Copy value to unsigned char. More...
 
virtual bool copyTo (const Unit &unit, double &assignTo, unsigned int dim) const
 Copy n-dimensional value to double. More...
 
virtual bool copyTo (const Unit &unit, double &assignTo) const
 Copy value to double. More...
 
virtual bool copyTo (const Unit &unit, float &assignTo) const
 Copy value to float. More...
 
virtual bool copyTo (const Unit &unit, int &assignTo) const
 Copy value to unsigned int. More...
 
virtual int compare (const Unit &unit, const unsigned char &compareTo) const
 Comparison with unsigned char. More...
 
virtual int compare (const Unit &unit, const double &compareTo) const
 Comparison with double. More...
 
virtual int compare (const Unit &unit, const float &compareTo) const
 Comparison with float. More...
 
virtual int compare (const Unit &unit, const int &compareTo) const
 Comparison with int. More...
 
virtual int compare (const DataValue &compareTo) const
 Comparison with another DataValue. More...
 
virtual bool equals (const Unit &unit, const unsigned char &compareTo) const
 Equality test with with unsigned char. More...
 
virtual bool equals (const Unit &unit, const float &compareTo) const
 Equality test with float. More...
 
virtual bool equals (const Unit &unit, const double &compareTo) const
 Equality test with double. More...
 
virtual bool equals (const Unit &unit, const int &compareTo) const
 Equality test with int. More...
 
virtual bool equals (const DataValue &compareTo) const
 Equality test with another DataValue. More...
 
virtual bool setFrom (const Unit &unit, unsigned char value)
 set from unsigned char value More...
 
virtual bool setFrom (const Unit &unit, double value)
 set from double value More...
 
virtual bool setFrom (const Unit &unit, float value)
 set from float value More...
 
virtual bool setFrom (const Unit &unit, int value)
 set int value More...
 
virtual bool setFrom (const DataValue &value)
 set DataValue value More...
 
virtual const StrasString () const
 
void setString (const Str &str)
 
virtual Str toString () const
 
virtual unsigned int toStream (OutStream &outStream) const
 Send the data value to the indicated stream. More...
 
virtual void fromBinary (const void *buffer, unsigned short typeSize)
 Load the data from the a binary representation in the buffer Typically just a memcopy of the variable, though endianness may come into it. More...
 
virtual void fromBinary (const void *buffer)
 Load the data from the a binary representation in the buffer Typically just a memcopy of the variable, though endianness may come into it. More...
 
- Public Member Functions inherited from DataValue
virtual ~DataValue ()
 Destructor. More...
 
void operator delete (void *p)
 Override delete. More...
 
virtual bool copyTo (const Unit &unit, bool &assignTo) const
 Copy value to bool. More...
 
virtual bool copyTo (DataValue &assignTo) const
 Copy value to another dataValue. More...
 
virtual int compare (const Unit &unit, const bool &compareTo) const
 Comparison with bool. More...
 
virtual bool equals (const Unit &unit, const bool &compareTo) const
 Equality test with with bool. More...
 
virtual bool isNaN ()
 Returns true if the number is not a number. More...
 
virtual bool setFrom (const Unit &unit, bool value)
 set from bool value More...
 
virtual size_t getTypeSize () const
 Returns the size of the internal storage type (i.e. sizeof(type)) More...
 
virtual BinaryDataType getBinaryType (void) const
 Returns a constant (defined in BinaryDataType.h) representing the internal storage type. More...
 
const UnitgetUnit () const
 
const UnitgetBaseUnit () const
 
void setUnit (const Unit &unit)
 
void clearType ()
 

Static Public Member Functions

static size_t ElementSize (const BlobType &blobType)
 

Static Public Attributes

static const size_t ELEMENT_SIZE [BLOB_TYPE_COUNT]
 

Protected Member Functions

template<typename T >
bool conversionNeeded (const Unit &unit)
 
template<typename T >
void setElement (size_t index, T value, bool flip)
 Set an individual value, without bounds checking or scaling. More...
 
template<typename T >
void getElement (size_t index, T &value, bool flip)
 Get an individual value, without bounds checking or scaling. More...
 
template<>
bool conversionNeeded (const Unit &unit)
 
template<>
bool conversionNeeded (const Unit &unit)
 
template<>
bool conversionNeeded (const Unit &unit)
 
- Protected Member Functions inherited from DataValue
 DataValue (const Unit &unit, const size_t &typeSize, const BinaryDataType &binaryType)
 Protected Constructor for abstract base class. More...
 
 DataValue (const size_t &typeSize, const BinaryDataType &binaryType)
 Protected unitless constructor for use via DataEntry class. More...
 

Protected Attributes

BlobType blobType_
 
- Protected Attributes inherited from StrValue
Str value_
 
- Protected Attributes inherited from DataValue
const Unitunit_
 
size_t typeSize_
 size of the internal storage type (i.e. sizeof(type)) More...
 
BinaryDataType binaryType_
 constant (defined in BinaryDataType.h) representing the internal storage type More...
 

Friends

class Blob_Test
 

Detailed Description

Wraps a StrValue as an arbitrary collection of binary values, with units.

Note that the values are not internally converted and stored in base SI units.

Constructor & Destructor Documentation

BlobValue::BlobValue ( const ElementURI elementUri)

ElementURI constructior.

ElementURI constructor.

BlobValue::BlobValue ( const void *  bytes,
size_t  elements,
const ElementURI elementUri 
)

raw constructor

References setFromRaw().

BlobValue::BlobValue ( const Unit unit,
const double *  array,
size_t  elements,
const ElementURI elementUri 
)

double array pointer constructor

double array constructor

References setFrom().

BlobValue::BlobValue ( const Unit unit,
const float *  array,
size_t  elements,
const ElementURI elementUri 
)

float array pointer constructor

float array constructor

References setFrom().

BlobValue::BlobValue ( const Unit unit,
const int *  array,
size_t  elements,
const ElementURI elementUri 
)

int array pointer constructor

int array constructor

References setFrom().

Member Function Documentation

template<typename T >
bool BlobValue::conversionNeeded ( const Unit unit)
protected
template<>
bool BlobValue::conversionNeeded ( const Unit unit)
protected

References BLOB_FLOAT64LE.

template<>
bool BlobValue::conversionNeeded ( const Unit unit)
protected

References BLOB_FLOAT32LE.

template<>
bool BlobValue::conversionNeeded ( const Unit unit)
protected

References BLOB_INT32LE, and BLOB_INT64LE.

template<typename T , size_t m, size_t n>
int BlobValue::copyTo ( const Unit unit,
T(&)  array[m][n] 
)
inline
template<typename T >
int BlobValue::copyTo ( const Unit unit,
T **  array,
int  m,
int  n 
)
template<typename T , size_t m, size_t n, size_t o>
int BlobValue::copyTo ( const Unit unit,
T(&)  array[m][n][o] 
)
inline
template<typename T >
int BlobValue::copyTo ( const Unit unit,
T ***  array,
int  m,
int  n,
int  o 
)
static size_t BlobValue::ElementSize ( const BlobType blobType)
inlinestatic

References BLOB_TYPE_COUNT, ELEMENT_SIZE, and NOT_BLOB.

Referenced by getElements(), setFrom(), and setFromRaw().

BlobType BlobValue::getBlobType ( )
inline

References blobType_.

template<typename T >
void BlobValue::getElement ( size_t  index,
T &  value,
bool  flip 
)
protected

Get an individual value, without bounds checking or scaling.

References Str::cStr(), AuvMath::FlipEndian(), and StrValue::value_.

Referenced by get(), and Blob_Test::testReadWriteConversions().

template<typename T >
void BlobValue::setElement ( size_t  index,
value,
bool  flip 
)
protected

Set an individual value, without bounds checking or scaling.

References Str::cStr(), AuvMath::FlipEndian(), and StrValue::value_.

Referenced by set().

template<typename T , size_t m, size_t n>
void BlobValue::setFrom ( const Unit unit,
const T(&)  array[m][n] 
)
inline
template<typename T >
void BlobValue::setFrom ( const Unit unit,
const T **  array,
int  m,
int  n 
)
template<typename T , size_t m, size_t n, size_t o>
void BlobValue::setFrom ( const Unit unit,
const T(&)  array[m][n][o] 
)
inline
template<typename T >
void BlobValue::setFrom ( const Unit unit,
const T ***  array,
int  m,
int  n,
int  o 
)
void BlobValue::setFromRaw ( const void *  bytes,
size_t  elements 
)
virtual Str BlobValue::toString ( const Unit unit) const
inlinevirtual

Reimplemented from StrValue.

References Unit::getName(), Str::length(), and StrValue::value_.

Friends And Related Function Documentation

friend class Blob_Test
friend

Member Data Documentation

BlobType BlobValue::blobType_
protected
const size_t BlobValue::ELEMENT_SIZE
static
Initial value:
=
{
0,
1,
2,
2,
4,
4,
8,
8,
1,
2,
2,
4,
4,
8,
8,
4,
4,
8,
8,
}

Referenced by ElementSize().


The documentation for this class was generated from the following files: