Datum

group Datum

Object model for a “data point” in an N-D dataset.

Typedefs

typedef struct impl_Datum *DatumRef

Opaque handle for a Datum instance.

Functions

OCTypeID DatumGetTypeID(void)

Retrieve the OCTypeID for Datum.

Returns:

A unique type identifier.

DatumRef DatumCreate(SIScalarRef response, OCIndex dependentVariableIndex, OCIndex componentIndex, OCIndex memOffset, OCTypeRef owner, OCStringRef *outError)

Create a new Datum.

Creates a new Datum object containing a scalar response value with metadata about its position within a dataset structure.

Parameters:
  • response – The primary scalar value (must not be NULL).

  • dependentVariableIndex – Index of the parent DependentVariable.

  • componentIndex – Index of the component within that DV.

  • memOffset – Raw memory‐offset index (for internal use).

  • owner – Weak reference to the owning Dataset object (may be NULL).

  • outError – Optional output parameter for error messages (may be NULL).

Returns:

A new DatumRef, or NULL on allocation/validation failure.

DatumRef DatumCopy(DatumRef theDatum)

Deep-copy an existing Datum.

Parameters:
  • theDatum – The Datum to copy (must not be NULL).

Returns:

A new DatumRef, or NULL on error.

bool DatumHasSameReducedDimensionalities(DatumRef input1, DatumRef input2)

Compare whether two Datums share the same reduced (unit) dimensions.

Both their response scalar and each coordinate scalar must have identical dimensionality (e.g. both “NMR chemical shift” vs. “hertz”).

Parameters:
  • input1 – First Datum.

  • input2 – Second Datum.

Returns:

true if dimensionalities match; false otherwise.

OCIndex DatumGetComponentIndex(DatumRef theDatum)

Get the component index.

Parameters:
  • theDatum – DatumRef to inspect.

Returns:

componentIndex, or kOCNotFound if theDatum is NULL.

void DatumSetComponentIndex(DatumRef theDatum, OCIndex componentIndex)

Set the component index.

Parameters:
  • theDatum – DatumRef to modify.

  • componentIndex – New component index.

OCIndex DatumGetDependentVariableIndex(DatumRef theDatum)

Get the dependent-variable index.

Parameters:
  • theDatum – DatumRef to inspect.

Returns:

dependentVariableIndex, or kOCNotFound if NULL.

void DatumSetDependentVariableIndex(DatumRef theDatum, OCIndex dependentVariableIndex)

Set the dependent-variable index.

Parameters:
  • theDatum – DatumRef to modify.

  • dependentVariableIndex – New DV index.

OCIndex DatumGetMemOffset(DatumRef theDatum)

Get the raw memory‐offset.

Parameters:
  • theDatum – DatumRef to inspect.

Returns:

memOffset, or kOCNotFound if NULL.

void DatumSetMemOffset(DatumRef theDatum, OCIndex memOffset)

Set the raw memory‐offset.

Parameters:
  • theDatum – DatumRef to modify.

  • memOffset – New offset value.

OCTypeRef DatumGetCoordinateAtIndex(DatumRef theDatum, OCIndex index)

Retrieve a coordinate scalar by index.

Parameters:
  • theDatum – DatumRef to inspect.

  • index – Zero-based coordinate index.

Returns:

OCTypeRef (SIScalarRef) at that index, or NULL on error.

SIScalarRef DatumCreateResponse(DatumRef theDatum)

Create a standalone copy of the response scalar.

Parameters:
  • theDatum – DatumRef to inspect.

Returns:

New SIScalarRef copy, or NULL on error.

OCIndex DatumCoordinatesCount(DatumRef theDatum)

Number of coordinate scalars.

Parameters:
  • theDatum – DatumRef to inspect.

Returns:

Count of coordinates, or 0 if none/NULL.

OCDictionaryRef DatumCopyAsDictionary(DatumRef theDatum)

Serialize this Datum into a deep‐copyable dictionary.

Keys:

  • ”dependent_variable_index” (number)

  • ”component_index” (number)

  • ”mem_offset” (number)

  • ”response” (string scalar expression)

  • ”coordinates” (array of string scalar expressions)

Parameters:
  • theDatum – DatumRef to serialize.

Returns:

New OCDictionaryRef; caller must OCRelease().

DatumRef DatumCreateFromDictionary(OCDictionaryRef dictionary, OCStringRef *error)

Reconstruct a Datum from a dictionary produced by DatumCopyAsDictionary().

Parameters:
  • dictionary – Source dictionary.

  • error – Optional output error string.

Returns:

DatumRef or NULL on parse/validation error.

group DatumJSON

Schema‐bound JSON I/O for Datum via cJSON.

Functions

cJSON *DatumCopyAsJSON(DatumRef theDatum, bool typed, OCStringRef *outError)

Convert a DatumRef to cJSON representation.

Parameters:
  • theDatum – The Datum to convert.

  • typed – Whether to include type information in the JSON.

  • outError – Optional output parameter for error messages (may be NULL).

Returns:

cJSON object or NULL on error.

DatumRef DatumCreateFromJSON(cJSON *json, OCStringRef *outError)

Construct a DatumRef directly from cJSON.

Implements: dict = DatumDictionaryCreateFromJSON(json, outError); datum = DatumCreateFromDictionary(dict, outError);

Parameters:
  • json – cJSON object representing a Datum.

  • outError – Optional output error string.

Returns:

DatumRef or NULL on error.