sequence

The sequence is a simple "vector of numbers" data structure. More...

## Typedefs

typedef struct stp_sequence | stp_sequence_t
| The sequence opaque data type. More...

## Functions

stp_sequence_t * | stp_sequence_create (void)
| Create a new sequence. More...
void | stp_sequence_destroy (stp_sequence_t *sequence)
| Destroy a sequence. More...
void | stp_sequence_copy (stp_sequence_t *dest, const stp_sequence_t *source)
| Copy a sequence. More...
stp_sequence_t * | stp_sequence_create_copy (const stp_sequence_t *sequence)
| Copy and allocate a sequence. More...
void | stp_sequence_reverse (stp_sequence_t *dest, const stp_sequence_t *source)
| Reverse a sequence. More...
stp_sequence_t * | stp_sequence_create_reverse (const stp_sequence_t *sequence)
| Reverse and allocate a sequence. More...
int | stp_sequence_set_bounds (stp_sequence_t *sequence, double low, double high)
| Set the lower and upper bounds. More...
void | stp_sequence_get_bounds (const stp_sequence_t *sequence, double *low, double *high)
| Get the lower and upper bounds. More...
void | stp_sequence_get_range (const stp_sequence_t *sequence, double *low, double *high)
| Get range of values stored in the sequence. More...
int | stp_sequence_set_size (stp_sequence_t *sequence, size_t size)
| Set the sequence size. More...
size_t | stp_sequence_get_size (const stp_sequence_t *sequence)
| Get the sequence size. More...
int | stp_sequence_set_data (stp_sequence_t *sequence, size_t count, const double *data)
| Set the data in a sequence. More...
int | stp_sequence_set_subrange (stp_sequence_t *sequence, size_t where, size_t size, const double *data)
| Set the data in a subrange of a sequence. More...
void | stp_sequence_get_data (const stp_sequence_t *sequence, size_t *size, const double **data)
| Get the data in a sequence. More...
int | stp_sequence_set_point (stp_sequence_t *sequence, size_t where, double data)
| Set the data at a single point in a sequence. More...
int | stp_sequence_get_point (const stp_sequence_t *sequence, size_t where, double *data)
| Get the data at a single point in a sequence. More...
int | stp_sequence_set_float_data (stp_sequence_t *sequence, size_t count, const float *data)
| Set the data in a sequence from float values. More...
int | stp_sequence_set_long_data (stp_sequence_t *sequence, size_t count, const long *data)
| Set the data in a sequence from long values. More...
int | stp_sequence_set_ulong_data (stp_sequence_t *sequence, size_t count, const unsigned long *data)
| Set the data in a sequence from unsigned long values. More...
int | stp_sequence_set_int_data (stp_sequence_t *sequence, size_t count, const int *data)
| Set the data in a sequence from int values. More...
int | stp_sequence_set_uint_data (stp_sequence_t *sequence, size_t count, const unsigned int *data)
| Set the data in a sequence from unsigned int values. More...
int | stp_sequence_set_short_data (stp_sequence_t *sequence, size_t count, const short *data)
| Set the data in a sequence from short values. More...
int | stp_sequence_set_ushort_data (stp_sequence_t *sequence, size_t count, const unsigned short *data)
| Set the data in a sequence from unsigned short values. More...
const float * | stp_sequence_get_float_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as float data. More...
const long * | stp_sequence_get_long_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as long data. More...
const unsigned long * | stp_sequence_get_ulong_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as unsigned long data. More...
const int * | stp_sequence_get_int_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as int data. More...
const unsigned int * | stp_sequence_get_uint_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as unsigned int data. More...
const short * | stp_sequence_get_short_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as short data. More...
const unsigned short * | stp_sequence_get_ushort_data (const stp_sequence_t *sequence, size_t *count)
| Get the data in a sequence as unsigned short data. More...

## Detailed Description

The sequence is a simple "vector of numbers" data structure.

## Typedef Documentation

## stp_sequence_t

typedef struct stp_sequence stp_sequence_t

The sequence opaque data type.

## Function Documentation

