libmapper 2.4.12
Objects

Topics

 Devices
 
 Signals
 
 Maps
 

Functions

mpr_graph mpr_obj_get_graph (mpr_obj object)
 
int mpr_obj_get_status (mpr_obj object)
 
void mpr_obj_reset_status (mpr_obj object)
 
mpr_type mpr_obj_get_type (mpr_obj object)
 
int mpr_obj_get_num_props (mpr_obj object, int staged)
 
mpr_prop mpr_obj_get_prop_by_idx (mpr_obj object, int index, const char **key, int *length, mpr_type *type, const void **value, int *published)
 
mpr_prop mpr_obj_get_prop_by_key (mpr_obj object, const char *key, int *length, mpr_type *type, const void **value, int *published)
 
int mpr_obj_get_prop_as_int32 (mpr_obj object, mpr_prop property, const char *key)
 
int64_t mpr_obj_get_prop_as_int64 (mpr_obj object, mpr_prop property, const char *key)
 
float mpr_obj_get_prop_as_flt (mpr_obj object, mpr_prop property, const char *key)
 
const char * mpr_obj_get_prop_as_str (mpr_obj object, mpr_prop property, const char *key)
 
const void * mpr_obj_get_prop_as_ptr (mpr_obj object, mpr_prop property, const char *key)
 
mpr_obj mpr_obj_get_prop_as_obj (mpr_obj object, mpr_prop property, const char *key)
 
mpr_list mpr_obj_get_prop_as_list (mpr_obj object, mpr_prop property, const char *key)
 
mpr_prop mpr_obj_set_prop (mpr_obj object, mpr_prop property, const char *key, int length, mpr_type type, const void *value, int publish)
 
int mpr_obj_remove_prop (mpr_obj object, mpr_prop property, const char *key)
 
void mpr_obj_push (mpr_obj object)
 
void mpr_obj_print (mpr_obj object, int staged)
 

Detailed Description

Objects provide a generic representation of Graphs, Devices, Signals, and Maps.

Function Documentation

◆ mpr_obj_get_graph()

mpr_graph mpr_obj_get_graph ( mpr_obj object)

Return the internal mpr_graph structure used by an object.

Parameters
objectThe object to query.
Returns
The mpr_graph used by this object.

◆ mpr_obj_get_num_props()

int mpr_obj_get_num_props ( mpr_obj object,
int staged )

Get an object's number of properties.

Parameters
objectThe object to check.
staged1 to include staged properties in the count, 0 otherwise.
Returns
The number of properties stored in the table.

◆ mpr_obj_get_prop_as_flt()

float mpr_obj_get_prop_as_flt ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as a float if possible. Since the returned value cannot represent a missing property it is recommended that this function only be used to recover properties that are guaranteed to exist and have a compatible type.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property cast to float type, or zero if the property does not exist or can't be cast to float.

◆ mpr_obj_get_prop_as_int32()

int mpr_obj_get_prop_as_int32 ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as an integer if possible. Since the returned value cannot represent a missing property it is recommended that this function only be used to recover properties that are guaranteed to exist and have a compatible type.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property cast to integer type, or zero if the property does not exist or can't be cast to int.

◆ mpr_obj_get_prop_as_int64()

int64_t mpr_obj_get_prop_as_int64 ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as an integer if possible. Since the returned value cannot represent a missing property it is recommended that this function only be used to recover properties that are guaranteed to exist and have a compatible type.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property cast to int64_t type, or zero if the property does not exist or can't be cast to int64_t.

◆ mpr_obj_get_prop_as_list()

mpr_list mpr_obj_get_prop_as_list ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as a mpr_list if possible. The returned value is a copy and can be safely modified (e.g. iterated) or freed.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'proerty' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property, or null if the property does not exist or has an incompatible type.

◆ mpr_obj_get_prop_as_obj()

mpr_obj mpr_obj_get_prop_as_obj ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as a mpr_obj if possible. The returned value belongs to the object and should not be freed.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property, or null if the property does not exist or has an incompatible type.

◆ mpr_obj_get_prop_as_ptr()

const void * mpr_obj_get_prop_as_ptr ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as a C pointer if possible. The returned value belongs to the object and should not be freed.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property, or null if the property does not exist or has an incompatible type.

◆ mpr_obj_get_prop_as_str()

const char * mpr_obj_get_prop_as_str ( mpr_obj object,
mpr_prop property,
const char * key )

