Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > e7618febbb9cbed15bb79e326774c050 > files > 1893

ompl-devel-0.9.5-1.fc14.i686.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8"/>
<title>OMPL: OMPL Style Guide</title>
<meta name="author" content="Ioan A. Șucan, Mark Moll, Lydia E. Kavraki">
<link rel="stylesheet" href="../css/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print">
<!--[if lt IE 7]>
<script type="text/javascript" src="../js/jquery/jquery.js"></script>
<script type="text/javascript" src="../js/jquery/jquery.dropdown.js"></script>
<![endif]-->
<script type="text/javaScript" src="search/search.js"></script>
<script type="text/javascript">
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-9156598-2']);
  _gaq.push(['_trackPageview']);
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
</script>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search API');
--></script>
<div class="navigation" id="top">
  <div class="tabs" id="ompltitle">
    <ul class="tablist">
      <li>The Open Motion Planning Library</li>
      <li id="searchli">
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search API" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)"
               onblur="searchBox.OnSearchFieldFocus(false)"
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>

  <ul id="nav" class="dropdown">
    <li class="first"><a href="index.html">Home</a></li>
    <li><a href="download.html">Download</a></li>
    <li><a href="documentation.html">Documentation</a></li>
    <li><span class="dir">Code API</span>
      <ul>
        <li><a href="api_overview.html">API Overview</a></li>
        <li><a href="namespaces.html">Namespaces</a></li>
        <li><a href="annotated.html">Classes</a></li>
        <li><a href="files.html">Files</a></li>
        <li><a href="dirs.html">Directories</a></li>
      </ul>
    </li>
    <li><span class="dir">Community</span>
      <ul>
        <li><a href="developers.html">Developers</a></li>
        <li><a href="thirdparty.html">Contributions</a></li>
        <li><a href="education.html">Education</a></li>
        <li><a href="gallery.html">Gallery</a></li>
      </ul>
    </li>
    <li><span class="dir">About</span>
      <ul>
        <li><a href="license.html">License</a></li>
        <li><a href="citations.html">Citations</a></li>
        <li><a href="acknowledgements.html">Acknowledgments</a></li>
        <li><a href="contact.html">Contact Us</a></li>
      </ul>
    </li>
  </ul>
</div>

<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
  onmouseover="return searchBox.OnSearchSelectShow()"
  onmouseout="return searchBox.OnSearchSelectHide()"
  onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
  <iframe src="" frameborder="0"name="MSearchResults" id="MSearchResults"></iframe>
</div>

<div class="container">
  <div class="span-22 push-2 first last">
  <div>