## stp_sequence_copy()

void stp_sequence_copy | ( | stp_sequence_t * | dest,
|  | const stp_sequence_t * | source
| ) |  |

Copy a sequence.

Both dest and source must be valid sequences previously created with stp_sequence_create().

Parameters

  dest | the destination sequence.
  source | the source sequence.

## stp_sequence_create()

stp_sequence_t* stp_sequence_create | ( | void |  | ) |

Create a new sequence.

Returns
  the newly created sequence.

## stp_sequence_create_copy()

stp_sequence_t* stp_sequence_create_copy | ( | const stp_sequence_t * | sequence | ) |

Copy and allocate a sequence.

A new sequence will be created, and then the contents of source will be copied into it. The destination must not have been previously allocated with stp_sequence_create().

Parameters

  sequence | the source sequence.

Returns
  the new copy of the sequence.

## stp_sequence_create_reverse()

stp_sequence_t* stp_sequence_create_reverse | ( | const stp_sequence_t * | sequence | ) |

Reverse and allocate a sequence.

A new sequence will be created, and then the contents of source will be copied into it. The destination must not have been previously allocated with stp_sequence_create().

Parameters

  sequence | the source sequence.

Returns
  the new copy of the sequence.

## stp_sequence_destroy()

void stp_sequence_destroy | ( | stp_sequence_t * | sequence | ) |

Destroy a sequence.

It is an error to destroy the sequence more than once.

Parameters

  sequence | the sequence to destroy.

## stp_sequence_get_bounds()

void stp_sequence_get_bounds | ( | const stp_sequence_t * | sequence,
|  | double * | low,
|  | double * | high
| ) |  |

Get the lower and upper bounds.

The values are stored in the variables pointed to by low and high.

Parameters

  sequence | the sequence to work on.
  low | a pointer to a double to store the low bound in.
  high | a pointer to a double to store the high bound in.

## stp_sequence_get_data()

void stp_sequence_get_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | size,
|  | const double ** | data
| ) |  |

Get the data in a sequence.

Parameters

  sequence | the sequence to get the data from.
  size | the number of elements in the sequence are stored in the size_t pointed to.
  data | a pointer to the first element of an sequence of doubles is stored in a pointer to double*. stp_sequence_t *sequence; size_t size; double *data; stp_sequence_get_data(sequence, &size, &data);

## stp_sequence_get_float_data()

const float* stp_sequence_get_float_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as float data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of floats is stored in a pointer to float*.

## stp_sequence_get_int_data()

const int* stp_sequence_get_int_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as int data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of ints is stored in a pointer to int*.

## stp_sequence_get_long_data()

const long* stp_sequence_get_long_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as long data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of longs is stored in a pointer to long*.

## stp_sequence_get_point()

int stp_sequence_get_point | ( | const stp_sequence_t * | sequence,
|  | size_t | where,
|  | double * | data
| ) |  |

Get the data at a single point in a sequence.

Parameters

  sequence | the sequence to use.
  where | the location (indexed from zero).
  data | the datum is stored in the double pointed to.

Returns
  1 on success, 0 on failure.

## stp_sequence_get_range()

void stp_sequence_get_range | ( | const stp_sequence_t * | sequence,
|  | double * | low,
|  | double * | high
| ) |  |

Get range of values stored in the sequence.

The values are stored in the variables pointed to by low and high.

Parameters

  sequence | the sequence to work on.
  low | a pointer to a double to store the low bound in.
  high | a pointer to a double to store the high bound in.

## stp_sequence_get_short_data()

const short* stp_sequence_get_short_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as short data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of shorts is stored in a pointer to short*.

## stp_sequence_get_size()

size_t stp_sequence_get_size | ( | const stp_sequence_t * | sequence | ) |

Get the sequence size.

Returns
  the sequence size.

## stp_sequence_get_uint_data()

const unsigned int* stp_sequence_get_uint_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as unsigned int data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of unsigned ints is stored in a pointer to unsigned int*.

## stp_sequence_get_ulong_data()

