libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
das_datum Struct Reference

#include <das2/datum.h>

Detailed Description

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:

* das_datum dd;
* das_datum_Numeric(&dt, "2017-01-02T12:14");
*
* int year = ((*das_time)(&dd))->year;
*
* // This works
* das_datum_Double(&dd, "2.145 meters");
* double length = *((*double)dd);
*
*

The documentation for this struct was generated from the following file: