Homepage Demos Overview Downloads Tutorials Reference
Credits

SketchData Class Template Reference

#include <SketchData.h>

Inheritance diagram for SketchData:

Inheritance graph
[legend]
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  ) 

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 (  ) 

Definition at line 126 of file SketchData.h.

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

never call this


Member Function Documentation

T & at ( size_t  x,
size_t  y 
)

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

Definition at line 150 of file SketchData.h.

T & at ( size_t  x  ) 

Indexed access, with bounds checking.

Definition at line 142 of file SketchData.h.

bool empty (  )  const

Returns true if all pixels are zero.

Definition at line 158 of file SketchData.h.

int findMax (  )  const

Index of first maximum-value pixel.

Definition at line 182 of file SketchData.h.

int findMin (  )  const

Index of first minimum-value pixel.

Definition at line 202 of file SketchData.h.

int findMinPlus (  )  const

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

Definition at line 229 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.

T* getRawPixels (  )  [inline]

Address of the memory area containing the actual pixel data.

Definition at line 52 of file SketchData.h.

SketchType_t getType (  )  const [inline, virtual]

Implements SketchDataRoot.

Definition at line 137 of file SketchData.h.

virtual SketchType_t getType (  )  const [virtual]

The type of this sketch.

Implements SketchDataRoot.

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

T max (  )  const

Max of pixel values.

Definition at line 174 of file SketchData.h.

T min (  )  const

Min of pixel values.

Definition at line 194 of file SketchData.h.

T minPlus (  )  const

Min of non-zero pixel values.

Definition at line 214 of file SketchData.h.

T mode (  )  const

Mode (most common) pixel value.

Definition at line 241 of file SketchData.h.

T modePlus (  )  const

Mode (most common) non-zero pixel value.

Definition at line 257 of file SketchData.h.

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

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

Implements SketchDataRoot.

Definition at line 280 of file SketchData.h.

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

handle copying pixels to buffer

Definition at line 317 of file SketchData.h.

Referenced by SketchData::saveBuffer().

T sum (  )  const

Sum of pixels.

Definition at line 166 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 3.0beta
Generated Wed Oct 4 00:02:31 2006 by Doxygen 1.4.7