const unsigned long* stp_sequence_get_ulong_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as unsigned long data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of unsigned longs is stored in a pointer to unsigned long*.

## stp_sequence_get_ushort_data()

const unsigned short* stp_sequence_get_ushort_data | ( | const stp_sequence_t * | sequence,
|  | size_t * | count
| ) |  |

Get the data in a sequence as unsigned short data.

The pointer returned is owned by the curve, and is not guaranteed to be valid beyond the next non-const curve call; If the bounds of the curve exceed the limits of the data type, NULL is returned.

Parameters

  sequence | the sequence to get the data from.
  count | the number of elements in the sequence are stored in the size_t pointed to.

Returns
  a pointer to the first element of an sequence of unsigned shorts is stored in a pointer to unsigned short*.

## stp_sequence_reverse()

void stp_sequence_reverse | ( | stp_sequence_t * | dest,
|  | const stp_sequence_t * | source
| ) |  |

Reverse a sequence.

Both dest and source must be valid sequences previously created with stp_sequence_create().

Parameters

  dest | the destination sequence.
  source | the source sequence.

## stp_sequence_set_bounds()

int stp_sequence_set_bounds | ( | stp_sequence_t * | sequence,
|  | double | low,
|  | double | high
| ) |  |

Set the lower and upper bounds.

The lower and upper bounds set the minimum and maximum values that a point in the sequence may hold.

Parameters

  sequence | the sequence to work on.
  low | the lower bound.
  high | the upper bound.

Returns
  1 on success, or 0 if the lower bound is greater than the upper bound.

## stp_sequence_set_data()

int stp_sequence_set_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const double * | data
| ) |  |

Set the data in a sequence.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_float_data()

int stp_sequence_set_float_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const float * | data
| ) |  |

Set the data in a sequence from float values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_int_data()

int stp_sequence_set_int_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const int * | data
| ) |  |

Set the data in a sequence from int values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_long_data()

int stp_sequence_set_long_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const long * | data
| ) |  |

Set the data in a sequence from long values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_point()

int stp_sequence_set_point | ( | stp_sequence_t * | sequence,
|  | size_t | where,
|  | double | data
| ) |  |

Set the data at a single point in a sequence.

Parameters

  sequence | the sequence to use.
  where | the location (indexed from zero).
  data | the datum to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_short_data()

int stp_sequence_set_short_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const short * | data
| ) |  |

Set the data in a sequence from short values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_size()

int stp_sequence_set_size | ( | stp_sequence_t * | sequence,
|  | size_t | size
| ) |  |

Set the sequence size.

The size is the number of elements the sequence contains. Note that resizing will destroy all data contained in the sequence.

Parameters

  sequence | the sequence to work on.
  size | the size to set the sequence to.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_subrange()

int stp_sequence_set_subrange | ( | stp_sequence_t * | sequence,
|  | size_t | where,
|  | size_t | size,
|  | const double * | data
| ) |  |

Set the data in a subrange of a sequence.

Parameters

  sequence | the sequence to set.
  where | the starting element in the sequence (indexed from 0).
  size | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_uint_data()

int stp_sequence_set_uint_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const unsigned int * | data
| ) |  |

Set the data in a sequence from unsigned int values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_ulong_data()

int stp_sequence_set_ulong_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const unsigned long * | data
| ) |  |

Set the data in a sequence from unsigned long values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

## stp_sequence_set_ushort_data()

int stp_sequence_set_ushort_data | ( | stp_sequence_t * | sequence,
|  | size_t | count,
|  | const unsigned short * | data
| ) |  |

Set the data in a sequence from unsigned short values.

Parameters

  sequence | the sequence to set.
  count | the number of elements in the data.
  data | a pointer to the first member of a sequence containing the data to set.

Returns
  1 on success, 0 on failure.

stp_sequence_t
struct stp_sequence stp_sequence_t
The sequence opaque data type.
Definition: sequence.h:48
stp_sequence_get_data
void stp_sequence_get_data(const stp_sequence_t *sequence, size_t *size, const double **data)
Get the data in a sequence.