<!-- Generated by Doxygen 1.7.4 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">OMPL Style Guide </div>  </div>
</div>
<div class="contents">
<div class="textblock"><p>This document provides a brief overview of OMPL coding standards. It is meant to assist developers who are contributing code to OMPL. <br/>
</p>
<h2><a class="anchor" id="Spacing"></a>
Spacing</h2>
<ul>
<li>Each source block should be indented by 4 space characters. No tab characters should appear in source code.</li>
<li>Each enclosing brace should reside on its own line, but braces can be omitted if the enclosed block consists of exactly one line.</li>
</ul>
<p>The following is an example of desirable code spacing. </p>
<div class="fragment"><pre class="fragment"><span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0 ; i &lt; 50 ; ++i)
{
    <span class="keywordflow">if</span> (i % 2 == 0)
        std::cout &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;
}
</pre></div><h2><a class="anchor" id="filenamesAndMacros"></a>
Filenames &amp; Macros</h2>
<ul>
<li>Source filenames should begin each word with a capital letter, and there should be no underscores between words.</li>
<li>Header files should use the .h extension, and implementation files should use the .cpp extension.</li>
<li>Each implementation file should reside in a src/ directory, immediately below the directory containing the corresponding header file.</li>
<li>Include guards in header files should be of the form OMPL_PATH_FILENAME_, where the words in the filename are separated by underscores.</li>
</ul>
<p>For example, the header and implementation files in which <a class="el" href="classompl_1_1RNG.html" title="Random number generation. An instance of this class cannot be used by multiple threads at once (membe...">ompl::RNG</a> is defined are <a class="el" href="RandomNumbers_8h_source.html">ompl/util/RandomNumbers.h</a> and <a class="el" href="RandomNumbers_8cpp_source.html">ompl/util/src/RandomNumbers.cpp</a>, respectively. The header file begins with the include guard </p>
<div class="fragment"><pre class="fragment"><span class="preprocessor">#ifndef OMPL_UTIL_RANDOM_NUMBERS_</span>
</pre></div><h2><a class="anchor" id="functionsAndClasses"></a>
Functions &amp; Classes</h2>
<ul>
<li>Function names should begin with a lower-case letter and should begin each subsequent word with a capital letter, and there should be no underscores between words (e.g., <em><a class="el" href="classompl_1_1base_1_1StateSpace.html#ad12cc022ef531dcb563f6d3d13b847ad" title="Set the name of the state space.">ompl::base::StateSpace::setName()</a></em>).</li>
<li>Functions accepting no parameters should have void in place of a parameter list.</li>
<li>Class names should begin each word with a capital letter, again with no underscores (e.g., <a class="el" href="classompl_1_1base_1_1StateSpace.html" title="Representation of a space in which planning can be performed. Topology specific sampling, interpolation and distance are defined.">ompl::base::StateSpace</a>).</li>
<li>Scoping directives (<em>public</em>, <em>protected</em>, <em>private</em>) should be at the same level of indentation as the class declaration.</li>
<li>Class member variable names should begin with a lower-case letter and should begin each subsequent word with a capital letter. They should end with a single underscore (e.g., <a class="el" href="classompl_1_1base_1_1StateSpace.html#a8967afde4dc99333aef63eb85554bf81" title="The longest valid segment at the time setup() was called.">ompl::base::StateSpace::longestValidSegment_</a>).</li>
<li>Names of constants and static variables should be in all capital letters, with an underscore between each word (e.g., <a class="el" href="classompl_1_1base_1_1StateSpace.html#a45e65cf86a2c5cb1e4394dd8aafb4d3b" title="The name used for the default projection.">ompl::base::StateSpace::DEFAULT_PROJECTION_NAME</a>).</li>
</ul>
<p>For example, consider the following source code, which follows the above guidelines. </p>
<div class="fragment"><pre class="fragment"><span class="keyword">class </span>SampleObject
{
<span class="keyword">public</span>:
    SampleObject(<span class="keywordtype">void</span>) : objectTag_(NUM_INSTANCES++)
    {
    }

    <span class="keywordtype">int</span> getObjectTag(<span class="keywordtype">void</span>)<span class="keyword"> const</span>
<span class="keyword">    </span>{
        <span class="keywordflow">return</span> objectTag_;
    }

    <span class="keyword">static</span> <span class="keywordtype">int</span> NUM_INSTANCES;

<span class="keyword">private</span>:
    <span class="keyword">const</span> <span class="keywordtype">int</span> objectTag_;
};
<span class="keywordtype">int</span> SampleObject::NUM_INSTANCES = 0;
</pre></div><h2><a class="anchor" id="otherCodingGuidelines"></a>
Other Coding Guidelines</h2>
<ul>
<li>Compiler specific features should never be used (avoid use of #ifdef).</li>
<li>Code must compile without warnings.</li>
<li>If a class member function can be marked <em>const</em>, then it should be marked <em>const</em>.</li>
<li>Member functions marked as <em>const</em> must be thread safe. If a function is intended to be thread safe, it should be marked as <em>const</em> (one can use the <em>mutable</em> keyword if needed).</li>
<li>All classes, methods and member variables must be documented (Doxygen style).</li>
<li>Forward declaration of types should be done with the ClassForward() macro when shared pointers to the type are also needed: ClassForward() will define a shared pointer to the type using the <em>Ptr</em> suffix (e.g., <a class="el" href="classompl_1_1base_1_1StateSpacePtr.html" title="A boost shared pointer wrapper for ompl::base::StateSpace.">ompl::base::StateSpacePtr</a>).</li>
</ul>
</div></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div>

<div class="footer span-22 push-2 last">
  <a href="http://www.kavrakilab.org">Physical and Biological Computing Group</a> &bull;
  <a href="http://www.cs.rice.edu">Department of Computer Science</a> &bull;
  <a href="http://www.rice.edu">Rice University</a><br>
  <div class="gray">Generated on Sun Oct 9 2011 23:04:41 by&#160;<a href="http://www.doxygen.org/index.html">doxygen</a> 1.7.4</div>
</div>
</div>
</body>
</html>