SampleValue Class Referenceabstract

the value of a sample in a CvrStgFile More...

`#include <SampleValue.h>`

Inheritance diagram for SampleValue:

## Public Member Functions

| SampleValue (void)
virtual | ~SampleValue (void)
virtual SampleValue * | getNearestTargetSampleValue (EmbValue t) const =0
virtual UWORD32 | calcDistance (const SampleValue *s) const =0
virtual std::string | getName (void) const =0
virtual bool | isNeighbour (const SampleValue *s) const
EmbValue | getEmbeddedValue (void) const
UWORD32 | getKey (void) const
bool | operator== (const SampleValue &sv) const
bool | operator!= (const SampleValue &sv) const
bool | operator< (const SampleValue &sv) const
UWORD32 | getNumEdges (EmbValue t) const
void | setNumEdges (EmbValue t, UWORD32 ne)
void | incNumEdges (EmbValue t)
void | decNumEdges (EmbValue t)
void | setLabel (unsigned long l)
unsigned long | getLabel (void) const
void | print (unsigned short spc=0) const

## Protected Attributes

EmbValue | EValue
| the bit that is embedded in this sample value - must be set in constructor of derived class
UWORD32 | Key
| the key of this sample value - must be different for two different sample values - must be set in constructor of derived class

## Private Attributes

unsigned long | Label
UWORD32 * | NumEdges

## Detailed Description

This is the abstract base class for all AuSampleValue, BmpSampleValue, etc. classes

For two sample values s1 and s2:

s1->calcDistance(s2) == s2->calcDistance(s1) is always true.

s1->isNeighbour(s2) == s2->isNeighbour(s1) is always true.

s1 and s2 are called opposite if s1->getBit() != s2->getBit()

s1 and s2 are called neighbours if s1->isNeighbour(s2) is true

s1->getKey() == s2->getKey() iff s1 == s2

s1 == s2 implies s1->getDistance(s2) == 0 BUT: s1->getDistance(s2) == 0 does not imply s1 == s2 example: 8-bit bmp palette image - same color value for two different indices

s1 == s2 implies s1->getBit() == s2->getBit()

s1->getDistance(s2) == 0 implies s1->getBit() == s2->getBit()

NOTE: SampleValue and all derived classes rely on the Globals object pointed to by the Globs pointer. This means that it must be set correctly before using any method of a SampleValue (or derived) object.

## Constructor & Destructor Documentation

## SampleValue()

SampleValue::SampleValue | ( | void |  | ) |

## ~SampleValue()

SampleValue::~SampleValue | ( | void |  | ) |

virtual

## Member Function Documentation

## calcDistance()

virtual UWORD32 SampleValue::calcDistance | ( | const SampleValue * | s | ) | const

pure virtual

calculate the distance between the sample value s and this sample value

Parameters

  s | a sample value of the same type as this

Returns
  the distance

Implemented in AudioSampleValue< Type, ValueType >, AudioSampleValue< AuMuLaw, BYTE >, AudioSampleValue< AuPCM16, SWORD16 >, AudioSampleValue< AuPCM32, SWORD32 >, AudioSampleValue< AuPCM8, SBYTE >, BmpRGBSampleValue, BmpSampleValue, DummySampleValue, JpegSampleValue, and WavPCMSampleValue.

## decNumEdges()

void SampleValue::decNumEdges | ( | EmbValue | t | ) |

## getEmbeddedValue()

EmbValue SampleValue::getEmbeddedValue | ( | void |  | ) | const

inline

get the value that is embedded in this sample value (must be >=0 and <EmbValueModulus)

Returns
  the embedded value

## getKey()

UWORD32 SampleValue::getKey | ( | void |  | ) | const

inline

get the key for this sample

Returns
  a key which must be different for two different samples values.

## getLabel()

unsigned long SampleValue::getLabel | ( | void |  | ) | const

inline

## getName()

virtual std::string SampleValue::getName | ( | void |  | ) | const

pure virtual

return a short name uniquely identifying this sample value

Implemented in AudioSampleValue< Type, ValueType >, AudioSampleValue< AuMuLaw, BYTE >, AudioSampleValue< AuPCM16, SWORD16 >, AudioSampleValue< AuPCM32, SWORD32 >, AudioSampleValue< AuPCM8, SBYTE >, BmpPaletteSampleValue, BmpRGBSampleValue, DummySampleValue, JpegSampleValue, and WavPCMSampleValue.

## getNearestTargetSampleValue()

virtual SampleValue * SampleValue::getNearestTargetSampleValue | ( | EmbValue | t | ) | const

pure virtual

get the nearest (with the least distance to this sample value) sample value whose embedded value equals the specified target

Parameters

  t | the target embedded value

If two or more target sample values have equal distance each of them should be returned with equal probability.

The returned SampleValue object should be deleted by the callser.

Implemented in AudioSampleValue< Type, ValueType >, AudioSampleValue< AuMuLaw, BYTE >, AudioSampleValue< AuPCM16, SWORD16 >, AudioSampleValue< AuPCM32, SWORD32 >, AudioSampleValue< AuPCM8, SBYTE >, BmpPaletteSampleValue, BmpRGBSampleValue, DummySampleValue, JpegSampleValue, and WavPCMSampleValue.

## getNumEdges()

UWORD32 SampleValue::getNumEdges | ( | EmbValue | t | ) | const

inline

## incNumEdges()

void SampleValue::incNumEdges | ( | EmbValue | t | ) |

## isNeighbour()

bool SampleValue::isNeighbour | ( | const SampleValue * | s | ) | const

virtual

is the sample value s a neighbour of this sample value ?

Returns
  true iff this and s are neighbours

This is implemented as (calcDistance() <= Radius) but may be overridden by derived classes.

Reimplemented in DummySampleValue.

## operator!=()

bool SampleValue::operator!= | ( | const SampleValue & | sv | ) | const

inline

## operator<()

bool SampleValue::operator< | ( | const SampleValue & | sv | ) | const

inline

## operator==()

bool SampleValue::operator== | ( | const SampleValue & | sv | ) | const

inline

two sample values are equal iff their keys are equal

## print()

void SampleValue::print | ( | unsigned short | spc = 0 | ) | const

## setLabel()

void SampleValue::setLabel | ( | unsigned long | l | ) |

inline

## setNumEdges()

void SampleValue::setNumEdges | ( | EmbValue | t,
|  | UWORD32 | ne )

inline

## Member Data Documentation

## EValue

EmbValue SampleValue::EValue

protected

## Key

UWORD32 SampleValue::Key

protected

## Label

unsigned long SampleValue::Label

private

## NumEdges

UWORD32* SampleValue::NumEdges

private

NumEdges[t] contains the number of edges that are added to a vertex if this sample value with corresponding target value t is added to the vertex

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

- SampleValue.h
- SampleValue.cc