Look up a property by symbolic identifier or name and return as a C string if possible. The returned value belongs to the object and should not be freed.

Parameters
objectThe object to check.
propertyThe symbolic identifier of the property to recover. Can be set to MPR_UNKNOWN or MPR_EXTRA to specify the property by name instead.
keyA string identifier (name) for the property. Only used if the 'property' argument is set to MPR_UNKNOWN or MPR_EXTRA.
Returns
Value of the property, or null if the property does not exist or has an incompatible type.

◆ mpr_obj_get_prop_by_idx()

mpr_prop mpr_obj_get_prop_by_idx ( mpr_obj object,
int index,
const char ** key,
int * length,
mpr_type * type,
const void ** value,
int * published )

Look up a property by index or one of the symbolic identifiers listed in mpr_constants.h.

Parameters
objectThe object to check.
indexIndex or symbolic identifier of the property to retrieve.
keyA pointer to a location to receive the name of the property value (Optional, pass 0 to ignore).
lengthA pointer to a location to receive the vector length of the property value (Optional, pass 0 to ignore).
typeA pointer to a location to receive the type of the property value (Optional, pass 0 to ignore).
valueA pointer to a location to receive the address of the property's value (Optional, pass 0 to ignore).
publishedA pointer to a location to receive the 'published' flag for this property (Optional, pass 0 to ignore).
Returns
Symbolic identifier of the retrieved property, or MPR_PROP_UNKNOWN if not found.

◆ mpr_obj_get_prop_by_key()

mpr_prop mpr_obj_get_prop_by_key ( mpr_obj object,
const char * key,
int * length,
mpr_type * type,
const void ** value,
int * published )

Look up a property by name.

Parameters
objectThe object to check.
keyThe name of the property to retrieve.
lengthA pointer to a location to receive the vector length of the property value (Optional, pass 0 to ignore).
typeA pointer to a location to receive the type of the property value (Optional, pass 0 to ignore).
valueA pointer to a location to receive the address of the property's value (Optional, pass 0 to ignore).
publishedA pointer to a location to receive the 'published' flag for this property (Optional, pass 0 to ignore).
Returns
Symbolic identifier of the retrieved property, or MPR_PROP_UNKNOWN if not found.

◆ mpr_obj_get_status()

int mpr_obj_get_status ( mpr_obj object)

Return the status bitflags used by an object.

Parameters
objectThe object to query.
Returns
The status bitflags used by this object.

◆ mpr_obj_get_type()

mpr_type mpr_obj_get_type ( mpr_obj object)

Return the specific type of an object.

Parameters
objectThe object to query.
Returns
The object type.

◆ mpr_obj_print()

void mpr_obj_print ( mpr_obj object,
int staged )

Helper to print the properties of an object.

Parameters
objectThe object to print.
staged1 to print staged properties, 0 otherwise.

◆ mpr_obj_push()

void mpr_obj_push ( mpr_obj object)

Push any staged property changes out to the distributed graph.

Parameters
objectThe object to operate on.

◆ mpr_obj_remove_prop()

int mpr_obj_remove_prop ( mpr_obj object,
mpr_prop property,
const char * key )

Remove a property from an object.

Parameters
objectThe object to operate on.
propertySymbolic identifier of the property to remove.
keyThe name of the property to remove.
Returns
1 if property has been removed, 0 otherwise.

◆ mpr_obj_reset_status()

void mpr_obj_reset_status ( mpr_obj object)

Reset the volatile status bitflags used by an object. If the object is a mpr_graph this will also reset the volatile status bits for objects stored in the graph.

Parameters
objectThe object to reset.

◆ mpr_obj_set_prop()

mpr_prop mpr_obj_set_prop ( mpr_obj object,
mpr_prop property,
const char * key,
int length,
mpr_type type,
const void * value,
int publish )

Set a property. Can be used to provide arbitrary metadata. Value pointed to will be copied. Properties can be specified by setting the 'property' argument to one of the symbolic identifiers listed in mpr_constants.h; if 'property' is set to MPR_PROP_UNKNOWN or MPR_PROP_EXTRA the 'name' argument will be used instead.

Parameters
objectThe object to operate on.
propertySymbolic identifier of the property to add.
keyThe name of the property to add.
lengthThe length of value array.
typeThe property datatype.
valueAn array of property values.
publish1 to publish to the distributed graph, 0 for local-only.
Returns
Symbolic identifier of the set property, or MPR_PROP_UNKNOWN if not found.