#include <veMath.h>
Public Member Functions | |
Add (BasePtr lvalue, BasePtr rvalue) | |
Add (BinaryOp const &other) | |
Basic constructor. | |
virtual Variant | GetValue (void) const |
Copy constructor. | |
virtual Base * | copy (void) const |
Returns an exact copy of this object. |
Definition at line 46 of file veMath.h.
vValue::Expr::Math::Add::Add | ( | BasePtr | lvalue, | |
BasePtr | rvalue | |||
) | [inline] |
vValue::Expr::Math::Add::Add | ( | BinaryOp const & | other | ) | [inline] |
Variant vValue::Expr::Math::Add::GetValue | ( | void | ) | const [virtual] |
Copy constructor.
Returns the value in its native format
Returns the result of adding the lvalue and rvalue
Reimplemented from vValue::Expr::Core::Base.
Definition at line 48 of file veMath.cpp.
References vValue::Expr::Core::BinaryOp::m_lvalue, and vValue::Expr::Core::BinaryOp::m_rvalue.
00048 { 00049 const Variant lvalue = m_lvalue->GetValue(); 00050 const Variant rvalue = m_rvalue->GetValue(); 00051 //return boost::apply_visitor(AddVisitor(), lvalue, rvalue); 00052 /* 00053 if (boost::get<tString>(&lvalue) || boost::get<tString>(&rvalue)) 00054 return boost::lexical_cast<tString>lvalue 00055 + boost::lexical_cast<tString>rvalue; 00056 else 00057 */ 00058 if (boost::get<int>(&lvalue) && boost::get<int>(&rvalue)) 00059 return boost::get<int>(lvalue) + boost::get<int>(rvalue); 00060 /* 00061 else 00062 if (boost::get<float>(&lvalue) || boost::get<float>(&rvalue)) 00063 return boost::lexical_cast<float>(lvalue) 00064 + boost::lexical_cast<float>(rvalue); 00065 else 00066 throw(1);*/ 00067 return m_lvalue->GetFloat() + m_rvalue->GetFloat(); 00068 }
Base * vValue::Expr::Math::Add::copy | ( | void | ) | const [virtual] |
Returns an exact copy of this object.
Reimplemented from vValue::Expr::Core::BinaryOp.
Definition at line 70 of file veMath.cpp.
References Add().
00070 { 00071 return new Add(*this); 00072 }