Vuo 2.4.4
Loading...
Searching...
No Matches
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.
 
#define VuoRange_NoMaximum   INFINITY
 VuoRange.maximum's value when the range has no maximum.
 
#define VuoRange_SUPPORTS_COMPARISON
 Instances of this type can be compared and sorted.
 

Functions

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

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 24 of file VuoRange.h.

◆ VuoRange_NoMinimum

#define VuoRange_NoMinimum   -INFINITY

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

Definition at line 21 of file VuoRange.h.

◆ VuoRange_SUPPORTS_COMPARISON

#define VuoRange_SUPPORTS_COMPARISON

Instances of this type can be compared and sorted.

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 92 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 103 of file VuoRange.h.

◆ VuoRange_getJson()

struct json_object * VuoRange_getJson ( const VuoRange  value)

Encodes value as a JSON object.

Definition at line 51 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 78 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 75 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 69 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 103 of file VuoRange.c.

◆ VuoRange_make()

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

Creates a range.

Definition at line 60 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 39 of file VuoRange.c.

◆ VuoRange_makeNonzero()

static VuoRange VuoRange_makeNonzero ( VuoRange  a) const
inlinestatic

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

Definition at line 90 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 118 of file VuoRange.h.