libdas2
das2 core C utilities
|
#include <das2/datum.h>
A value and it's units.
Datum objects can be created as stack variables. For any object up to sizeof(das_time) all memory is internal and the plain old C equals (=) operator can be used to assign the contents of one datum to another.
For larger objects an external constant pointer is used to denote the value. So copy by = still works. Use das_datum_islocal() to determine if the datum value is contained in local memory or if it's an external reference.
Datums have thier byte array stored first in their structure so it is possible to cast pointers to datums as pointers to their type if the type is known. For example: