BinaryOperation Class Reference

#include <BinaryOperation.hpp>

List of all members.

Public Types

enum  Type {
  sum, difference, division, modulo,
  power, product, min, max,
  gt, lt, ge, le,
  eq, ne, or_, xor_,
  and_, undefined
}

Public Member Functions

std::string name () const
const BinaryOperation::Typetype () const
 BinaryOperation (const std::string &typeName)
 BinaryOperation (const BinaryOperation::Type &type)
 BinaryOperation (const BinaryOperation &b)
 ~BinaryOperation ()

Static Private Member Functions

static BinaryOperation::Type __getType (const std::string &typeName)

Private Attributes

const Type __type

Friends

std::ostream & operator<< (std::ostream &os, const BinaryOperation &b)


Detailed Description

Definition at line 33 of file BinaryOperation.hpp.


Member Enumeration Documentation

Enumerator:
sum 
difference 
division 
modulo 
power 
product 
min 
max 
gt 
lt 
ge 
le 
eq 
ne 
or_ 
xor_ 
and_ 
undefined 

Definition at line 36 of file BinaryOperation.hpp.

00036             {
00037     sum,
00038     difference,
00039     division,
00040     modulo,
00041     power,
00042     product,
00043 
00044     min,
00045     max,
00046 
00047     gt,
00048     lt,
00049     ge,
00050     le,
00051     eq,
00052     ne,
00053     or_,
00054     xor_,
00055     and_,
00056 
00057     undefined
00058   };


Constructor & Destructor Documentation

BinaryOperation::BinaryOperation ( const std::string &  typeName  )  [inline]

Constructor

Parameters:
typeName the name of the binary operation

Definition at line 174 of file BinaryOperation.hpp.

00175     : __type(BinaryOperation::__getType(typeName))
00176   {
00177     ;
00178   }

BinaryOperation::BinaryOperation ( const BinaryOperation::Type type  )  [inline]

Constructor

Parameters:
type the type of the binary operation

Definition at line 185 of file BinaryOperation.hpp.

00186     : __type(type)
00187   {
00188     ;
00189   }

BinaryOperation::BinaryOperation ( const BinaryOperation b  )  [inline]

Copy constructor

Parameters:
b a given binary operation

Definition at line 196 of file BinaryOperation.hpp.

00197     : __type(b.__type)
00198   {
00199     ;
00200   }

BinaryOperation::~BinaryOperation (  )  [inline]

Destructor

Definition at line 206 of file BinaryOperation.hpp.

00207   {
00208     ;
00209   }


Member Function Documentation

static BinaryOperation::Type BinaryOperation::__getType ( const std::string &  typeName  )  [inline, static, private]

Definition at line 64 of file BinaryOperation.hpp.

References max, min, and undefined.

00065   {
00066     if (typeName == "min") return BinaryOperation::min;
00067     if (typeName == "max") return BinaryOperation::max;
00068     return BinaryOperation::undefined;
00069   }

std::string BinaryOperation::name (  )  const [inline]

Gets the name of the binary operation

Returns:
operator name

Definition at line 92 of file BinaryOperation.hpp.

References __type, and_, difference, division, eq, ge, gt, le, lt, max, min, modulo, ne, or_, power, product, sum, undefined, ErrorHandler::unexpected, and xor_.

00093   {
00094     switch(__type) {
00095     case sum: {
00096       return "+";
00097     }
00098     case difference: {
00099       return "-";
00100     }
00101     case product: {
00102       return "*";
00103     }
00104     case division: {
00105       return "/";
00106     }
00107     case modulo: {
00108       return "%";
00109     }
00110     case power: {
00111       return "^";
00112     }
00113     case min: {
00114       return "min";
00115     }
00116     case max: {
00117       return "max";
00118     }
00119     case gt: {
00120       return ">";
00121     }
00122     case lt: {
00123       return "<";
00124     }
00125     case ge: {
00126       return ">=";
00127     }
00128     case le: {
00129       return "<=";
00130     }
00131     case eq: {
00132       return "==";
00133     }
00134     case ne: {
00135       return "!=";
00136     }
00137     case or_: {
00138       return "or";
00139     }
00140     case xor_: {
00141       return "xor";
00142     }
00143     case and_: {
00144       return "and";
00145     }
00146     case undefined: {
00147       return "undefined";
00148     }
00149     default: {
00150       throw ErrorHandler(__FILE__,__LINE__,
00151                          "unknown operator type",
00152                          ErrorHandler::unexpected);
00153     }
00154     }
00155     return "undefined";
00156   }

const BinaryOperation::Type& BinaryOperation::type (  )  const [inline]

Read-only access to the binary operation type

Returns:
__type

Definition at line 164 of file BinaryOperation.hpp.

References __type.

Referenced by ScalarFunctionBuilder::setBinaryOperation(), and ScalarFunctionBuilder::Simplifier::simplify().

00165   {
00166     return __type;
00167   }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const BinaryOperation b 
) [friend]

Writes the binary operation to a stream

Parameters:
os given stream
b binary operation
Returns:
os

Definition at line 80 of file BinaryOperation.hpp.

00082   {
00083     os << b.name();
00084     return os;
00085   }


Member Data Documentation

const Type BinaryOperation::__type [private]

type of the binary operation

Definition at line 61 of file BinaryOperation.hpp.

Referenced by name(), and type().


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

Generated on Wed Nov 19 00:04:07 2008 for FreeFEM3D (aka ff3d) by  doxygen 1.5.6