Diffusion C API  6.7.4
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
diffusion-recordv2-schema-builder.h File Reference

Typedefs

typedef struct
DIFFUSION_RECORDV2_SCHEMA_BUILDER_T 
DIFFUSION_RECORDV2_SCHEMA_BUILDER_T
 Opaque recordv2 schema builder data type.
 

Functions

DIFFUSION_RECORDV2_SCHEMA_BUILDER_Tdiffusion_recordv2_schema_builder_init ()
 Initialise a new recordv2 schema builder. More...
 
bool diffusion_recordv2_schema_builder_record (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *record_name, DIFFUSION_API_ERROR *error)
 Add a new single occurrence record to the schema. More...
 
bool diffusion_recordv2_schema_builder_record_with_occurs (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *record_name, int occurs, DIFFUSION_API_ERROR *error)
 Add a new single occurrence record to the schema. More...
 
bool diffusion_recordv2_schema_builder_record_with_min_max (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *record_name, int min, int max, DIFFUSION_API_ERROR *error)
 Add a new single occurrence record to the schema. More...
 
bool diffusion_recordv2_schema_builder_string (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, DIFFUSION_API_ERROR *error)
 Add a single occurrence string field to the current record. More...
 
bool diffusion_recordv2_schema_builder_string_with_occurs (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int occurs, DIFFUSION_API_ERROR *error)
 Add a single occurrence string field to the current record. More...
 
bool diffusion_recordv2_schema_builder_string_with_min_max (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int min, int max, DIFFUSION_API_ERROR *error)
 Add a single occurrence string field to the current record. More...
 
bool diffusion_recordv2_schema_builder_integer (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, DIFFUSION_API_ERROR *error)
 Add a single occurrence integer field to the current record. More...
 
bool diffusion_recordv2_schema_builder_integer_with_occurs (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int occurs, DIFFUSION_API_ERROR *error)
 Add a single occurrence integer field to the current record. More...
 
bool diffusion_recordv2_schema_builder_integer_with_min_max (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int min, int max, DIFFUSION_API_ERROR *error)
 Add a single occurrence integer field to the current record. More...
 
bool diffusion_recordv2_schema_builder_decimal (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int scale, DIFFUSION_API_ERROR *error)
 Add a single occurrence decimal field to the current record. More...
 
bool diffusion_recordv2_schema_builder_decimal_with_occurs (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int scale, int occurs, DIFFUSION_API_ERROR *error)
 Add a single occurrence decimal field to the current record. More...
 
bool diffusion_recordv2_schema_builder_decimal_with_min_max (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, const char *field_name, int scale, int min, int max, DIFFUSION_API_ERROR *error)
 Add a single occurrence decimal field to the current record. More...
 
DIFFUSION_RECORDV2_SCHEMA_Tdiffusion_recordv2_schema_builder_build (const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder, DIFFUSION_API_ERROR *error)
 Build an immutable Schema. More...
 
void diffusion_recordv2_schema_builder_free (DIFFUSION_RECORDV2_SCHEMA_BUILDER_T *recordv2_schema_builder)
 Free a recordv2 schema builder. More...
 

Function Documentation

DIFFUSION_RECORDV2_SCHEMA_T* diffusion_recordv2_schema_builder_build ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
DIFFUSION_API_ERROR error 
)

Build an immutable Schema.

At least one record with at least one field must have been added to the builder. diffusion_recordv2_schema_free should be called on this pointer when no longer needed.

Parameters
recordv2_schema_builderthe schema builder
errorpopulated if an error occurs. Can be NULL.
Returns
a new immutable schema object representing the current state of the builder. NULL if an error occurs.
bool diffusion_recordv2_schema_builder_decimal ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  scale,
DIFFUSION_API_ERROR error 
)

Add a single occurrence decimal field to the current record.

This is the equivalent of calling: recordv2_schema_builder_decimal_with_occurs(builder, name, scale, 1).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
scalethe scale of the field (the number of decimal places). This must be a positive value.
errorpopulated if an error occurs. Can be NULL.
Returns
true if the decimal field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_decimal_with_min_max ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  scale,
int  min,
int  max,
DIFFUSION_API_ERROR error 
)

Add a single occurrence decimal field to the current record.

A field may not be added after a field that has variable multiplicity (min != max).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
scalethe scale of the field (the number of decimal places). This must be a positive value.
minthe minimum number of occurrences of the record. This must not be negative.
maxthe maximum number of occurrences of the record. This must either be -1 to indicate an unlimited number or it must be a positive number greater than or equal to "min".
errorpopulated if an error occurs. Can be NULL.
Returns
true if the decimal field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_decimal_with_occurs ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  scale,
int  occurs,
DIFFUSION_API_ERROR error 
)

Add a single occurrence decimal field to the current record.

