A wrapper to provide access to C-arrays of objects. More...
#include <mbl_data_array_wrapper.h>
Public Member Functions | |
mbl_data_array_wrapper () | |
Default constructor. | |
mbl_data_array_wrapper (const T *data, unsigned long n) | |
Constructor. | |
mbl_data_array_wrapper (const vcl_vector< T > &data) | |
Constructor. | |
mbl_data_array_wrapper (const mbl_data_array_wrapper< T > &orig) | |
Copy Constructor. | |
void | set (const T *data, unsigned long n) |
Initialise to return elements from data[i]. | |
virtual | ~mbl_data_array_wrapper () |
Default destructor. | |
virtual unsigned long | size () const |
Number of objects available. | |
const T * | data () const |
Return pointer to start of data array. | |
virtual void | reset () |
Reset so that current() returns first object. | |
virtual const T & | current () |
Return current object. | |
virtual bool | next () |
Move to next object, returning true if is valid. | |
virtual unsigned long | index () const |
Return current index. | |
virtual void | set_index (unsigned long n) |
Move to element n. | |
virtual mbl_data_wrapper< T > * | clone () const |
Create copy on heap and return base pointer. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual bool | is_class (vcl_string const &s) const |
True if this is (or is derived from) class named s. | |
Private Attributes | |
const T * | data_ |
unsigned long | n_ |
unsigned long | index_ |
A wrapper to provide access to C-arrays of objects.
Definition at line 17 of file mbl_data_array_wrapper.h.
mbl_data_array_wrapper< T >::mbl_data_array_wrapper | ( | ) |
Default constructor.
Definition at line 15 of file mbl_data_array_wrapper.txx.
mbl_data_array_wrapper< T >::mbl_data_array_wrapper | ( | const T * | data, |
unsigned long | n | ||
) |
Constructor.
Sets up object to return n examples beginning at data[0]. The data must be kept in scope, this does not take a copy.
Definition at line 22 of file mbl_data_array_wrapper.txx.
mbl_data_array_wrapper< T >::mbl_data_array_wrapper | ( | const vcl_vector< T > & | data | ) |
Constructor.
Sets up object to wrap a vcl_vector. The data must be kept in scope, this does not take a copy.
Definition at line 31 of file mbl_data_array_wrapper.txx.
mbl_data_array_wrapper< T >::mbl_data_array_wrapper | ( | const mbl_data_array_wrapper< T > & | orig | ) |
Copy Constructor.
The copy will point to the same data as the original. The data must be kept in scope, this does not take a copy.
Definition at line 45 of file mbl_data_array_wrapper.txx.
mbl_data_array_wrapper< T >::~mbl_data_array_wrapper | ( | ) | [virtual] |
Default destructor.
Definition at line 63 of file mbl_data_array_wrapper.txx.
mbl_data_wrapper< T > * mbl_data_array_wrapper< T >::clone | ( | ) | const [virtual] |
Create copy on heap and return base pointer.
Implements mbl_data_wrapper< T >.
Definition at line 105 of file mbl_data_array_wrapper.txx.
const T & mbl_data_array_wrapper< T >::current | ( | ) | [virtual] |
Return current object.
Implements mbl_data_wrapper< T >.
Definition at line 83 of file mbl_data_array_wrapper.txx.
const T* mbl_data_array_wrapper< T >::data | ( | ) | const [inline] |
Return pointer to start of data array.
Definition at line 53 of file mbl_data_array_wrapper.h.
unsigned long mbl_data_array_wrapper< T >::index | ( | ) | const [virtual] |
Return current index.
First example has index 0
Implements mbl_data_wrapper< T >.
Definition at line 98 of file mbl_data_array_wrapper.txx.
virtual vcl_string mbl_data_array_wrapper< T >::is_a | ( | ) | const [virtual] |
Name of the class.
Implements mbl_data_wrapper< T >.
bool mbl_data_array_wrapper< T >::is_class | ( | vcl_string const & | s | ) | const [virtual] |
True if this is (or is derived from) class named s.
Implements mbl_data_wrapper< T >.
Definition at line 127 of file mbl_data_array_wrapper.txx.
bool mbl_data_array_wrapper< T >::next | ( | ) | [virtual] |
Move to next object, returning true if is valid.
Implements mbl_data_wrapper< T >.
Definition at line 90 of file mbl_data_array_wrapper.txx.
void mbl_data_array_wrapper< T >::reset | ( | ) | [virtual] |
Reset so that current() returns first object.
Implements mbl_data_wrapper< T >.
Definition at line 76 of file mbl_data_array_wrapper.txx.
void mbl_data_array_wrapper< T >::set | ( | const T * | data, |
unsigned long | n | ||
) |
Initialise to return elements from data[i].
Sets up object to return n examples beginning at data[0]. The data must be kept in scope, this does not take a copy.
Definition at line 53 of file mbl_data_array_wrapper.txx.
void mbl_data_array_wrapper< T >::set_index | ( | unsigned long | n | ) | [virtual] |
Move to element n.
First example has index 0
Reimplemented from mbl_data_wrapper< T >.
Definition at line 113 of file mbl_data_array_wrapper.txx.
unsigned long mbl_data_array_wrapper< T >::size | ( | ) | const [virtual] |
Number of objects available.
Implements mbl_data_wrapper< T >.
Definition at line 69 of file mbl_data_array_wrapper.txx.
const T* mbl_data_array_wrapper< T >::data_ [private] |
Definition at line 19 of file mbl_data_array_wrapper.h.
unsigned long mbl_data_array_wrapper< T >::index_ [private] |
Definition at line 21 of file mbl_data_array_wrapper.h.
unsigned long mbl_data_array_wrapper< T >::n_ [private] |
Definition at line 20 of file mbl_data_array_wrapper.h.