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 inline void set(float v, float w=1) { value=v; weight=w; }
00015 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); }
00016 inline void unset() { value=weight=0; }
00017 bool operator==(const OutputCmd& c) const { return value==c.value && weight==c.weight; }
00018 bool operator!=(const OutputCmd& c) const { return value!=c.value || weight!=c.weight; }
00019
00020 float value;
00021 float weight;
00022 };
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #endif