Node Class Reference

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

#include <node.hh>

Collaboration diagram for Node:
[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.

References fData.

00082 : fType(kIntNode)       { fData.f = 0; fData.i = x; }

Node::Node ( double  x  )  [inline]

Definition at line 83 of file node.hh.

References fData.

00083 : fType(kDoubleNode)    { fData.f = x; }

Node::Node ( const char *  name  )  [inline]

Definition at line 84 of file node.hh.

References fData, and symbol().

00084 : 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 fData, and symbol().

00085 : 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.

References fData.

00086 : fType(kSymNode)       { fData.f = 0; fData.s = x; }

Node::Node ( void *  x  )  [inline]

Definition at line 87 of file node.hh.

References fData.

00087 : fType(kPointerNode)   { fData.f = 0; fData.p = x; }

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

Definition at line 89 of file node.hh.

References fData.

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


Member Function Documentation

double Node::getDouble (  )  const [inline]

Definition at line 99 of file node.hh.

References fData.

Referenced by isDouble(), isGEZero(), isGTZero(), isMinusOne(), isOne(), and isZero().

00099 { return fData.f; }

Here is the caller graph for this function:

int Node::getInt (  )  const [inline]

Definition at line 98 of file node.hh.

References fData.

Referenced by CTree::calcTreeHash(), getBoxType(), Occurrences::getCount(), getDefLineProp(), ScalarCompiler::getSharingCount(), DocCompiler::getSharingCount(), isGEZero(), isGTZero(), isInt(), isMinusOne(), isOne(), isZero(), and shcount().

00098 { return fData.i; }

Here is the caller graph for this function:

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

Definition at line 101 of file node.hh.

References fData.

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

00101 { return fData.p; }

Here is the caller graph for this function:

Sym Node::getSym (  )  const [inline]

Definition at line 100 of file node.hh.

References fData.

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

00100 { 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 fData, fType, kDoubleNode, and kIntNode.

00105 { 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 fData, fType, kDoubleNode, and kIntNode.

00104 { 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.

00093 { 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.

00092 { 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<<().

00004 {
00005     switch (fType) {
00006         case kIntNode :     return fout << fData.i;
00007         case kDoubleNode :  return fout << fData.f;
00008         case kSymNode :     return fout << *(fData.s);
00009         case kPointerNode : return fout << "ptr:" << fData.p;
00010         default :           return fout << "badnode";
00011     }
00012             
00013 //  return fout;
00014 }

Here is the caller graph for this function:

int Node::type (  )  const [inline]

Definition at line 96 of file node.hh.

References fType.

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

00096 { 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]
int Node::fType [private]

Definition at line 72 of file node.hh.

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

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:
Generated on Thu Apr 29 00:00:21 2010 for FAUST compiler by  doxygen 1.6.3