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

📄 c-wfc5.html

📁 vxworks相关论文
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<td colspan=1 rowspan=1><div class="CellBody"><a name="86249"> </a><b class="file">vxwWdLib.h</b> &nbsp;</div></td><td colspan=1 rowspan=1><div class="CellBody"><a name="86251"> </a>Watchdog timers (wraps <b class="library">wdLib</b>)&nbsp;</div></td></tr><tr><td colspan="20"><hr class="tablerule"></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p></p><dd><p class="Body"><a name="84736"> </a>The VxWorks Wrapper Classes are designed to provide C++ language bindings to VxWorks modules that are inherently object-oriented, but for which only C bindings have previously been available. <a href="c-wfc5.html#84743">Figure&nbsp;5-1</a> shows the inheritance relationships for all of the VxWorks Wrapper Classes. The classes are named to correspond with the VxWorks features that they wrap. For example, <b class="symbol_lc">VXWMsgQ </b>is the class of message queues, and provides a C++ interface to <b class="library">msgQLib</b>.</p></dl></dl><dl class="margin"><dd><p class="table" callout><table border="0" cellpadding="0" cellspacing="0"><tr valign="top"><td valign="top" width="40"><br><img border="0" alt="*" src="icons/caution.gif"></td><td><hr><div class="CalloutCell"><a name="85186"><b class="symbol_UC"><font face="Helvetica, sans-serif" size="-1" class="sans">CAUTION:  </font></b></a>The classes <b class="symbol_lc">VXWError</b> and <b class="symbol_lc">VXWIdObject</b> are used internally by the VxWorks Wrapper Classes. They are listed in <a href="c-wfc5.html#84743">Figure&nbsp;5-1</a> for completeness only. These two classes are not intended for direct use by applications.</div></td></tr><tr valign="top"><td></td><td><hr></td></tr><tr valign="middle"><td colspan="20"></td></tr></table></p callout><div class="frame"><h4 class="EntityTitle"><a name="84743"><font face="Helvetica, sans-serif" size="-1" class="sans">Figure 5-1:&nbsp;&nbsp;Wrapper-Class Inheritance</font></a></h4><dl class="margin"><div class="Anchor"><a name="84792"> </a><img class="figure" border="0" src="images/c-wfca.gif"></div></dl></div></dl><h4 class="EntityTitle"><a name="84807"><font face="Helvetica, sans-serif" size="-1" class="sans">Example 5-3:&nbsp;&nbsp;Watchdog Timers </font></a></h4><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84808"> </a>To illustrate the way in which the wrapper classes provide C++ language bindings for VxWorks objects, the following example exhibits methods in the watchdog timer class, <b class="symbol_lc">VXWWd</b>. See <a href="c-basic6.html#86844"><i class="title">2.6&nbsp;Watchdog Timers</i></a> for general information about watchdog timers.</p><dl class="margin"><dd><pre class="Code2"><b><a name="84812">/* Create a watchdog timer and set it to go off in 3 seconds. */  /* includes */  #include&nbsp;"vxWorks.h" #include&nbsp;"logLib.h" #include&nbsp;"vxwWdLib.h"  /* defines */  #define&nbsp;&nbsp;SECONDS (3)</a></b><dd> <b><a name="85207">task (void)     {     /* Create watchdog */</a></b></pre></dl></dl><dl class="margin"><dd><pre class="Code"><b><a name="85208">[1]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;VXWWd myWatchDog;          /* Set timer to go off in SECONDS - printing a message to stdout */  [2]      if (myWatchDog.start (sysClkRateGet( ) * SECONDS, logMsg,                     int ("Watchdog timer just expired\n")) == ERROR)         return (ERROR);          while (TIMER_NEEDED)                     {                     /* ... */             } [3]      }    </a></b></pre></dl><dl class="margin"><dd><p class="Body"><a name="84815"> </a>A notable difference from the C interface is that the wrapper classes allow you to manipulate watchdog timers as objects rather than through an object ID. Line [1] creates and names a watchdog object; C++ automatically calls the <b class="symbol_lc">VXWWd</b> constructor, implicitly invoking the C routine <b class="routine"><i class="routine">wdCreate</i></b><b>(&nbsp;)</b> to create a watchdog timer. </p><dd><p class="Body"><a name="84816"> </a>Line [2] in the example illustrates how to use a method from the wrapper classes. The example invokes the method <b class="routine"><i class="routine">start</i></b><b>(&nbsp;)</b> for the instance <b class="symbol_lc">myWatchDog</b> of the class <b class="symbol_lc">VXWWd</b> to call the timer. Because this method is invoked on a specific object, the argument list for the method <b class="routine"><i class="routine">start</i></b><b>(&nbsp;)</b> does not require an argument to identify which timer to start (unlike <b class="routine"><i class="routine">wdStart</i></b><b>(&nbsp;)</b>, the corresponding C routine). </p><dd><p class="Body"><a name="84817"> </a>Finally, because <b class="symbol_lc">myWatchDog</b> is a local object, exiting from the routine <b class="routine"><i class="routine">task</i></b><b>(&nbsp;)</b> on line [3] automatically calls the destructor for the <b class="symbol_lc">VXWWd</b> watchdog class. This implicit call to the destructor deallocates the watchdog object, and if the timer was still running removes it from the system timer queues. Thus, for objects declared on the stack, it is not necessary to call a routine equivalent to the C routine <b class="routine"><i class="routine">wdDelete</i></b><b>(&nbsp;)</b>. (However, if an object is created dynamically with the operator <b class="keyword">new</b>, you must delete it explicitly with the operator <b class="keyword">delete</b>, once your application no longer needs the object.)</p><dd><p class="Body"><a name="84819"> </a>For details of the wrapper classes and on each of the wrapper class functions, see the <i class="title">VxWorks Reference Manual</i>. </p></dl></dl><font face="Helvetica, sans-serif" class="sans"><h4 class="H3"><i><a name="84821">5.5.2  &nbsp;&nbsp;Tools.h++ Library</a></i></h4></font><dl class="margin"><dl class="margin"><dd><p class="Body"><a name="84823"> </a>Tools.h++ is an industry-standard foundation class library from Rogue Wave Software which supports the following features:</p></dl><dl class="margin"><ul class="DashSingle" type="circle"><li><a name="84824"> </a>A complete set of collection classes </li></ul><ul class="DashSingle" type="circle"><li><a name="84825"> </a>Template based classes </li></ul><ul class="DashSingle" type="circle"><li><a name="84826"> </a>Persistent store facility </li></ul><ul class="DashSingle" type="circle"><li><a name="84827"> </a>File classes and file space manager </li></ul><ul class="DashSingle" type="circle"><li><a name="84828"> </a>B-tree disk retrieval </li></ul><ul class="DashSingle" type="circle"><li><a name="84829"> </a>Multi-thread safety </li></ul><ul class="DashSingle" type="circle"><li><a name="84830"> </a>Multi-byte and wide character strings </li></ul><ul class="DashSingle" type="circle"><li><a name="84831"> </a>Localized string collation </li></ul><ul class="DashSingle" type="circle"><li><a name="84832"> </a>Parse and format times, dates, and currency in multiple locales </li></ul><ul class="DashSingle" type="circle"><li><a name="84833"> </a>Support for multiple time zones and daylight savings rules </li></ul><ul class="DashSingle" type="circle"><li><a name="84834"> </a>Support for localized messages </li></ul><ul class="DashSingle" type="circle"><li><a name="84835"> </a>Localized I/O streams </li></ul></dl><dl class="margin"><dd><p class="Body"><a name="84837"> </a>This library is configured into VxWorks by selecting <b class="symbol_UC">INCLUDE_CPLUS_TOOLS</b> for inclusion in the project facility VxWorks view; see <a href="c-wfc2.html#84436"><i class="title">5.2.4&nbsp;Configuration Constants</i></a>.</p><dd><p class="Body"><a name="86286"> </a>The Tools.h++ library header files reside in the VxWorks header file directory <i class="textVariable">installDir</i><b class="file">/target/h/rw</b>. To use this library, <b class="keyword">#include</b> one or more of these header files after the <b class="keyword">#include "vxWorks.h"</b> statement and after the <b class="keyword">#include</b> statements for all other VxWorks libraries in the appropriate modules of your application. For a list of all the header files and details on this library, see Rogue Wave's <i class="title">Tools.h++ Introduction and Reference Manual</i>. </p><dd><p class="Body"><a name="84917"> </a></p></dl></dl><a name="foot"><hr></a><p class="navbar" align="right"><a href="index.html"><img border="0" alt="[Contents]" src="icons/contents.gif"></a><a href="GuideIX.html"><img border="0" alt="[Index]" src="icons/index.gif"></a><a href="c-wfc.html"><img border="0" alt="[Top]" src="icons/top.gif"></a><a href="c-wfc4.html"><img border="0" alt="[Prev]" src="icons/prev.gif"></a><a href="c-smo.html"><img border="0" alt="[Next]" src="icons/next.gif"></a></p></body></html><!---by WRS Documentation (), Wind River Systems, Inc.    conversion tool:  Quadralay WebWorks Publisher 4.0.11    template:         CSS Template, Jan 1998 - Jefro --->

⌨️ 快捷键说明

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