Vuo  2.3.2
Functions

Description

Functions to serialize, unserialize, and summarize values of the type.

Replace "MyType" with the name of your type.

Functions

MyType MyType_makeFromJson (json_object *js)
 Creates a new MyType value by unserializing a JSON-C object. More...
 
json_objectMyType_getJson (const MyType value)
 Serializes a MyType value to a JSON-C object. More...
 
struct json_objectMyType_getInterprocessJson (const MyType value)
 Serializes a MyType value to a JSON-formatted string, in a format that will allow another process to unserialize it. More...
 
VuoList_MyType MyType_getAllowedValues (void)
 Returns a list of values that instances of this type can have. More...
 
char * MyType_getSummary (const MyType value)
 Returns a brief description of a value. More...
 
MyType MyType_makeFromString (const char *str)
 Creates a new MyType value by unserializing a JSON-formatted string. More...
 
char * MyType_getString (const MyType value)
 Serializes a MyType value to a JSON-formatted string. More...
 
char * MyType_getInterprocessString (const MyType value)
 Serializes a MyType value to a JSON-formatted string, in a format that will allow another process to unserialize it. More...
 
void MyType_retain (const MyType value)
 Increments the reference count of a value or its fields, if needed. More...
 
void MyType_release (const MyType value)
 Decrements the reference count of a value or its fields, if needed. More...
 

Function Documentation

◆ MyType_getAllowedValues()

VuoList_MyType MyType_getAllowedValues ( void  )

Returns a list of values that instances of this type can have.

The values returned by this function are shown in input editor menus, in the order specified.

The type may have other values not returned by this function (for example, if the values were allowed in older versions of the type, but are not allowed now).

This function is required for enum types, and should only be defined for types whose sizeof() = 4 (enum, int64_t, void *, char *, etc).

◆ MyType_getInterprocessJson()

struct json_object* MyType_getInterprocessJson ( const MyType  value)

Serializes a MyType value to a JSON-formatted string, in a format that will allow another process to unserialize it.

If this function is implemented, then MyType_makeFromJson() needs to handle both the format returned by this function and the format returned by MyType_getJson().

This function is optional.

Parameters
valueThe value to serialize. May be null.
Returns
A JSON-C object. It should have a format accepted by MyType_makeFromJson().
See also
VuoImage

◆ MyType_getInterprocessString()

char* MyType_getInterprocessString ( const MyType  value)

Serializes a MyType value to a JSON-formatted string, in a format that will allow another process to unserialize it.

Calls MyType_getInterprocessJson().

This function is automatically generated by the Vuo compiler (but only if MyType_getInterprocessJson() exists). Do not implement it. If this function needs to be called by MyType or other code, then declare it in MyType.

Parameters
valueThe value to serialize.
Returns
A JSON-formatted string representation of the value. The caller is responsible for freeing the string.

◆ MyType_getJson()

json_object* MyType_getJson ( const MyType  value)

Serializes a MyType value to a JSON-C object.

This function is required.

If this function serializes the value in a format that won't allow another process to unserialize it (for example, if the serialization contains a memory address), then MyType_getInterprocessJson() needs to be implemented, too.

Parameters
valueThe value to serialize. May be null.
Returns
A JSON-C object. It should have a format accepted by MyType_makeFromJson().

◆ MyType_getString()

char* MyType_getString ( const MyType  value)

Serializes a MyType value to a JSON-formatted string.

Calls MyType_getJson().

This function is automatically generated by the Vuo compiler. Do not implement it. If this function needs to be called by MyType or other code, then declare it in MyType.

Parameters
valueThe value to serialize.
Returns
A JSON-formatted string representation of the value. The caller is responsible for freeing the string.

◆ MyType_getSummary()

char* MyType_getSummary ( const MyType  value)

Returns a brief description of a value.

This function is required.

For enum types, the string returned by this function is shown in input editor menus.

Parameters
valueThe value to summarize. May be null.
Returns
The summary. It should be heap-allocated; the caller is responsible for freeing it.

◆ MyType_makeFromJson()

MyType MyType_makeFromJson ( json_object js)

Creates a new MyType value by unserializing a JSON-C object.

This function is required.

Parameters
jsA JSON-C object from MyType_getJson() (or MyType_interprocesJsonFromValue() if it exists), from a constant input port value defined in a composition, or from a default input port value defined in a node class implementation.
Returns
The unserialized value. For heap-allocated types, this function should register the value with VuoRegister().

◆ MyType_makeFromString()

MyType MyType_makeFromString ( const char *  str)

Creates a new MyType value by unserializing a JSON-formatted string.

Calls MyType_makeFromJson().

This function is automatically generated by the Vuo compiler. Do not implement it. If this function is called by MyType or other code, then declare it in MyType.

Parameters
strA JSON-formatted string.
Returns
The unserialized value, registered with the reference-counting system if needed.

◆ MyType_release()

void MyType_release ( const MyType  value)

Decrements the reference count of a value or its fields, if needed.

  • If MyType is a pointer, this function calls VuoRelease() on value.
  • If MyType is a struct, this function calls VuoRelease() on each field of value that is a pointer.
  • Otherwise, this function does nothing.

This function is automatically generated by the Vuo compiler. Do not implement it. If this function needs to be called by MyType or other code, then declare it in MyType.

◆ MyType_retain()

void MyType_retain ( const MyType  value)

Increments the reference count of a value or its fields, if needed.

  • If MyType is a pointer, this function calls VuoRetain() on value.
  • If MyType is a struct, this function calls VuoRetain() on each field of value that is a pointer.
  • Otherwise, this function does nothing.

This function is automatically generated by the Vuo compiler. Do not implement it. If this function needs to be called by MyType or other code, then declare it in MyType.