• 欢迎浏览“String me = Creater\忠实的资深Linux玩家;”,请文明浏览,理性发言,有侵犯你的权益请邮件我(creater@vip.qq.com).
  • 把任何的失败都当作一次尝试,不要自卑;把所有的成功都想成是一种幸运,不要自傲。
  •    5年前 (2013-06-14)  Socket library |   4 条评论  10 
    文章评分 0 次,平均分 0.0

    该类用来管理 Timer events,是一个纯虚的基类。
    IEventHandler并不是直接与 Timer events打交道,而是透过IEventOwner交互。凡是想使用 Timer events的类都需要继承自IEventOwner。
    IEventOwner是一个 Timer events的拥有者,IEventHandler则是对 Timer events进行处理。

    #ifndef _SOCKETS_IEventHandler_H
    #define _SOCKETS_IEventHandler_H
    
    #include "sockets-config.h"
    
    #ifdef SOCKETS_NAMESPACE
    namespace SOCKETS_NAMESPACE {
    #endif
    
    
    class IEventOwner;
    
    /** Timer event handler pure virtual base class.
    	\ingroup timer */
    class IEventHandler
    {
    public:
    	virtual ~IEventHandler() {}
    
    	/** Return time left until next event.
    		\param tv Time struct that will be filled by method
    		\return true if time is set for next event */
    	virtual bool GetTimeUntilNextEvent(struct timeval *) = 0;
    	/** Will fire events whose time has come. */
    	virtual void CheckEvents() = 0;
    	/** Schedule event for an owner.
    		\param from Event owner
    		\param sec Seconds until event
    		\param usec Microseconds until event */
    	virtual long AddEvent(IEventOwner *,long sec,long usec) = 0;
    	/** Clear all events for a specific owner. */
    	virtual void ClearEvents(IEventOwner *) = 0;
    	/** Remove one specific event for an event owner. */
    	virtual void RemoveEvent(IEventOwner *,long) = 0;
    
    };
    
    #ifdef SOCKETS_NAMESPACE
    }
    #endif
    
    #endif // _SOCKETS_IEventHandler_H
     

    除特别注明外,本站所有文章均为String me = "Creater\忠实的资深Linux玩家";原创,转载请注明出处来自http://unix8.net/home.php/1519.html

    关于

    发表评论

    暂无评论

    切换注册

    登录

    忘记密码 ?

    切换登录

    注册

    扫一扫二维码分享