53 void setFromRaw(
const void* bytes,
size_t elements );
57 void setFrom(
const Unit& unit,
const T* array,
size_t elements );
60 template<
typename T,
size_t m,
size_t n>
65 if( conversionNeeded<T>( unit ) )
67 for(
size_t i = 0; i < m; ++i )
69 for(
size_t j = 0; j < n; ++j )
71 set( i * n + j, unit, array[i][j] );
78 for(
size_t i = 0; i < m; ++i )
80 size_t offset = i * length;
81 memcpy( (
char* )
value_.
cStr() + offset, (
const char* )( array[i] ), length );
88 void setFrom(
const Unit& unit,
const T** array,
int m,
int n );
91 template<
typename T,
size_t m,
size_t n,
size_t o>
96 if( conversionNeeded<T>( unit ) )
98 for(
size_t i = 0; i < m; ++i )
100 for(
size_t j = 0; j < n; ++j )
102 for(
size_t k = 0; k < o; ++k )
104 set( i * n * o + j * o + k, unit, array[i][j][k] );
112 for(
size_t i = 0; i < m; ++i )
114 for(
size_t j = 0; j < n; ++j )
116 size_t offset = ( i * n + j ) * length;
117 memcpy( (
char* )
value_.
cStr() + offset, (
const char* )( array[i][j] ), length );
125 void setFrom(
const Unit& unit,
const T*** array,
int m,
int n,
int o );
128 bool set(
size_t index,
const Unit& unit,
double value );
132 int copyTo(
const Unit& unit, T* array,
size_t elements );
135 template<
typename T,
size_t m,
size_t n>
138 size_t elements = m * n;
143 if( conversionNeeded<T>( unit ) )
146 for(
unsigned int i = 0; i < elements / n; ++i )
148 for(
unsigned int j = 0; j < elements / m; ++j )
150 get( i * n + j, unit, value );
157 size_t length = n *
sizeof( T );
158 for(
unsigned int i = 0; i < elements / n; ++i )
160 size_t offset = i * length;
161 memcpy( (
char* )( array[i] ),
value_.
cStr() + offset, length );
169 int copyTo(
const Unit& unit, T** array,
int m,
int n );
172 template<
typename T,
size_t m,
size_t n,
size_t o>
175 size_t elements = m * n * o;
180 if( conversionNeeded<T>( unit ) )
183 for(
unsigned int i = 0; i < elements / n / o ; ++i )
185 for(
unsigned int j = 0; j < n; ++j )
187 for(
unsigned int k = 0; k < o; ++k )
189 get( i * n * o + j * o + k, unit, value );
190 array[i][j][k] = value;
197 size_t length = o *
sizeof( T );
198 for(
unsigned int i = 0; i < elements / n / o; ++i )
200 for(
unsigned int j = 0; j < n; ++j )
202 size_t offset = ( i * n + j ) * length;
203 memcpy( (
char* )( array[i][j] ),
value_.
cStr() + offset, length );
212 int copyTo(
const Unit& unit, T*** array,
int m,
int n,
int o );
215 bool get(
size_t index,
const Unit& unit,
double& value );
253 void setElement(
size_t index, T value,
bool flip );
257 void getElement(
size_t index, T& value,
bool flip );
size_t getByteLength()
Definition: BlobValue.h:222
void * getBytes()
Definition: BlobValue.h:227
BlobType blobType_
Definition: BlobValue.h:259
Contains the BlobType enum definition.
int copyTo(const Unit &unit, T(&array)[m][n][o])
Definition: BlobValue.h:173
static const size_t ELEMENT_SIZE[BLOB_TYPE_COUNT]
Definition: BlobValue.h:35
BlobValue(const ElementURI &elementUri)
ElementURI constructior.
Definition: BlobValue.cpp:46
void setFromRaw(const void *bytes, size_t elements)
Definition: BlobValue.cpp:85
size_t length() const
Definition: Str.h:196
A DataAccessor that writes values to the Slate via its associated DataElement.
Definition: DataWriter.h:27
bool conversionNeeded(const Unit &unit)
BlobType getBlobType()
Definition: BlobValue.h:238
size_t getElements()
Definition: BlobValue.h:217
Contains the StrValue class definition.
void setFrom(const Unit &unit, const T(&array)[m][n][o])
Definition: BlobValue.h:92
BlobType
Definition: BlobType.h:13
int copyTo(const Unit &unit, T *array, size_t elements)
Definition: BlobValue.cpp:272
Replacement for standard template class string.
Definition: Str.h:12
Definition: BlobType.h:15
void getElement(size_t index, T &value, bool flip)
Get an individual value, without bounds checking or scaling.
Definition: BlobValue.cpp:541
Wraps a StrValue as an arbitrary collection of binary values, with units.
Definition: BlobValue.h:26
Definition: BlobType.h:38
virtual Str toString(const Unit &unit) const
Definition: BlobValue.h:233
void setElement(size_t index, T value, bool flip)
Set an individual value, without bounds checking or scaling.
Definition: BlobValue.cpp:518
const char * cStr() const
Definition: Str.h:188
void setFrom(const Unit &unit, const T(&array)[m][n])
Definition: BlobValue.h:61
bool set(size_t index, const Unit &unit, double value)
Set an individual value.
Definition: BlobValue.cpp:186
static size_t ElementSize(const BlobType &blobType)
Definition: BlobValue.h:30
Unit tests for the BlobValue, BlobReader, and BlobWriter classes.
Definition: Blob_Test.h:25
Code unit that represents a unique name for a DataElement.
Definition: ElementURI.h:27
const char * getName(void) const
Definition: Unit.h:108
void setFrom(const Unit &unit, const T *array, size_t elements)
Definition: BlobValue.cpp:93
int copyTo(const Unit &unit, T(&array)[m][n])
Definition: BlobValue.h:136
Thread-safe ring buffer for storing void pointers.
Definition: RingBuffer.h:36
Wraps a string (see Str) as a DataValue, so strings can be written to and read from the slate...
Definition: StrValue.h:34
Code that represents an engineering unit.
Definition: Unit.h:24
Str value_
Definition: StrValue.h:212
Str & set(const char *str=NULL, size_t length=NO_POS)
Definition: Str.cpp:165