Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

HxValue Class Reference

Class definition of a value as used in Horus. More...

#include <HxValue.h>

List of all members.

Constructors

 HxValue (int i=0)
 Construction from native integer. More...

 HxValue (double d)
 Construction from native double. More...

 HxValue (HxScalarInt i)
 Construction from scalar integer. More...

 HxValue (HxScalarDouble d)
 Construction from scalar double. More...

 HxValue (HxVec2Int v)
 Construction from vector of 2 integers. More...

 HxValue (HxVec2Double v)
 Construction from vector of 2 doubles. More...

 HxValue (HxVec3Int v)
 Construction from vector of 3 integers. More...

 HxValue (HxVec3Double v)
 Construction from vector of 3 doubles. More...

 HxValue (HxComplex v)
 Construction from complex. More...


Inquiry

Tag tag () const
 The type of the value stored. More...


Data access

HxScalarIntHxScalarIntValue ()
 Access value as HxScalarInt. More...

HxScalarDoubleHxScalarDoubleValue ()
 Access value as HxScalarDouble. More...

HxVec2IntHxVec2IntValue ()
 Access value as HxVec2Int. More...

HxVec2DoubleHxVec2DoubleValue ()
 Access value as HxVec2Double. More...

HxVec3IntHxVec3IntValue ()
 Access value as HxVec3Int. More...

HxVec3DoubleHxVec3DoubleValue ()
 Access value as HxVec3Double. More...

HxComplexHxComplexValue ()
 Access value as HxComplex. More...


Conversion

 operator HxScalarInt () const
 Cast to HxScalarInt. More...

 operator HxScalarDouble () const
 Cast to HxScalarDouble. More...

 operator HxVec2Int () const
 Cast to HxVec2Int. More...

 operator HxVec2Double () const
 Cast to HxVec2Double. More...

 operator HxVec3Int () const
 Cast to HxVec3Int. More...

 operator HxVec3Double () const
 Cast to HxVec3Double. More...

 operator HxComplex () const
 Cast to HxComplex. More...


Public Types

enum  Tag {
  SI, SD, V2I, V2D,
  V3I, V3D, CPL
}
 The arithmetic data types that may be stored. More...


Public Methods

HxString toString () const

Friends

STD_OSTREAM & operator<< (STD_OSTREAM &os, const HxValue val)


Detailed Description

Class definition of a value as used in Horus.

An HxValue is capable of storing each of the arithmetic data types. HxValue is used to pass arbitrary values using a single function interface. HxValue is not meant to do arithmetic on arbitrary values and hence no such operations are defined in the interface.


Member Enumeration Documentation

enum HxValue::Tag
 

The arithmetic data types that may be stored.

SI: scalar integer, SD: scalar double, V2I: vector of 2 integers, V2D: vector of 2 doubles, V3I: vector of 3 integers, V3D: vector of 3 doubles. CPL: complex number (2 doubles).

00042 { SI, SD, V2I, V2D, V3I, V3D, CPL };


Constructor & Destructor Documentation

HxValue::HxValue int    v = 0 [inline]
 

Construction from native integer.

00159 {
00160     _tag._tag = SI;
00161     new(&_val[0]) HxScalarInt(v);
00162 }

HxValue::HxValue double    v [inline]
 

Construction from native double.

00166 {
00167     _tag._tag = SD;
00168     new(&_val[0]) HxScalarDouble(v);
00169 }

HxValue::HxValue HxScalarInt    v [inline]
 

Construction from scalar integer.

00173 {
00174     _tag._tag = SI;
00175     new(&_val[0]) HxScalarInt(v);
00176 }

HxValue::HxValue HxScalarDouble    v [inline]
 

Construction from scalar double.

00180 {
00181     _tag._tag = SD;
00182     new(&_val[0]) HxScalarDouble(v);
00183 }

HxValue::HxValue HxVec2Int    v [inline]
 

Construction from vector of 2 integers.

00187 {
00188     _tag._tag = V2I;
00189     new(&_val[0]) HxVec2Int(v);
00190 }

HxValue::HxValue HxVec2Double    v [inline]
 

Construction from vector of 2 doubles.

00194 {
00195     _tag._tag = V2D;
00196     new(&_val[0]) HxVec2Double(v);
00197 }

HxValue::HxValue HxVec3Int    v [inline]
 

