00001 00024 #ifndef _POWER_H 00025 #define _POWER_H 00026 00027 #include "../Feature.h" 00028 00032 class FEATURE_EXPORT_CLASS PowerFeature : public Feature 00033 { 00034 friend class PowerFeatureProvider; 00035 00036 private: 00038 bool plugged; 00039 00040 protected: 00049 PowerFeature(); 00050 00057 PowerFeature(bool plugged); 00058 00059 public: 00060 virtual double getPosition() const; 00061 virtual double getDistance(Feature *f) const; 00062 virtual void moveTowards(Feature *f, double factor); 00063 00064 virtual string serialize() const; 00065 virtual void unserialize(string value); 00066 00067 virtual Feature* clone() const; 00068 virtual void aggregate(aggregatelist samples); 00069 00070 virtual FeatureType getType() const { return boolean; } 00071 virtual const string getName() const { return "Power.Plugged"; } 00072 00073 #if _DEBUG_FEATURES 00074 virtual string toString() const; 00075 #endif 00076 }; 00077 00081 class FEATURE_EXPORT_CLASS PowerFeatureProvider : public FeatureProvider 00082 { 00083 private: 00085 stringvector features; 00086 00088 00089 bool plugged; 00090 bool pluggedValid; 00092 00093 public: 00099 PowerFeatureProvider(providerparams ¶ms); 00100 00101 virtual Feature* getFeature(string name) const; 00102 virtual Feature* getSample(string name) const; 00103 virtual void nextSample(clock_t checkpoint); 00104 }; 00105 00106 #endif // _POWER_H