Author: janderwald Date: Mon May 26 10:23:24 2008 New Revision: 33712
URL: http://svn.reactos.org/svn/reactos?rev=33712&view=rev Log: - add support for a future timeout callback mechanism
Added: trunk/reactos/tools/sysreg/timer_callback.h (with props) trunk/reactos/tools/sysreg/timer_command_callback.cpp (with props) trunk/reactos/tools/sysreg/timer_command_callback.h (with props) Modified: trunk/reactos/tools/sysreg/sysreg.rbuild
Modified: trunk/reactos/tools/sysreg/sysreg.rbuild URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/sysreg.rbuild?... ============================================================================== --- trunk/reactos/tools/sysreg/sysreg.rbuild [iso-8859-1] (original) +++ trunk/reactos/tools/sysreg/sysreg.rbuild [iso-8859-1] Mon May 26 10:23:24 2008 @@ -21,4 +21,5 @@ <file>sysreg.cpp</file> <file>file_reader.cpp</file> <file>os_support.cpp</file> + <file>timer_command_callback.cpp</file> </module>
Added: trunk/reactos/tools/sysreg/timer_callback.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/timer_callback... ============================================================================== --- trunk/reactos/tools/sysreg/timer_callback.h (added) +++ trunk/reactos/tools/sysreg/timer_callback.h [iso-8859-1] Mon May 26 10:23:24 2008 @@ -1,0 +1,56 @@ +#ifndef TIMER_CALLBACK_H__ +#define TIMER_CALLBACK_H__ + + +namespace System_ +{ +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: base class for all timer callback functions + + class TimerCallback + { + public: +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: constructor of class TimerCallback + + TimerCallback() {} + +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: destructor of class TimerCallback + + virtual ~TimerCallback() {} + + +//--------------------------------------------------------------------------------------- +/// +/// initialize +/// +/// Description: this function is called when the timercallback object is initialized in +/// in the callback mechanism + + virtual bool initialize(){ return true;} + + +//--------------------------------------------------------------------------------------- +/// +/// hasExpired +/// +/// Description: this function is called everytime timer event has started. The callback object +/// should return true if the expiration function has expired. +/// Note: the function should then also cleanup all consumed resourced + + virtual bool hasExpired() = 0; + }; //end of class TimerCallback + +}// end of namespace System_ + +#endif
Propchange: trunk/reactos/tools/sysreg/timer_callback.h ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/tools/sysreg/timer_command_callback.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/timer_command_... ============================================================================== --- trunk/reactos/tools/sysreg/timer_command_callback.cpp (added) +++ trunk/reactos/tools/sysreg/timer_command_callback.cpp [iso-8859-1] Mon May 26 10:23:24 2008 @@ -1,0 +1,41 @@ +#include "timer_command_callback.h" + + +namespace System_ +{ + using Sysreg_::ConfigParser; + + string TimerCommandCallback::ROS_TIMER_COMMAND="ROS_TIMER_COMMAND"; + string TimerCommandCallback::ROS_TIMER_TIMEOUT="ROS_TIMER_TIMEOUT"; + +//--------------------------------------------------------------- + TimerCommandCallback::TimerCommandCallback(ConfigParser &conf_parser) : TimerCallback(), m_parser(conf_parser), m_Cmd(""), m_Timeout(0) + { + } +//--------------------------------------------------------------- + TimerCommandCallback::~TimerCommandCallback() + { + } +//--------------------------------------------------------------- + bool TimerCommandCallback::initialize() + { + m_parser.getStringValue(ROS_TIMER_COMMAND, m_Cmd); + m_parser.getIntValue(ROS_TIMER_TIMEOUT, m_Timeout); + //FIXME + // calculate current time + + return true; + } + +//--------------------------------------------------------------- + bool TimerCommandCallback::hasExpired() + { + + // FIXME + // calculate current time + // calculate difference + // and invoke m_Cmd when it has expired + return false; + } + +} // end of namespace System_
Propchange: trunk/reactos/tools/sysreg/timer_command_callback.cpp ------------------------------------------------------------------------------ svn:eol-style = native
Added: trunk/reactos/tools/sysreg/timer_command_callback.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/tools/sysreg/timer_command_... ============================================================================== --- trunk/reactos/tools/sysreg/timer_command_callback.h (added) +++ trunk/reactos/tools/sysreg/timer_command_callback.h [iso-8859-1] Mon May 26 10:23:24 2008 @@ -1,0 +1,57 @@ +#ifndef TIMER_COMMAND_CALLBACK_H__ //timer_command_callback.h +#define TIMER_COMMAND_CALLBACK_H__ + +#include "conf_parser.h" +#include "timer_callback.h" + +namespace System_ +{ + + class TimerCommandCallback : public TimerCallback + { + public: +//--------------------------------------------------------------- +/// +/// TimerCommandCallback +/// +/// Description: constructor of class TimerCommandCallback +/// +/// @param conf_parser contains configuration data + + TimerCommandCallback(Sysreg_::ConfigParser &conf_parser); + +//--------------------------------------------------------------- +/// +/// ~TimerCommandCallback +/// +/// Description: destructor of class TimerCommandCallback + + virtual ~TimerCommandCallback(); + +//--------------------------------------------------------------- +/// +/// initialize +/// +/// Description: initializes the callback object + + virtual bool initialize(); + +//--------------------------------------------------------------- +/// +/// hasExpired +/// +/// Description: returns true when the callback object has expired + + virtual bool hasExpired(); + protected: + Sysreg_::ConfigParser & m_parser; + string m_Cmd; + long int m_Timeout; + static string ROS_TIMER_TIMEOUT; + static string ROS_TIMER_COMMAND; + }; + +} /* EOF namspace System_ */ + + +#endif /* EOF TIMER_COMMAND_CALLBACK_H__ */
Propchange: trunk/reactos/tools/sysreg/timer_command_callback.h ------------------------------------------------------------------------------ svn:eol-style = native