⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node122.html

📁 相关搜索: ns2仿真结果分析 all-awk ns2 ns2 无限网络中awk文件 ... [2.tcl.rar] - 在ns2平台上实现对AODV协议的模拟
💻 HTML
字号:
<html><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><!--Converted with jLaTeX2HTML 2002 (1.62) JA patch-1.4patched version by:  Kenshi Muto, Debian Project.LaTeX2HTML 2002 (1.62),original version by:  Nikos Drakos, CBLU, University of Leeds* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan* with significant contributions from:  Jens Lippmann, Marek Rouchal, Martin Wilck and others --><HTML><HEAD><TITLE>11.1 C++ abstract base class TimerHandler</TITLE><META NAME="description" CONTENT="11.1 C++ abstract base class TimerHandler"><META NAME="keywords" CONTENT="everything"><META NAME="resource-type" CONTENT="document"><META NAME="distribution" CONTENT="global"><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1"><META NAME="Generator" CONTENT="jLaTeX2HTML v2002 JA patch-1.4"><META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css"><LINK REL="STYLESHEET" HREF="everything.css" tppabs="http://www.isi.edu/nsnam/ns/doc/everything.css"><LINK REL="next" HREF="node125.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node125.html"><LINK REL="previous" HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><LINK REL="up" HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><LINK REL="next" HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html3169"  HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3163"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3157"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3165"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3167"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3170"  HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html">11.1.1 Definition of a</A><B> Up:</B> <A NAME="tex2html3164"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html">11. Timers</A><B> Previous:</B> <A NAME="tex2html3158"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html">11. Timers</A> &nbsp <B>  <A NAME="tex2html3166"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html3168"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <BR><BR><!--End of Navigation Panel--><H1><A NAME="SECTION03810000000000000000"></A><A NAME="sec:abstractbaseclass"></A><BR>11.1 C++ abstract base class TimerHandler</H1><P>The abstract base class <TT>TimerHandler</TT>contains the following public member functions:<P><TABLE CELLPADDING=3 WIDTH="100%"><TR><TD ALIGN="RIGHT">[double delay]void sched</TD><TD ALIGN="LEFT">schedule a timer to                                expire delay seconds in the future</TD></TR><TR><TD ALIGN="RIGHT">[double delay]void resched</TD><TD ALIGN="LEFT">reschedule a timer                (similar to []sched, but timer may be pending)</TD></TR><TR><TD ALIGN="RIGHT">[]void cancel</TD><TD ALIGN="LEFT">cancel a pending timer</TD></TR><TR><TD ALIGN="RIGHT">[]int status</TD><TD ALIGN="LEFT">returns timer status                        (either TIMER_IDLE, TIMER_PENDING, or TIMER_HANDLING)</TD></TR></TABLE><P>The abstract base class <TT>TimerHandler</TT>contains the following protected members:<P><TABLE CELLPADDING=3 WIDTH="100%"><TR><TD ALIGN="RIGHT">[Event* e]virtual void expire</TD><TD ALIGN="LEFT"><TT>=0</TT></TD><TD ALIGN="LEFT">this method must be filled in by the timer client</TD></TR><TR><TD ALIGN="RIGHT">[Event* e]virtual void handle</TD><TD></TD><TD ALIGN="LEFT">consumes an event; invokes <I>expire()</I> and sets <I>status_</I> of the timer appropriately</TD></TR><TR><TD ALIGN="RIGHT"><TT>int status<BR>_</TT></TD><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT">keeps track of the current timer status</TD></TR><TR><TD ALIGN="RIGHT"><TT>Event event<BR>_</TT></TD><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT">event to be consumed upon timer expiration</TD></TR></TABLE><P>The pure virtual function <I>expire()</I> must be defined by the timer classes derivingfrom this abstract base class.<P>Finally, two private inline functions are defined:<PRE>        inline void _sched(double delay) {            (void)Scheduler::instance().schedule(this, &amp;event_, delay);        }        inline void _cancel() {            (void)Scheduler::instance().cancel(&amp;event_);        }</PRE><P>From this code we can see that timers make use of methods of the <TT>Scheduler</TT> class.<P><BR><HR><!--Table of Child-Links--><A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A><UL><LI><A NAME="tex2html3171"  HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html">11.1.1 Definition of a new timer</A><LI><A NAME="tex2html3172"  HREF="node124.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node124.html">11.1.2 Example: Tcp retransmission timer</A></UL><!--End of Table of Child-Links--><HR><!--Navigation Panel--><A NAME="tex2html3169"  HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html3163"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html3157"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html3165"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html"><IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="file:/usr/share/latex2html/icons/contents.png"></A> <A NAME="tex2html3167"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html"><IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="file:/usr/share/latex2html/icons/index.png"></A> <BR><B> Next:</B> <A NAME="tex2html3170"  HREF="node123.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node123.html">11.1.1 Definition of a</A><B> Up:</B> <A NAME="tex2html3164"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html">11. Timers</A><B> Previous:</B> <A NAME="tex2html3158"  HREF="node121.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node121.html">11. Timers</A> &nbsp <B>  <A NAME="tex2html3166"  HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>  &nbsp <B>  <A NAME="tex2html3168"  HREF="node590.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node590.html">Index</A></B> <!--End of Navigation Panel--><ADDRESS>2003-09-23</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -