FAUST compiler  0.9.9.6b8
Public Member Functions | Private Attributes
Node Class Reference

Class Node = (type x (int + double + Sym + void*)) More...

#include <node.hh>

Collaboration diagram for Node:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Node (int x)
 Node (double x)
 Node (const char *name)
 Node (const string &name)
 Node (Sym x)
 Node (void *x)
 Node (const Node &n)
bool operator== (const Node &n) const
bool operator!= (const Node &n) const
int type () const
int getInt () const
double getDouble () const
Sym getSym () const
void * getPointer () const
 operator int () const
 operator double () const
ostream & print (ostream &fout) const
 print a node on a stream

Private Attributes

int fType
union {
   int   i
   double   f
   Sym   s
   void *   p
fData

Detailed Description

Class Node = (type x (int + double + Sym + void*))

Definition at line 70 of file node.hh.


Constructor & Destructor Documentation

Node::Node ( int  x) [inline]

Definition at line 82 of file node.hh.

: fType(kIntNode)       { fData.f = 0; fData.i = x; }
Node::Node ( double  x) [inline]

Definition at line 83 of file node.hh.

: fType(kDoubleNode)    { fData.f = x; }
Node::Node ( const char *  name) [inline]

Definition at line 84 of file node.hh.

References symbol().

: fType(kSymNode)       { fData.f = 0; fData.s = symbol(name); }

Here is the call graph for this function:

Node::Node ( const string &  name) [inline]

Definition at line 85 of file node.hh.

References symbol().

: fType(kSymNode)       { fData.f = 0; fData.s = symbol(name); }

Here is the call graph for this function:

Node::Node ( Sym  x) [inline]

Definition at line 86 of file node.hh.

: fType(kSymNode)       { fData.f = 0; fData.s = x; }
Node::Node ( void *  x) [inline]

Definition at line 87 of file node.hh.

: fType(kPointerNode)   { fData.f = 0; fData.p = x; }
Node::Node ( const Node n) [inline]

Definition at line 89 of file node.hh.

References fData.

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

Member Function Documentation

double Node::getDouble ( ) const [inline]

Definition at line 99 of file node.hh.

Referenced by property< double >::get(), isDouble(), isGEZero(), isGTZero(), isMinusOne(), isOne(), and isZero().

{ return fData.f; }

Here is the caller graph for this function:

int Node::getInt ( ) const [inline]
void* Node::getPointer ( ) const [inline]

Definition at line 101 of file node.hh.

Referenced by property< Loop * >::access(), and isPointer().

{ return fData.p; }

Here is the caller graph for this function:

Sym Node::getSym ( ) const [inline]

Definition at line 100 of file node.hh.

Referenced by isSym(), merge_trans_op(), and Trans::operator<().

{ return fData.s; }

Here is the caller graph for this function:

Node::operator double ( ) const [inline]

Definition at line 105 of file node.hh.

References kDoubleNode, and kIntNode.

{ return (fType == kIntNode) ? double(fData.i) : (fType == kDoubleNode) ? fData.f : 0.0 ; }
Node::operator int ( ) const [inline]

Definition at line 104 of file node.hh.

References kDoubleNode, and kIntNode.

{ return (fType == kIntNode) ? fData.i : (fType == kDoubleNode) ? int(fData.f) : 0 ; }
bool Node::operator!= ( const Node n) const [inline]

Definition at line 93 of file node.hh.

References f, fData, and fType.

{ return fType != n.fType || fData.f != n.fData.f; }
bool Node::operator== ( const Node n) const [inline]

Definition at line 92 of file node.hh.

References f, fData, and fType.

{ return fType == n.fType && fData.f == n.fData.f; }
ostream & Node::print ( ostream &  fout) const

print a node on a stream

< print a node on a stream

Definition at line 3 of file node.cpp.

References kDoubleNode, kIntNode, kPointerNode, and kSymNode.

Referenced by operator<<().

{
    switch (fType) {
        case kIntNode :     return fout << fData.i;
        case kDoubleNode :  return fout << fData.f;
        case kSymNode :     return fout << *(fData.s);
        case kPointerNode : return fout << "ptr:" << fData.p;
        default :           return fout << "badnode";
    }
            
//  return fout;
}

Here is the caller graph for this function:

int Node::type ( ) const [inline]

Definition at line 96 of file node.hh.

Referenced by CTree::calcTreeHash(), isDouble(), isGEZero(), isGTZero(), isInt(), isMinusOne(), isOne(), isPointer(), isSym(), and isZero().

{ return fType; }

Here is the caller graph for this function:


Member Data Documentation

double Node::f

Definition at line 75 of file node.hh.

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

union { ... } Node::fData [private]

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

int Node::fType [private]

Definition at line 72 of file node.hh.

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

int Node::i

Definition at line 74 of file node.hh.

void* Node::p

Definition at line 77 of file node.hh.

Definition at line 76 of file node.hh.


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