TimeFeature.h

Go to the documentation of this file.
00001 
00024 #ifndef _TIMEFEATURE_H
00025 #define _TIMEFEATURE_H
00026 
00027 #include "../Feature.h"
00028 
00032 class FEATURE_EXPORT_CLASS TimeFeature : public PersistantFeature
00033 {
00034         friend class TimeFeatureProvider;
00035 
00036         public:
00038                 typedef enum {Timestamp, Second, Minute, Hour, Day, Weekday, Yearday, Month, Year} FeatureKind;
00039 
00040         protected:
00042                 TimeFeature(FeatureKind kind, time_t* minval, time_t* maxval);
00044                 TimeFeature(FeatureKind kind, time_t* minval, time_t* maxval, time_t timestamp);
00045 
00046         public:
00047                 virtual double getPosition() const;
00048                 virtual double getDistance(Feature *f) const;
00049                 virtual void moveTowards(Feature *f, double factor);
00050                 virtual string serialize() const;
00051                 virtual void unserialize(string value);
00052 
00053                 virtual featureparams write() const;
00054                 virtual void read(featureparams *param);
00055 
00056                 virtual Feature* clone() const;
00057                 virtual void aggregate(aggregatelist samples);
00058 
00059                 virtual FeatureType getType() const { return numerical_discrete; }
00060                 virtual const string getName() const;
00061 
00063                 virtual time_t getVal() const { return timestamp; }
00064 
00065                 const time_t getMin() const { return *minval; }
00066                 const time_t getMax() const { return *maxval; }
00067 
00068 #if _DEBUG_FEATURES
00069                 virtual string toString() const;
00070 #endif
00071 
00072         private:
00074 
00076                 time_t* minval;
00077                 time_t* maxval;
00078 
00079                 time_t timestamp;
00080                 FeatureKind feature;
00082 };
00083 
00087 class FEATURE_EXPORT_CLASS TimeFeatureProvider : public FeatureProvider
00088 {
00089         private:
00091 
00093                 time_t timeFeature_maxval;
00094                 time_t timeFeature_minval;
00095                 stringvector features;
00096                 map<string, TimeFeature::FeatureKind> featuremap;
00097 
00098                 time_t timestamp;
00100 
00101         public:
00103                 TimeFeatureProvider(providerparams &params);
00104 
00105                 virtual Feature* getFeature(string name) const;
00106                 virtual Feature* getSample(string name) const;
00107                 virtual void nextSample(clock_t checkpoint);
00108 };
00109 
00110 #endif // _TIMEFEATURE_H

Generated on Mon Jun 5 10:20:42 2006 for Intelligence.kdevelop by  doxygen 1.4.6