das2C
das core C utilities (v3)
Loading...
Searching...
No Matches
Data Structures | Macros
variable.h File Reference

The DasVar layer: named values with formalisms. More...

#include <das3/descriptor.h>
#include <das3/buffer.h>
#include <das3/datum.h>
#include <das3/units.h>
#include <das3/generator.h>
#include <das3/form.h>
Include dependency graph for variable.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  DasVarComp
 The numeric component run: DasVarComp, the <composite> element. More...
 

Macros

#define DasVar_formIs(P, VT)   (((P) != NULL)&&DasForm_isKind(DasVar_form(P), VT))
 Is this variable's formalism the given kind?
 
#define DasVar_allVals(P, R)   DasVar_subset((P), (R), NULL, NULL, NULL)
 Every value this variable has, in its own shape.
 
#define DasVar_hasAry(P)   (DasVar_getAry(P) != NULL)
 Is there a backing store under this variable?
 

Detailed Description

The DasVar layer: named values with formalisms.

XML snippets show the stream form of each type right next to the struct that carries it.

A word that recurs here: affine. The point formalism marks ABSOLUTE values, positions measured from an agreed origin, calendar time being the canonical case. For such values differences are meaningful but sums are not: point - point = interval, point + interval = point, and point + point is refused (adding two calendar dates means nothing). Mathematics calls a space with exactly these rules affine, and the word is used in that precise sense throughout this layer. Measurement theory calls the same idea an interval scale, but das uses "interval" for the difference quantity itself, so affine it is.

The wire side of all this is written up in schema/das2c_operations.md.

Macro Definition Documentation

◆ DasVar_formIs

#define DasVar_formIs (   P,
  VT 
)    (((P) != NULL)&&DasForm_isKind(DasVar_form(P), VT))

Is this variable's formalism the given kind?

A shortcut for DasForm_isKind() so that code working with variables need not pull out the formalism first. Each formalism header defines a macro for its virtual table, use those here. For example

#define DAS_FORM_GEOLOC
A position measured from the center of some body.
Definition form_geoloc.h:131
#define DasVar_formIs(P, VT)
Is this variable's formalism the given kind?
Definition variable.h:195
Returns
true if the formalisms match. A null variable returns false, as do strings and blobs, which carry no formalism at all.

◆ DasVar_allVals

#define DasVar_allVals (   P,
 
)    DasVar_subset((P), (R), NULL, NULL, NULL)

Every value this variable has, in its own shape.

The common case: no bounds, no model. "get" is deliberately absent from this name – DasVar_get() returns one datum and DasVar_getAry() returns the backing store, so a third DasVar_get* returning a computed array would be one letter and one wrong guess away from either.

◆ DasVar_hasAry

#define DasVar_hasAry (   P)    (DasVar_getAry(P) != NULL)

Is there a backing store under this variable?

The predicate form of DasVar_getAry(), for the many call sites that only want the yes/no. false means every value is computed on demand.