Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SketchData Class Template Reference

#include <SketchData.h>

Inheritance diagram for SketchData:

List of all members.


Detailed Description

template<class T>
class DualCoding::SketchData< T >

Holds the pixels for an individual sketch.

SketchData<T> holds the pixels for an individual sketch of type T, using a valarray<T>. A collection of SketchData<T> objects is maintained in a SketchPool<T>. Basic functions such as indexed access and empty test that are not implemented as Sketch operators are implemented as SketchData<T> member functions. Sketch<T> overrides the -> operator to provide "smart pointer" access to these SketchData<T> functions.

Definition at line 36 of file SketchData.h.


Public Member Functions

 SketchData (SketchSpace *_space)
 Constructor. Don't call this. SketchData objects should only be created and managed by their SketchSpace.
 ~SketchData ()
virtual SketchType_t getType () const
 The type of this sketch.
T * getRawPixels ()
 Address of the memory area containing the actual pixel data.
const T * getRawPixels () const
 Address of the memory area containing the actual pixel data.
unsigned int saveBuffer (char buf[], unsigned int avail) const
 Serializes a sketch to a buffer, for transmission to the sketch viewer.
bool empty () const
 Returns true if all pixels are zero.
template<>
SketchType_t getType () const
T & at (size_t x)
 Indexed access, with bounds checking.
T & at (size_t x, size_t y)
 Subscripted (x,y) access, with bounds checking.
Sum/Max/Min
sum () const
 Sum of pixels.
max () const
 Max of pixel values.
int findMax () const
 Index of first maximum-value pixel.
min () const
 Min of pixel values.
int findMin () const
 Index of first minimum-value pixel.
minPlus () const
 Min of non-zero pixel values.
int findMinPlus () const
 Index of first minimum non-zero pixel, or -1 if none.
mode () const
 Mode (most common) pixel value.
modePlus () const
 Mode (most common) non-zero pixel value.

Protected Member Functions

unsigned int savePixels (char buf[], unsigned int avail) const
 handle copying pixels to buffer

Private Member Functions

 SketchData (const SketchData &other)
 never call this

Private Attributes

std::valarray< T > pixels
 the valarray which actually stores the image

Friends

class Sketch< T >
class SketchPool< T >

Constructor & Destructor Documentation

SketchData ( SketchSpace _space  )  [inline]

Constructor. Don't call this. SketchData objects should only be created and managed by their SketchSpace.

Definition at line 118 of file SketchData.h.

~SketchData (  )  [inline]

Definition at line 126 of file SketchData.h.

SketchData ( const SketchData< T > &  other  )  [inline, private]

never call this

Definition at line 129 of file SketchData.h.


Member Function Documentation

virtual SketchType_t getType (  )  const [virtual]

The type of this sketch.

Implements SketchDataRoot.

Referenced by SketchData::saveBuffer(), and SketchData::SketchData().

T* getRawPixels (  )  [inline]

Address of the memory area containing the actual pixel data.

Definition at line 52 of file SketchData.h.

const T* getRawPixels (  )  const [inline]

Address of the memory area containing the actual pixel data.

Definition at line 55 of file SketchData.h.

unsigned int saveBuffer ( char  buf[],
unsigned int  avail 
) const [inline, virtual]

Serializes a sketch to a buffer, for transmission to the sketch viewer.

Implements SketchDataRoot.

Definition at line 280 of file SketchData.h.

T & at ( size_t  x  )  [inline]

Indexed access, with bounds checking.

Definition at line 142 of file SketchData.h.

T & at ( size_t  x,
size_t  y 
) [inline]

Subscripted (x,y) access, with bounds checking.

Definition at line 150 of file SketchData.h.

bool empty (  )  const [inline]

Returns true if all pixels are zero.

Definition at line 158 of file SketchData.h.

T sum (  )  const [inline]

Sum of pixels.

Definition at line 166 of file SketchData.h.

T max (  )  const [inline]

Max of pixel values.

Definition at line 174 of file SketchData.h.

int findMax (  )  const [inline]

Index of first maximum-value pixel.

Definition at line 182 of file SketchData.h.

T min (  )  const [inline]

Min of pixel values.

Definition at line 194 of file SketchData.h.

int findMin (  )  const [inline]

Index of first minimum-value pixel.

Definition at line 202 of file SketchData.h.

T minPlus (  )  const [inline]

Min of non-zero pixel values.

Definition at line 214 of file SketchData.h.

int findMinPlus (  )  const [inline]

Index of first minimum non-zero pixel, or -1 if none.

Definition at line 229 of file SketchData.h.

T mode (  )  const [inline]

Mode (most common) pixel value.

Definition at line 241 of file SketchData.h.

T modePlus (  )  const [inline]

Mode (most common) non-zero pixel value.

Definition at line 257 of file SketchData.h.

unsigned int savePixels ( char  buf[],
unsigned int  avail 
) const [inline, protected]

handle copying pixels to buffer

Definition at line 317 of file SketchData.h.

Referenced by SketchData::saveBuffer().

SketchType_t getType (  )  const [inline, virtual]

Implements SketchDataRoot.

Definition at line 139 of file SketchData.h.


Friends And Related Function Documentation

friend class Sketch< T > [friend]

Definition at line 40 of file SketchData.h.

friend class SketchPool< T > [friend]

Definition at line 41 of file SketchData.h.


Member Data Documentation


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

DualCoding 4.0
Generated Thu Nov 22 00:54:06 2007 by Doxygen 1.5.4