Construction from vector of 3 integers.

00201 {
00202     _tag._tag = V3I;
00203     new(&_val[0]) HxVec3Int(v);
00204 }

HxValue::HxValue HxVec3Double    v [inline]
 

Construction from vector of 3 doubles.

00208 {
00209     _tag._tag = V3D;
00210     new(&_val[0]) HxVec3Double(v);
00211 }

HxValue::HxValue HxComplex    v [inline]
 

Construction from complex.

00215 {
00216     _tag._tag = CPL;
00217     new(&_val[0]) HxComplex(v);
00218 }


Member Function Documentation

HxValue::Tag HxValue::tag   const [inline]
 

The type of the value stored.

00222 {
00223     return _tag._tag;
00224 }

HxScalarInt & HxValue::HxScalarIntValue   [inline]
 

Access value as HxScalarInt.

00228 {
00229     check(SI);
00230     return *(HxScalarInt *) &_val[0];
00231 }

HxScalarDouble & HxValue::HxScalarDoubleValue   [inline]
 

Access value as HxScalarDouble.

00235 {
00236     check(SD);
00237     return *(HxScalarDouble *) &_val[0];
00238 }

HxVec2Int & HxValue::HxVec2IntValue   [inline]
 

Access value as HxVec2Int.

00242 {
00243     check(V2I);
00244     return *(HxVec2Int *) &_val[0];
00245 }

HxVec2Double & HxValue::HxVec2DoubleValue   [inline]
 

Access value as HxVec2Double.

00249 {
00250     check(V2D);
00251     return *(HxVec2Double *) &_val[0];
00252 }

HxVec3Int & HxValue::HxVec3IntValue   [inline]
 

Access value as HxVec3Int.

00256 {
00257     check(V3I);
00258     return *(HxVec3Int *) &_val[0];
00259 }

HxVec3Double & HxValue::HxVec3DoubleValue   [inline]
 

Access value as HxVec3Double.

00263 {
00264     check(V3D);
00265     return *(HxVec3Double *) &_val[0];
00266 }

HxComplex & HxValue::HxComplexValue   [inline]
 

Access value as HxComplex.

00270 {
00271     check(CPL);
00272     return *(HxComplex *) &_val[0];
00273 }

HxValue::operator HxScalarInt   const [inline]
 

Cast to HxScalarInt.

00277 {
00278     switch(_tag._tag)
00279     {
00280     case SI:    return (HxScalarInt) *(HxScalarInt *) &_val[0];
00281     case SD:    return (*(HxScalarDouble *) &_val[0]).operator HxScalarInt();
00282     case V2I:   return (HxScalarInt) *(HxVec2Int *) &_val[0];
00283     case V2D:   return (HxScalarInt) *(HxVec2Double *) &_val[0];
00284     case V3I:   return (HxScalarInt) *(HxVec3Int *) &_val[0];
00285     case V3D:   return (HxScalarInt) *(HxVec3Double *) &_val[0];
00286     case CPL:   return (HxScalarInt) *(HxComplex *) &_val[0];
00287     default:    return (HxScalarInt) *(HxScalarInt *) &_val[0];
00288     }
00289 }

HxValue::operator HxScalarDouble   const [inline]
 

Cast to HxScalarDouble.

00293 {
00294     switch(_tag._tag)
00295     {
00296     case SI:    return (HxScalarDouble) *(HxScalarInt *) &_val[0];
00297     case SD:    return (HxScalarDouble) *(HxScalarDouble *) &_val[0];
00298     case V2I:   return (HxScalarDouble) *(HxVec2Int *) &_val[0];
00299     case V2D:   return (HxScalarDouble) *(HxVec2Double *) &_val[0];
00300     case V3I:   return (HxScalarDouble) *(HxVec3Int *) &_val[0];
00301     case V3D:   return (HxScalarDouble) *(HxVec3Double *) &_val[0];
00302     case CPL:   return (HxScalarDouble) *(HxComplex *) &_val[0];
00303     default:    return (HxScalarDouble) *(HxScalarDouble *) &_val[0];
00304     }
00305 }

HxValue::operator HxVec2Int   const [inline]
 

Cast to HxVec2Int.

