UnicityTable< T > Class Template Reference

#include <unicity_table.h>

Inheritance diagram for UnicityTable< T >:
UnicityTableEqEq< T >

List of all members.

Public Member Functions

 UnicityTable ()
 ~UnicityTable ()
 Clear the structures and deallocate internal structures.
void reserve (int size)
int size () const
 Return the size used.
const T & get (int id) const
 Return the object from an id.
T * get_mutable (int id)
int get_id (T object) const
bool contains (T object) const
 Return true if T is in the table.
contains_id (int id) const
 Return true if the id is valid.
int push_back (T object)
 Add an element in the table.
void set_clear_callback (TessCallback1< T > *cb)
void set_compare_callback (TessResultCallback2< bool, T const &, T const & > *cb)
void clear ()
void move (UnicityTable< T > *from)
bool write (FILE *f, TessResultCallback2< bool, FILE *, T const & > *cb) const
bool read (FILE *f, TessResultCallback3< bool, FILE *, T *, bool > *cb, bool swap)
 swap is used to switch the endianness.

template<typename T>
class UnicityTable< T >


Constructor & Destructor Documentation

template<typename T >
UnicityTable< T >::UnicityTable (  )  [inline]
template<typename T >
UnicityTable< T >::~UnicityTable (  )  [inline]

Clear the structures and deallocate internal structures.


Member Function Documentation

template<typename T >
void UnicityTable< T >::clear (  )  [inline]

Clear the table, calling the callback function if any. All the owned Callbacks are also deleted. If you don't want the Callbacks to be deleted, before calling clear, set the callback to NULL.

template<typename T>
bool UnicityTable< T >::contains ( object  )  const [inline]

Return true if T is in the table.

template<typename T >
T UnicityTable< T >::contains_id ( int  id  )  const [inline]

Return true if the id is valid.

template<typename T >
const T & UnicityTable< T >::get ( int  id  )  const [inline]

Return the object from an id.

template<typename T>
int UnicityTable< T >::get_id ( object  )  const [inline]

Return the id of the T object. This method NEEDS a compare_callback to be passed to set_compare_callback.

template<typename T >
T * UnicityTable< T >::get_mutable ( int  id  )  [inline]
template<typename T>
void UnicityTable< T >::move ( UnicityTable< T > *  from  )  [inline]

This method clear the current object, then, does a shallow copy of its argument, and finally invalidate its argument.

template<typename T>
int UnicityTable< T >::push_back ( object  )  [inline]

Add an element in the table.

template<typename T>
bool UnicityTable< T >::read ( FILE *  f,
TessResultCallback3< bool, FILE *, T *, bool > *  cb,
bool  swap 
) [inline]

swap is used to switch the endianness.

template<typename T >
void UnicityTable< T >::reserve ( int  size  )  [inline]

Reserve some memory. If there is size or more elements, the table will then allocate size * 2 elements.

template<typename T>
void UnicityTable< T >::set_clear_callback ( TessCallback1< T > *  cb  )  [inline]

Add a callback to be called to delete the elements when the table took their ownership.

template<typename T>
void UnicityTable< T >::set_compare_callback ( TessResultCallback2< bool, T const &, T const & > *  cb  )  [inline]

Add a callback to be called to compare the elements when needed (contains, get_id, ...)

template<typename T >
int UnicityTable< T >::size (  )  const [inline]

Return the size used.

template<typename T>
bool UnicityTable< T >::write ( FILE *  f,
TessResultCallback2< bool, FILE *, T const & > *  cb 
) const [inline]

Read/Write the table to a file. This does _NOT_ read/write the callbacks. The Callback given must be permanent since they will be called more than once. The given callback will be deleted at the end. Returns false on read/write error.


The documentation for this class was generated from the following file:
Generated on Thu Feb 2 08:19:25 2012 for Tesseract by  doxygen 1.6.3