num Class Reference

#include <num.hh>

List of all members.

Public Member Functions

 num (int x=0)
 num (double x)
 num (const num &n)
numoperator= (int n)
numoperator= (double n)
bool operator== (const num &n) const
bool operator!= (const num &n) const
int type () const
 operator int () const
 operator double () const

Private Attributes

int fType
union {
   int   i
   double   f
fData

Detailed Description

Definition at line 58 of file num.hh.


Constructor & Destructor Documentation

num::num ( int  x = 0  )  [inline]

Definition at line 68 of file num.hh.

References fData.

00068 : fType(0)          { fData.i = x; }

num::num ( double  x  )  [inline]

Definition at line 70 of file num.hh.

References fData.

00070 : fType(1)          { fData.f = x; }

num::num ( const num n  )  [inline]

Definition at line 71 of file num.hh.

References fData, and i.

00071 : fType(n.fType)    { fData.i = n.fData.i; }


Member Function Documentation

num::operator double (  )  const [inline]

Definition at line 83 of file num.hh.

References fData, and fType.

00083 { return (fType) ? fData.f : double(fData.i); }

num::operator int (  )  const [inline]

Definition at line 82 of file num.hh.

References fData, and fType.

00082 { return (fType) ? int(fData.f) : fData.i; }

bool num::operator!= ( const num n  )  const [inline]

Definition at line 78 of file num.hh.

References fData, fType, and i.

00078 { return fType != n.fType || fData.i != n.fData.i; }

num& num::operator= ( double  n  )  [inline]

Definition at line 74 of file num.hh.

References fData, and fType.

00074 { fType = 1; fData.f = n; return *this; }

num& num::operator= ( int  n  )  [inline]

Definition at line 73 of file num.hh.

References fData, and fType.

00073 { fType = 0; fData.i = n; return *this; }

bool num::operator== ( const num n  )  const [inline]

Definition at line 77 of file num.hh.

References fData, fType, and i.

00077 { return fType == n.fType && fData.i == n.fData.i; }

int num::type (  )  const [inline]

Definition at line 81 of file num.hh.

References fType.

Referenced by isfloat().

00081 { return fType; }

Here is the caller graph for this function:


Member Data Documentation

double num::f

Definition at line 63 of file num.hh.

union { ... } num::fData [private]
int num::fType [private]

Definition at line 60 of file num.hh.

Referenced by operator double(), operator int(), operator!=(), operator=(), operator==(), and type().

int num::i

Definition at line 62 of file num.hh.

Referenced by num(), operator!=(), and operator==().


The documentation for this class was generated from the following file:
Generated on Thu Jul 15 16:15:59 2010 for FAUST compiler by  doxygen 1.6.3