OutputCmd.h
Go to the documentation of this file.00001
00002 #ifndef INCLUDED_OutputCmd_h
00003 #define INCLUDED_OutputCmd_h
00004
00005
00006 class OutputCmd {
00007 public:
00008
00009 OutputCmd() : value(0), weight(0) {}
00010 OutputCmd(float v) : value(v), weight(1) {}
00011 OutputCmd(float v, float w) : value(v), weight(w) {}
00012 OutputCmd(const OutputCmd& a, const OutputCmd& b, float w) : value(a.value*w+b.value*(1-w)), weight(a.weight*w+b.value*(1-w)) {}
00013
00014
00015 OutputCmd& operator=(const OutputCmd& oc) { value=oc.value; weight=oc.weight; return *this; }
00016
00017 OutputCmd& operator=(float v) { value=v; weight=1; return *this; }
00018
00019 inline void set(float v, float w=1) { value=v; weight=w; }
00020 inline void set(const OutputCmd& a, const OutputCmd& b, float w) { value=a.value*w+b.value*(1-w); weight=a.weight*w+b.weight*(1-w); }
00021 inline void unset() { value=weight=0; }
00022 bool operator==(const OutputCmd& c) const { return value==c.value && weight==c.weight; }
00023 bool operator!=(const OutputCmd& c) const { return value!=c.value || weight!=c.weight; }
00024
00025 float value;
00026 float weight;
00027 static OutputCmd unused;
00028 };
00029
00030
00031
00032
00033
00034
00035 #endif