00001 /* -*- C++ -*- */ 00002 00003 /* COPYRIGHT 00004 * 00005 * This file is part of the Visual Effects Engine - VEE 00006 * 00007 * Read the "VEE-LICENSE" file for the license. 00008 * 00009 * Authors & Copyright: 00010 * 00011 * Tommi Ilmonen, Tuukka Heikura, Marko Myllymaa and 00012 * Janne Kontkanen 2001-2004 00013 * 00014 * Additional copyrights: Tekes 2003-2004 00015 * 00016 * firstname.lastname@hut.fi 00017 * 00018 */ 00019 00020 #ifndef VEE_OPERATOR_MATH_H 00021 #define VEE_OPERATOR_MATH_H 00022 00023 #include <vee_object.h> 00024 #include <vee_operator_random.h> 00025 00026 template <class T> 00027 class VEE_OperatorMath : public VEE_Operator 00028 { 00029 public: 00030 VEE_OperatorMath(); 00031 virtual ~VEE_OperatorMath(); 00032 00033 virtual void operate(VEE_Object *, float); 00034 virtual VEE_Operator * clone() const; 00035 00036 00037 void setId(const std::string &id) { m_id = id; } 00038 void setOperation(VEE_MathOperation op) { m_operation = op; } 00039 00040 void set(const T &v) { m_value = v; } 00041 00042 static inline T defaultValue(); 00043 00044 protected: 00045 00046 VEE_MathOperation m_operation; 00047 std::string m_id; 00048 T m_value; 00049 00050 }; 00051 00052 // template <float> 00053 template<> 00054 inline float VEE_OperatorMath<float>::defaultValue() 00055 { 00056 return 0.0; 00057 } 00058 00059 typedef VEE_OperatorMath<float> VEE_OperatorMathFloat; 00060 00061 #endif