Public Member Functions | Private Attributes
mbl_selected_data_wrapper< T > Class Template Reference

A subset of an existing mbl_data_wrapper. More...

#include <mbl_selected_data_wrapper.h>

Inheritance diagram for mbl_selected_data_wrapper< T >:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 mbl_selected_data_wrapper (const mbl_selected_data_wrapper< T > &p)
 Copy constructor.
 mbl_selected_data_wrapper (const mbl_data_wrapper< T > &data, const vcl_vector< unsigned > &subset)
 Constructor.
 mbl_selected_data_wrapper ()
 Default constructor.
virtual ~mbl_selected_data_wrapper ()
 Default destructor.
mbl_selected_data_wrapper< T > & operator= (const mbl_selected_data_wrapper< T > &b)
 Copy operator.
void set (const mbl_data_wrapper< T > &data, const vcl_vector< unsigned > &selection)
 Set the wrappers data.
virtual unsigned long size () const
 Number of objects available.
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

mbl_data_wrapper< T > * data_
vcl_vector< unsigned > selection_
unsigned index_

Detailed Description

template<class T>
class mbl_selected_data_wrapper< T >

A subset of an existing mbl_data_wrapper.

This wraps another mbl_data_wrapper, and acts like a rearrangement of the original data. The rearrangement does not have to refer to all of the original data, and can refer to the same data more than once.

Definition at line 23 of file mbl_selected_data_wrapper.h.


Constructor & Destructor Documentation

Copy constructor.

Definition at line 31 of file mbl_selected_data_wrapper.txx.

template<class T >
mbl_selected_data_wrapper< T >::mbl_selected_data_wrapper ( const mbl_data_wrapper< T > &  data,
const vcl_vector< unsigned > &  subset 
)

Constructor.

This will take its own copy of selection and the data wrapper, but not the underlying data.

Definition at line 22 of file mbl_selected_data_wrapper.txx.

Default constructor.

Definition at line 15 of file mbl_selected_data_wrapper.txx.

template<class T >
mbl_selected_data_wrapper< T >::~mbl_selected_data_wrapper ( ) [virtual]

Default destructor.

Definition at line 50 of file mbl_selected_data_wrapper.txx.


Member Function Documentation

template<class T >
mbl_data_wrapper< T > * mbl_selected_data_wrapper< T >::clone ( ) const [virtual]

Create copy on heap and return base pointer.

This will create an independent iterator on the underlying data. The original data is not copied. Be careful of destruction of underlying data.

Implements mbl_data_wrapper< T >.

Definition at line 119 of file mbl_selected_data_wrapper.txx.

template<class T >
const T & mbl_selected_data_wrapper< T >::current ( ) [virtual]

Return current object.

Implements mbl_data_wrapper< T >.

Definition at line 91 of file mbl_selected_data_wrapper.txx.

template<class T >
unsigned long mbl_selected_data_wrapper< T >::index ( ) const [virtual]

Return current index.

First example has index 0

Implements mbl_data_wrapper< T >.

Definition at line 112 of file mbl_selected_data_wrapper.txx.

template<class T>
virtual vcl_string mbl_selected_data_wrapper< T >::is_a ( ) const [virtual]

Name of the class.

Implements mbl_data_wrapper< T >.

template<class T >
bool mbl_selected_data_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 142 of file mbl_selected_data_wrapper.txx.

template<class T >
bool mbl_selected_data_wrapper< T >::next ( ) [virtual]

Move to next object, returning true if is valid.

Implements mbl_data_wrapper< T >.

Definition at line 98 of file mbl_selected_data_wrapper.txx.

template<class T >
mbl_selected_data_wrapper< T > & mbl_selected_data_wrapper< T >::operator= ( const mbl_selected_data_wrapper< T > &  b)

Copy operator.

Definition at line 57 of file mbl_selected_data_wrapper.txx.

template<class T >
void mbl_selected_data_wrapper< T >::reset ( ) [virtual]

Reset so that current() returns first object.

Implements mbl_data_wrapper< T >.

Definition at line 82 of file mbl_selected_data_wrapper.txx.

template<class T >
void mbl_selected_data_wrapper< T >::set ( const mbl_data_wrapper< T > &  data,
const vcl_vector< unsigned > &  selection 
)

Set the wrappers data.

This will take its own copy of selection and the data wrapper, but not the underlying data.

Definition at line 39 of file mbl_selected_data_wrapper.txx.

template<class T >
void mbl_selected_data_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 128 of file mbl_selected_data_wrapper.txx.

template<class T >
unsigned long mbl_selected_data_wrapper< T >::size ( ) const [virtual]

Number of objects available.

Implements mbl_data_wrapper< T >.

Definition at line 75 of file mbl_selected_data_wrapper.txx.


Member Data Documentation

template<class T>
mbl_data_wrapper<T>* mbl_selected_data_wrapper< T >::data_ [private]

Definition at line 25 of file mbl_selected_data_wrapper.h.

template<class T>
unsigned mbl_selected_data_wrapper< T >::index_ [private]

Definition at line 27 of file mbl_selected_data_wrapper.h.

template<class T>
vcl_vector<unsigned> mbl_selected_data_wrapper< T >::selection_ [private]

Definition at line 26 of file mbl_selected_data_wrapper.h.


The documentation for this class was generated from the following files: