SparseSampling
SparseSampling Accessors
-
OCIndexSetRef SparseSamplingCopyDimensionIndexes(SparseSamplingRef ss)
Copy the set of fixed dimension indexes.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCIndexSetRef copy of indexes (caller must release).
-
bool SparseSamplingSetDimensionIndexes(SparseSamplingRef ss, OCIndexSetRef idxSet)
Set the fixed dimension indexes.
- Parameters:
ss – SparseSamplingRef object.
idxSet – New OCIndexSetRef of indexes. May be NULL to clear.
- Returns:
true on success, false on NULL ss or allocation failure.
-
OCDataRef SparseSamplingCopySparseGridVertexes(SparseSamplingRef ss)
Copy the sparse grid vertices.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCDataRef copy containing flattened vertex coordinate data (caller must release).
-
bool SparseSamplingSetSparseGridVertexes(SparseSamplingRef ss, OCDataRef verts)
Set the sparse grid vertices.
- Parameters:
ss – SparseSamplingRef object.
verts – New OCDataRef containing flattened vertex coordinate data. May be NULL to clear.
- Returns:
true on success, false on NULL ss or allocation failure.
-
bool SparseSamplingSetUnsignedIntegerType(SparseSamplingRef ss, OCNumberType type)
Set the unsigned integer type for indexing.
Only unsigned types are allowed (UInt8, UInt16, UInt32, UInt64).
- Parameters:
ss – SparseSamplingRef object.
type – OCNumberType to set.
- Returns:
true on success, false on NULL ss or invalid type.
-
OCStringRef SparseSamplingCopyEncoding(SparseSamplingRef ss)
Copy the encoding for sparse_grid_vertexes.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCStringRef copy of encoding value (caller must release).
-
bool SparseSamplingSetEncoding(SparseSamplingRef ss, OCStringRef encoding)
Set the encoding for sparse_grid_vertexes.
Must be one of kSparseSamplingEncodingValueNone or kSparseSamplingEncodingValueBase64.
- Parameters:
ss – SparseSamplingRef object.
encoding – OCStringRef encoding to set.
- Returns:
true on success, false on NULL ss or invalid encoding.
-
OCStringRef SparseSamplingCopyDescription(SparseSamplingRef ss)
Copy the human-readable description.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCStringRef copy of description (caller must release). May be empty string.
-
bool SparseSamplingSetDescription(SparseSamplingRef ss, OCStringRef desc)
Set the human-readable description.
- Parameters:
ss – SparseSamplingRef object.
desc – New OCStringRef description. May be NULL to clear.
- Returns:
true on success, false on NULL ss or allocation failure.
-
OCDictionaryRef SparseSamplingGetApplicationMetaData(SparseSamplingRef ss)
Get the metadata dictionary.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCDictionaryRef metadata (caller must not release). May be NULL.
-
OCNumberType SparseSamplingGetUnsignedIntegerType(SparseSamplingRef ss)
Get the unsigned integer type for indexing.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
OCNumberType enumerator.
-
size_t SparseSamplingGetVertexCount(SparseSamplingRef ss)
Get the number of vertices in the sparse grid.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
Number of vertices, or 0 if ss is NULL or empty.
-
OCIndex SparseSamplingGetDimensionCount(SparseSamplingRef ss)
Get the number of dimensions in the sparse grid.
- Parameters:
ss – SparseSamplingRef object.
- Returns:
Number of dimensions, or 0 if ss is NULL or empty.
-
bool SparseSamplingGetVertexAtIndex(SparseSamplingRef ss, OCIndex vertexIndex, OCIndex *outCoords)
Get vertex coordinates at a specific index.
- Parameters:
ss – SparseSamplingRef object.
vertexIndex – Index of the vertex to retrieve.
outCoords – Output array to store vertex coordinates (must be pre-allocated).
- Returns:
true on success, false on error or invalid index.
-
bool SparseSamplingSetApplicationMetaData(SparseSamplingRef ss, OCDictionaryRef metadata)
Set the metadata dictionary.
- Parameters:
ss – SparseSamplingRef object.
metadata – New OCDictionaryRef metadata. May be NULL to clear.
- Returns:
true on success, false on NULL ss or allocation failure.
Defines
-
kSparseSamplingEncodingValueNone
Valid values for the encoding of the sparse_grid_vertexes array.
-
kSparseSamplingEncodingValueBase64
Functions
-
OCTypeID SparseSamplingGetTypeID(void)
Retrieve the OCTypeID for SparseSampling, registering the type on first use.
- Returns:
Unique OCTypeID for SparseSampling.
-
bool validateSparseSampling(SparseSamplingRef ss, OCStringRef *outError)
Validate that a SparseSampling is well-formed.
Checks that
unsignedIntegerTypeis one of the allowed unsigned types,encodingis either “none” or “base64”,dimensionIndexesis non-NULL,sparseGridVertexesis a valid OCIndexPairSetRef.
- Parameters:
ss – The SparseSamplingRef to validate.
outError – If non-NULL, on failure will be set to an OCStringRef describing the first validation error (must be released).
- Returns:
true if
sspasses all checks, false otherwise.
-
SparseSamplingRef SparseSamplingCreate(OCIndexSetRef dimensionIndexes, OCDataRef sparseGridVertexes, OCNumberType unsignedIntegerType, OCStringRef encoding, OCStringRef description, OCDictionaryRef metadata, OCStringRef *outError)
Create a new SparseSampling object.
- Parameters:
dimensionIndexes – An OCIndexSetRef of fixed dimension indexes. If NULL, initializes to empty set.
sparseGridVertexes – An OCDataRef containing flattened sparse grid vertex coordinates as raw integer data.
unsignedIntegerType – The numeric type used for indexing. Must be one of: kOCNumberUInt8Type, kOCNumberUInt16Type, kOCNumberUInt32Type, or kOCNumberUInt64Type.
encoding – Encoding applied to
sparse_grid_vertexes. Must be either kSparseSamplingEncodingValueNone or kSparseSamplingEncodingValueBase64.description – Optional OCStringRef description. May be NULL.
metadata – Optional OCDictionaryRef metadata. May be NULL.
outError – Optional output pointer for error string on failure.
- Returns:
New SparseSamplingRef on success (must be released), NULL on error.
-
OCDictionaryRef SparseSamplingCopyAsDictionary(SparseSamplingRef ss)
Serialize a SparseSampling to an OCDictionary.
- Parameters:
ss – The SparseSamplingRef to serialize.
- Returns:
An OCDictionaryRef representing the object (caller must release).
-
SparseSamplingRef SparseSamplingCreateFromDictionary(OCDictionaryRef dict, OCStringRef *outError)
Create a SparseSampling object from an OCDictionary.
- Parameters:
dict – Source dictionary to parse.
outError – Optional output pointer for error string on failure.
- Returns:
New SparseSamplingRef on success (must be released), NULL on error.
-
cJSON *SparseSamplingCopyAsJSON(SparseSamplingRef ss, bool typed, OCStringRef *outError)
Convert a SparseSamplingRef to cJSON representation.
- Parameters:
ss – The SparseSampling to convert.
typed – Whether to include type information in the JSON.
- Returns:
cJSON object or NULL on error.
-
SparseSamplingRef SparseSamplingCreateFromJSON(cJSON *json, OCStringRef *outError)
Deserialize a SparseSampling from a cJSON object.
- Parameters:
json – cJSON object representing sparse_sampling.
outError – Optional pointer to receive an error string on failure.
- Returns:
New SparseSamplingRef (caller must release), or NULL on error.
-
bool SparseSamplingValidate(SparseSamplingRef ss, OCStringRef *outError)
Validate that a SparseSampling is well-formed.
Checks dimension indexes, vertex arrays, numeric types and encoding.
- Parameters:
ss – The SparseSampling to validate.
outError – Optional pointer to receive an error string on failure.
- Returns:
true if valid, false otherwise.