Vuo  2.3.2
Classes | Macros | Functions
VuoRange.h File Reference

Description

VuoRange C type definition.

Definition in file VuoRange.h.

Go to the source code of this file.

Classes

struct  VuoRange
 Defines a range with an optionally bound/unbound min/max. More...
 

Macros

#define VuoRange_NoMinimum   -INFINITY
 VuoRange.minimum's value when the range has no minimum. More...
 
#define VuoRange_NoMaximum   INFINITY
 VuoRange.maximum's value when the range has no maximum. More...
 
#define VuoRange_SUPPORTS_COMPARISON
 This type has _areEqual() and _isLessThan() functions. More...
 

Functions

VuoRange VuoRange_makeFromJson (struct json_object *js)
 Decodes the JSON object js to create a new value. More...
 
struct json_objectVuoRange_getJson (const VuoRange value)
 Encodes value as a JSON object. More...
 
char * VuoRange_getSummary (const VuoRange value)
 Returns a compact string representation of value. More...
 
bool VuoRange_areEqual (const VuoRange a, const VuoRange b)
 Returns true if the two ranges are equal (within a small tolerance). More...
 
bool VuoRange_isLessThan (const VuoRange a, const VuoRange b)
 Returns true if a < b. More...
 
static VuoRange VuoRange_make (VuoReal _minimum, VuoReal _maximum) __attribute__((const))
 Creates a range. More...
 
static bool VuoRange_isInverted (VuoRange range) __attribute__((const))
 Returns true if the range is inverted (min greater than max). More...
 
static VuoRange VuoRange_getOrderedRange (VuoRange range) __attribute__((const))
 Returns a range where the min is never greater than the max. More...
 
static VuoRange VuoRange_makeNonzero (VuoRange a) __attribute__((const))
 If the range is empty (minimum == maximum), increases the maximum. More...
 
static VuoReal VuoRange_clamp (VuoRange range, VuoReal value) __attribute__((const))
 Returns a value clamped to range. More...
 
static VuoReal VuoRange_scale (VuoRange from, VuoRange to, VuoReal value) __attribute__((const))
 Returns a value scaled to range. More...
 
VuoRange VuoRange_makeFromString (const char *str)
 Automatically generated function. More...
 
char * VuoRange_getString (const VuoRange value)
 Automatically generated function. More...
 
void VuoRange_retain (VuoRange value)
 Automatically generated function. More...
 
void VuoRange_release (VuoRange value)
 Automatically generated function. More...
 

Class Documentation

◆ VuoRange

struct VuoRange
Class Members
VuoReal maximum
VuoReal minimum

Macro Definition Documentation

◆ VuoRange_NoMaximum

#define VuoRange_NoMaximum   INFINITY

VuoRange.maximum's value when the range has no maximum.

Definition at line 19 of file VuoRange.h.

◆ VuoRange_NoMinimum

#define VuoRange_NoMinimum   -INFINITY

VuoRange.minimum's value when the range has no minimum.

Definition at line 16 of file VuoRange.h.

◆ VuoRange_SUPPORTS_COMPARISON

#define VuoRange_SUPPORTS_COMPARISON

This type has _areEqual() and _isLessThan() functions.

Definition at line 38 of file VuoRange.h.

Function Documentation

◆ VuoRange_areEqual()

bool VuoRange_areEqual ( const VuoRange  a,
const VuoRange  b 
)

Returns true if the two ranges are equal (within a small tolerance).

Changed in Vuo 2.0.0:
New.

Definition at line 91 of file VuoRange.c.

◆ VuoRange_clamp()

static VuoReal VuoRange_clamp ( VuoRange  range,
VuoReal  value 
) const
inlinestatic

Returns a value clamped to range.

Changed in Vuo 2.0.0:
New.

Definition at line 99 of file VuoRange.h.

◆ VuoRange_getJson()

struct json_object* VuoRange_getJson ( const VuoRange  value)

Encodes value as a JSON object.

Definition at line 50 of file VuoRange.c.

◆ VuoRange_getOrderedRange()

static VuoRange VuoRange_getOrderedRange ( VuoRange  range) const
inlinestatic

Returns a range where the min is never greater than the max.

Definition at line 74 of file VuoRange.h.

◆ VuoRange_getString()

char* VuoRange_getString ( const VuoRange  value)

Automatically generated function.

◆ VuoRange_getSummary()

char* VuoRange_getSummary ( const VuoRange  value)

Returns a compact string representation of value.

Definition at line 74 of file VuoRange.c.

◆ VuoRange_isInverted()

static bool VuoRange_isInverted ( VuoRange  range) const
inlinestatic

Returns true if the range is inverted (min greater than max).

Definition at line 65 of file VuoRange.h.

◆ VuoRange_isLessThan()

bool VuoRange_isLessThan ( const VuoRange  a,
const VuoRange  b 
)

Returns true if a < b.

Changed in Vuo 2.0.0:
New.

Definition at line 102 of file VuoRange.c.

◆ VuoRange_make()

static VuoRange VuoRange_make ( VuoReal  _minimum,
VuoReal  _maximum 
) const
inlinestatic

Creates a range.

Definition at line 56 of file VuoRange.h.

◆ VuoRange_makeFromJson()

VuoRange VuoRange_makeFromJson ( json_object js)

Decodes the JSON object js to create a new value.

Example:
{
"minimum" : 0.0,
"maximum" : 42.0
}

Definition at line 38 of file VuoRange.c.

◆ VuoRange_makeFromString()

VuoRange VuoRange_makeFromString ( const char *  str)

Automatically generated function.

◆ VuoRange_makeNonzero()

static VuoRange VuoRange_makeNonzero ( VuoRange  a) const
inlinestatic

If the range is empty (minimum == maximum), increases the maximum.

Definition at line 86 of file VuoRange.h.

◆ VuoRange_release()

void VuoRange_release ( VuoRange  value)

Automatically generated function.

◆ VuoRange_retain()

void VuoRange_retain ( VuoRange  value)

Automatically generated function.

◆ VuoRange_scale()

static VuoReal VuoRange_scale ( VuoRange  from,
VuoRange  to,
VuoReal  value 
) const
inlinestatic

Returns a value scaled to range.

If value is outside of from bounds it will be clamped. If either range contains an infinite bound value is returned unmodified.

Changed in Vuo 2.0.0:
New.

Definition at line 114 of file VuoRange.h.