📄 node65.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>7.1 The C++ Queue Class</TITLE><META NAME="description" CONTENT="7.1 The C++ Queue Class"><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="node68.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node68.html"><LINK REL="previous" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><LINK REL="up" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><LINK REL="next" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html"></HEAD><BODY ><!--Navigation Panel--><A NAME="tex2html2320" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html2314" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html2308" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html2316" 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="tex2html2318" 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="tex2html2321" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html">7.1.1 Queue blocking</A><B> Up:</B> <A NAME="tex2html2315" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html">7. Queue Management and</A><B> Previous:</B> <A NAME="tex2html2309" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html">7. Queue Management and</A>   <B> <A NAME="tex2html2317" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html2319" 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="SECTION03410000000000000000"></A><A NAME="sec:qclass"></A><BR>7.1 The C++ Queue Class</H1><P>The <TT>Queue</TT> class is derived from a <TT>Connector</TT> base class.It provides a base class used by particular types of (derived) queue classes,as well as a call-back function to implement blocking (see next section).The following definitions are provided in <TT>queue.h</TT>:<PRE> class Queue : public Connector { public: virtual void enque(Packet*) = 0; virtual Packet* deque() = 0; void recv(Packet*, Handler*); void resume(); int blocked(); void unblock(); void block(); protected: Queue(); int command(int argc, const char*const* argv); int qlim_; /* maximum allowed pkts in queue / int blocked_; int unblock_on_resume_; /* unblock q on idle? / QueueHandler qh_; };</PRE>The <TT>enque</TT> and <TT>deque</TT> functions are pure virtual, indicatingthe <TT>Queue</TT> class is to be used as a base class;particular queues are derivedfrom <TT>Queue</TT> and implement these two functions as necessary.Particular queues do not, in general, override the <TT>recv</TT> functionbecause it invokes thethe particular <TT>enque</TT> and <TT>deque</TT>.<P>The <TT>Queue</TT> class does not contain much internal state.Often these arespecial monitoring objectsChapterchap:trace.The <TT>qlim_</TT> member is constructed to dictate a bound on the maximumqueue occupancy, but this is not enforced by the <TT>Queue</TT> class itself; itmust be used by the particular queue subclasses if they need this value.The <TT>blocked_</TT> member is a boolean indicating whether thequeue is able to send a packet immediately to its downstream neighbor.When a queue is blocked, it is able to enqueue packets but not send them.<P><BR><HR><!--Table of Child-Links--><A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A><UL><LI><A NAME="tex2html2322" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html">7.1.1 Queue blocking</A><LI><A NAME="tex2html2323" HREF="node67.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node67.html">7.1.2 PacketQueue Class</A></UL><!--End of Table of Child-Links--><HR><!--Navigation Panel--><A NAME="tex2html2320" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html"><IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="file:/usr/share/latex2html/icons/next.png"></A> <A NAME="tex2html2314" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="file:/usr/share/latex2html/icons/up.png"></A> <A NAME="tex2html2308" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html"><IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="file:/usr/share/latex2html/icons/prev.png"></A> <A NAME="tex2html2316" 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="tex2html2318" 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="tex2html2321" HREF="node66.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node66.html">7.1.1 Queue blocking</A><B> Up:</B> <A NAME="tex2html2315" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html">7. Queue Management and</A><B> Previous:</B> <A NAME="tex2html2309" HREF="node64.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node64.html">7. Queue Management and</A>   <B> <A NAME="tex2html2317" HREF="node1.html" tppabs="http://www.isi.edu/nsnam/ns/doc/node1.html">Contents</A></B>   <B> <A NAME="tex2html2319" 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 + -