ml_int_array Class Reference

Class definition for ml_int_array.

List of all members.

Public Member Functions

 ml_int_array ()
 Default constructor.

 ml_int_array (int msize, const int *v=NULL)
 Creates a ml_int_array of a given size and loads the values from array v.

 ml_int_array (const ml_int_array &a)
 Copy constructor.

 ml_int_array (int start, int finish)
 Creates a ml_int_array sequence ranging from start to finish.

 ml_int_array (char *s)
 Constructs a ml_int_array from a string format as used in MATLAB.

 ml_int_array (void *bf)
 Constructs a ml_int_array from a binary buffer.

int get (int index) const
 Accesses an element. Will not resize the ml_int_array.

int & operator() (int index)
 Accesses an element by its index. Resizes for out of bounds access.

void operator= (int *vals)
 Reassigns the values of the ml_int_array to those in the given array.

void operator= (int val)
 Sets the ml_int_array equal to an integer changes the size to 1.

ml_int_arrayoperator= (const ml_int_array &a)
 Sets the ml_int_array equal to the given ml_int_array.

int length () const
 Returns the length of the ml_int_array.

int is_empty () const
 Checks the size of the array, returns 1 unless the ml_int_array is empty.

ml_int_array find (ml_comparison op, int target) const
 Returns a ml_int_array of all indices in the ml_int_array for which the given operator and operand is true.

void display (char *s=NULL) const
 Display function. Formats the ml_int_array in a human readable fashion and prints to standard out.

char * to_string ()
 Returns a string representations of the data structure.

void * to_binary (unsigned short *size=NULL) const
 Creates a binary form of the ml_int_array for interprocess communication.

int is_unique () const
 Determines whether the all the elements in the ml_int_array are unique.

int sum () const
 Returns the sum of all the values in the ml_int_array.

int * get_c_arr (int &s) const
 Converts the ml_int_array into a standard C array.

int operator== (const ml_int_array &a)
 Tests two int_arrays for equality.

int operator!= (const ml_int_array &a)
 Tests two int_arrays for in-equality.

ml_int_array subset (int start, int end)
 Returns an int array of the specified subset of the original array.

ml_int_array subset (const ml_int_array &indices)
 Returns an int array of the elements in the passed ml_int_array, in the specified order.

void sort (int direction=0)
 Sorts all the elements of the ml_int_array. Ascending order is the default, pass a non-zero value for descending sort.

void remove (const ml_int_array &indices)
 Removes the indices in the given ml_int_array and resizes the ml_int_array downwards.

void remove (int index)
 Removes the element at the specified index and resizes the ml_int_array downwards.

void append (ml_int_array b)
 Appends the given ml_int_array to the end of the "this" array.

void append (int val)
 Appends the given integer to the end of the ml_int_array.

void insert (int index, int val)
 Inserts a value at an arbitrary location in the ml_int_array.

void zero ()
 Sets all elements of the ml_int_array to zero.

void ones ()
 Sets all elements of the ml_int_array to one.

void fliplr ()
 Flips the elements of the array.

void setdiff (const ml_int_array &b)
 Removes the elements in B from the array, then sorts the remainder.