|
UniSet
1.7.0
|
00001 #ifndef _RRDServer_H_ 00002 #define _RRDServer_H_ 00003 // ----------------------------------------------------------------------------- 00004 #include "UObject_SK.h" 00005 #include "SMInterface.h" 00006 #include "SharedMemory.h" 00007 #include "extensions/Extensions.h" 00008 // ----------------------------------------------------------------------------- 00057 class RRDServer: 00058 public UObject_SK 00059 { 00060 public: 00061 RRDServer( UniSetTypes::ObjectId objId, xmlNode* cnode, UniSetTypes::ObjectId shmID, SharedMemory* ic=0, 00062 const std::string prefix="rrd", DebugStream& log=UniSetExtensions::dlog ); 00063 virtual ~RRDServer(); 00064 00066 static RRDServer* init_rrdstorage( int argc, const char* const* argv, 00067 UniSetTypes::ObjectId shmID, SharedMemory* ic=0, 00068 const std::string prefix="rrd" ); 00069 00071 static void help_print( int argc, const char* const* argv ); 00072 00073 protected: 00074 RRDServer(); 00075 00076 virtual void askSensors( UniversalIO::UIOCommand cmd ); 00077 virtual void sensorInfo( UniSetTypes::SensorMessage* sm ); 00078 virtual void timerInfo( UniSetTypes::TimerMessage* tm ); 00079 virtual void sysCommand( UniSetTypes::SystemMessage* sm ); 00080 00081 virtual void initRRD( xmlNode* cnode, int tmID ); 00082 void step(); 00083 00084 SMInterface* shm; 00085 00086 struct DSInfo 00087 { 00088 std::string dsname; 00089 long value; 00090 00091 DSInfo( const std::string& dsname, long defval ): 00092 dsname(dsname),value(defval){} 00093 }; 00094 00095 typedef std::map<UniSetTypes::ObjectId,DSInfo> DSMap; 00096 00097 struct RRDInfo 00098 { 00099 std::string filename; 00100 long tid; 00101 long sec; 00102 DSMap dsmap; 00103 00104 RRDInfo( const std::string& fname, long tmID, long sec, const DSMap& ds ): 00105 filename(fname),tid(tmID),sec(sec),dsmap(ds){} 00106 }; 00107 00108 typedef std::list<RRDInfo> RRDList; 00109 00110 RRDList rrdlist; 00111 00112 private: 00113 00114 std::string prefix; 00115 }; 00116 // ----------------------------------------------------------------------------- 00117 #endif // _RRDServer_H_ 00118 // -----------------------------------------------------------------------------
1.7.6.1