00001 00024 #ifndef _SYSTEMCOMMANDSTRINGLIST_H 00025 #define _SYSTEMCOMMANDSTRINGLIST_H 00026 00027 #include "AbstractString.h" 00028 #include "../util/Thread.h" 00029 00033 class SystemCommandStringListFeature: public AbstractStringListFeature 00034 { 00035 private: 00037 const string providerName; 00039 const string featureName; 00040 00041 public: 00043 SystemCommandStringListFeature(stringcode *code, long* maxlen, const stringvector *names, const string providerName, const string featureName) : 00044 AbstractStringListFeature(code, maxlen, names), providerName(providerName), featureName(featureName) {} 00046 SystemCommandStringListFeature(stringcode *code, long* maxlen, const string providerName, const string featureName) : 00047 AbstractStringListFeature(code, maxlen), providerName(providerName), featureName(featureName) {} 00048 00049 virtual const string getName() const; 00050 00051 #if _DEBUG_FEATURES 00052 virtual string toString() const; 00053 #endif 00054 }; 00055 00058 class SystemCommandStringListFeatureProvider : public FeatureProvider, public Thread 00059 { 00060 private: 00062 00063 const string providerName; 00064 const string featureName; 00065 stringcode* stringCodeList; 00066 long* maxlen; 00067 int delay; 00068 mutable Lock lockStringList; 00069 00070 string executeSystemCommand(); 00072 00073 protected: 00075 string systemCommand; 00076 00077 public: 00079 static void initialize(string name); 00080 00082 SystemCommandStringListFeatureProvider( 00083 string featureProviderName, 00084 string featureName, 00085 string systemCommand, 00086 stringvector* featureList, 00087 stringcode* stringCodeList, 00088 long* maxlen, 00089 featureparams& params); 00091 virtual ~SystemCommandStringListFeatureProvider() throw(); 00092 00093 virtual Feature* getFeature(string name) const; 00094 virtual Feature* getSample(string name) const; 00095 virtual void nextSample(clock_t checkpoint); 00096 00097 virtual void run() throw(); 00098 00099 protected: 00101 00102 stringvector stringList; 00103 bool stringListValid; 00105 }; 00106 00107 #endif 00108