This is the equivalent of calling: recordv2_schema_builder_decimal_with_min_max(builder, name, scale, occurs, occurs).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
scalethe scale of the field (the number of decimal places). This must be a positive value.
occursthe fixed number of times the field should occur within the record. This must be positive.
errorpopulated if an error occurs. Can be NULL.
Returns
true if the decimal field was successfully added to the schema. False otherwise.
void diffusion_recordv2_schema_builder_free ( DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder)

Free a recordv2 schema builder.

Parameters
recordv2_schema_builderthe schema builder to be freed.
DIFFUSION_RECORDV2_SCHEMA_BUILDER_T* diffusion_recordv2_schema_builder_init ( )

Initialise a new recordv2 schema builder.

diffusion_recordv2_schema_builder_free should be called on this pointer when no longer needed.

Returns
a recordv2 schema builder
bool diffusion_recordv2_schema_builder_integer ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
DIFFUSION_API_ERROR error 
)

Add a single occurrence integer field to the current record.

This is the equivalent of calling: recordv2_schema_builder_integer_with_occurs(builder, name, 1).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
errorpopulated if an error occurs. Can be NULL.
Returns
true if the integer field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_integer_with_min_max ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  min,
int  max,
DIFFUSION_API_ERROR error 
)

Add a single occurrence integer field to the current record.

A field may not be added after a field that has variable multiplicity (min != max).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
minthe minimum number of occurrences of the record. This must not be negative
maxthe maximum number of occurrences of the record. This must either be -1 to indicate an unlimited number or it must be a positive number greater than or equal to "min"
errorpopulated if an error occurs. Can be NULL.
Returns
true if the integer field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_integer_with_occurs ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  occurs,
DIFFUSION_API_ERROR error 
)

Add a single occurrence integer field to the current record.

This is the equivalent to calling: recordv2_schema_builder_integer_with_min_max(builder, name, occurs, occurs).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
occursthe fixed number of times the field should occur within the record. This must be positive
errorpopulated if an error occurs. Can be NULL.
Returns
true if the integer field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_record ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  record_name,
DIFFUSION_API_ERROR error 
)

Add a new single occurrence record to the schema.

This is the equivalent to calling: recordv2_schema_builder_record_with_occurs(builder, name, 1).

Parameters
recordv2_schema_builderthe schema builder
record_namethe record name
errorpopulated if an error occurs. Can be NULL.
Returns
true if the record was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_record_with_min_max ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  record_name,
int  min,
int  max,
DIFFUSION_API_ERROR error 
)

Add a new single occurrence record to the schema.

A field may not be added after a field that has variable multiplicity (min != max).

Parameters
recordv2_schema_builderthe schema builder
record_namethe record name
minthe minimum number of occurrences of the record. This must not be negative
maxthe maximum number of occurrences of the record. This must either be -1 to indicate an unlimited number or it must be a positive number greater than or equal to "min"
errorpopulated if an error occurs. Can be NULL.
Returns
true if the record was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_record_with_occurs ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  record_name,
int  occurs,
DIFFUSION_API_ERROR error 
)

Add a new single occurrence record to the schema.

This is the equivalent to calling: recordv2_schema_builder_record_with_min_max(builder, name, occurs, occurs).

Parameters
recordv2_schema_builderthe schema builder
record_namethe record name
occursthe number of times the record is to occur. This must be apositive value
errorpopulated if an error occurs. Can be NULL.
Returns
true if the record was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_string ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
DIFFUSION_API_ERROR error 
)

Add a single occurrence string field to the current record.

This is the equivalent of calling: recordv2_schema_builder_string_with_occurs(builder, name, 1).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
errorpopulated if an error occurs. Can be NULL.
Returns
true if the string field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_string_with_min_max ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  min,
int  max,
DIFFUSION_API_ERROR error 
)

Add a single occurrence string field to the current record.

A field may not be added after a field that has variable multiplicity (min != max).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
minthe minimum number of occurrences of the record. This must not be negative
maxthe maximum number of occurrences of the record. This must either be -1 to indicate an unlimited number or it must be a positive number greater than or equal to "min"
errorpopulated if an error occurs. Can be NULL.
Returns
true if the string field was successfully added to the schema. False otherwise.
bool diffusion_recordv2_schema_builder_string_with_occurs ( const DIFFUSION_RECORDV2_SCHEMA_BUILDER_T recordv2_schema_builder,
const char *  field_name,
int  occurs,
DIFFUSION_API_ERROR error 
)

Add a single occurrence string field to the current record.

This is the equivalent to calling: recordv2_schema_builder_string_with_min_max(builder, name, occurs, occurs).

Parameters
recordv2_schema_builderthe schema builder
field_namethe field name
occursthe fixed number of times the field should occur within the record. This must be positive.
errorpopulated if an error occurs. Can be NULL.
Returns
true if the string field was successfully added to the schema. False otherwise.