#ifndef __SSMD_SYNCER_H__ #define __SSMD_SYNCER_H__ #include #include #include #include class Snmp; namespace SSMD { class SettingsParser; class Switch; class Timer { public: Timer(boost::function callback, time_t interval); ~Timer(); void fire(); time_t getInterval() const { return _interval; } time_t getLastFire() const { return _lastFire; } int getTimeout() const; private: time_t _interval; time_t _lastFire; boost::function _callback; }; typedef std::list::iterator TimerIterator; typedef std::pair TimedSwitch; class Syncer { public: Syncer(SettingsParser & sp, Snmp & snmp); ~Syncer(); void run(const bool & running, bool & reload); private: SettingsParser & _settingsParser; Snmp & _snmp; std::list _timers; std::list _switches; bool wait(); void syncInfo(); Timer & getNextTimer(); bool getSwitchesState(std::map & switches); bool getDBData(std::string & data) const; }; } #endif