00309 {
00310     switch(_tag._tag)
00311     {
00312     case SI:    return (HxVec2Int) *(HxScalarInt *) &_val[0];
00313     case SD:    return (HxVec2Int) *(HxScalarDouble *) &_val[0];
00314     case V2I:   return (HxVec2Int) *(HxVec2Int *) &_val[0];
00315     case V2D:   return (HxVec2Int) *(HxVec2Double *) &_val[0];
00316     case V3I:   return (HxVec2Int) *(HxVec3Int *) &_val[0];
00317     case V3D:   return (HxVec2Int) *(HxVec3Double *) &_val[0];
00318     case CPL:   return (HxVec2Int) *(HxComplex *) &_val[0];
00319     default:    return (HxVec2Int) *(HxVec2Int *) &_val[0];
00320     }
00321 }

HxValue::operator HxVec2Double   const [inline]
 

Cast to HxVec2Double.

00325 {
00326     switch(_tag._tag)
00327     {
00328     case SI:    return (HxVec2Double) *(HxScalarInt *) &_val[0];
00329     case SD:    return (HxVec2Double) *(HxScalarDouble *) &_val[0];
00330     case V2I:   return (HxVec2Double) *(HxVec2Int *) &_val[0];
00331     case V2D:   return (HxVec2Double) *(HxVec2Double *) &_val[0];
00332     case V3I:   return (HxVec2Double) *(HxVec3Int *) &_val[0];
00333     case V3D:   return (HxVec2Double) *(HxVec3Double *) &_val[0];
00334     case CPL:   return (HxVec2Double) *(HxComplex *) &_val[0];
00335     default:    return (HxVec2Double) *(HxVec2Double *) &_val[0];
00336     }
00337 }

HxValue::operator HxVec3Int   const [inline]
 

Cast to HxVec3Int.

00341 {
00342     switch(_tag._tag)
00343     {
00344     case SI:    return (HxVec3Int) *(HxScalarInt *) &_val[0];
00345     case SD:    return (HxVec3Int) *(HxScalarDouble *) &_val[0];
00346     case V2I:   return (HxVec3Int) *(HxVec2Int *) &_val[0];
00347     case V2D:   return (HxVec3Int) *(HxVec2Double *) &_val[0];
00348     case V3I:   return (HxVec3Int) *(HxVec3Int *) &_val[0];
00349     case V3D:   return (HxVec3Int) *(HxVec3Double *) &_val[0];
00350     case CPL:   return (HxVec3Int) *(HxComplex *) &_val[0];
00351     default:    return (HxVec3Int) *(HxVec3Int *) &_val[0];
00352     }
00353 }

HxValue::operator HxVec3Double   const [inline]
 

Cast to HxVec3Double.

00357 {
00358     switch(_tag._tag)
00359     {
00360     case SI:    return (HxVec3Double) *(HxScalarInt *) &_val[0];
00361     case SD:    return (HxVec3Double) *(HxScalarDouble *) &_val[0];
00362     case V2I:   return (HxVec3Double) *(HxVec2Int *) &_val[0];
00363     case V2D:   return (HxVec3Double) *(HxVec2Double *) &_val[0];
00364     case V3I:   return (HxVec3Double) *(HxVec3Int *) &_val[0];
00365     case V3D:   return (HxVec3Double) *(HxVec3Double *) &_val[0];
00366     case CPL:   return (HxVec3Double) *(HxComplex *) &_val[0];
00367     default:    return (HxVec3Double) *(HxVec3Double *) &_val[0];
00368     }
00369 }

HxValue::operator HxComplex   const [inline]
 

Cast to HxComplex.

00373 {
00374     switch(_tag._tag)
00375     {
00376     case SI:    return (HxComplex) *(HxScalarInt *) &_val[0];
00377     case SD:    return (HxComplex) *(HxScalarDouble *) &_val[0];
00378     case V2I:   return (HxComplex) *(HxVec2Int *) &_val[0];
00379     case V2D:   return (HxComplex) *(HxVec2Double *) &_val[0];
00380     case V3I:   return (HxComplex) *(HxVec3Int *) &_val[0];
00381     case V3D:   return (HxComplex) *(HxVec3Double *) &_val[0];
00382     case CPL:   return (HxComplex) *(HxComplex *) &_val[0];
00383     default:    return (HxComplex) *(HxComplex *) &_val[0];
00384     }
00385 }


The documentation for this class was generated from the following files:
Generated on Mon Jan 27 15:49:11 2003 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001