Show
Ignore:
Timestamp:
08/30/09 22:13:15 (15 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/doc/html/codingrules.html

    r590 r591  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    2 <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
     1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     2<html xmlns="http://www.w3.org/1999/xhtml"> 
     3<head> 
     4<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> 
    35<title>mixpp: Coding Rules (Mostly inherited from IT++)</title> 
    4 <link href="tabs.css" rel="stylesheet" type="text/css"> 
    5 <link href="doxygen.css" rel="stylesheet" type="text/css"> 
    6 </head><body> 
    7 <!-- Generated by Doxygen 1.5.8 --> 
     6<link href="tabs.css" rel="stylesheet" type="text/css"/> 
     7<link href="doxygen.css" rel="stylesheet" type="text/css"/> 
     8</head> 
     9<body> 
     10<!-- Generated by Doxygen 1.6.1 --> 
    811<script type="text/javascript"> 
    912<!-- 
     
    5861</div> 
    5962<div class="contents"> 
    60 <h1><a class="anchor" name="codingrules">Coding Rules (Mostly inherited from IT++) </a></h1>In the following sections we describe the naming conventions which are used for files, classes, structures, local variables, and global variables.<h2><a class="anchor" name="cr_variables"> 
     63 
     64 
     65<h1><a class="anchor" id="codingrules">Coding Rules (Mostly inherited from IT++) </a></h1><p>In the following sections we describe the naming conventions which are used for files, classes, structures, local variables, and global variables.</p> 
     66<h2><a class="anchor" id="cr_variables"> 
    6167Default Naming Rules for Variables</a></h2> 
    62 Generally, variables are named using lower-case letters and words are separated using under-score. But there are many exceptions, for instance abbreviations or classical matematical notations. Therefore, coding rules for variables are quite free. Examples:<p> 
     68<p>Generally, variables are named using lower-case letters and words are separated using under-score. But there are many exceptions, for instance abbreviations or classical matematical notations. Therefore, coding rules for variables are quite free. Examples:</p> 
    6369<ul> 
    6470<li> 
     
    6975<code>`my_variable'</code>  </li> 
    7076</ul> 
    71 <h2><a class="anchor" name="cr_files"> 
     77<h2><a class="anchor" id="cr_files"> 
    7278Default Naming Rules for Files</a></h2> 
    73 Files are named using lower-case letters and words are separated using under-score. If an abbreviation is inevitable within file name, it is written with lower-case letters.<p> 
    74 Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p> 
     79<p>Files are named using lower-case letters and words are separated using under-score. If an abbreviation is inevitable within file name, it is written with lower-case letters.</p> 
     80<p>Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:</p> 
    7581<ul> 
    7682<li> 
     
    7985<code>`user_info.cpp'</code>  </li> 
    8086</ul> 
    81 <h2><a class="anchor" name="cr_file_templates"> 
     87<h2><a class="anchor" id="cr_file_templates"> 
    8288Form of the source files</a></h2> 
    83 For all the library classes, both header file `[filename].h' and source file `[filename].cpp' should be implemented. And the following few rules should be respected<p> 
     89<p>For all the library classes, both header file `[filename].h' and source file `[filename].cpp' should be implemented. And the following few rules should be respected</p> 
    8490<ul> 
    8591<li> 
    86 if possible, each `#include ... ' dircetive should be located within the `.h' file, one obvious exception is the case of `#include "[filename].h"' written in `[filename].cpp' <p> 
     92<p class="startli">if possible, each `#include ... ' dircetive should be located within the `.h' file, one obvious exception is the case of `#include "[filename].h"' written in `[filename].cpp' </p> 
     93<p class="endli"></p> 
    8794</li> 
    8895<li> 
    89 firstly, system headers should be included (i.e. those with brackets `#include &lt;system_header_name&gt;'), other headers (like `#include "my_header_name.h"') should follow (this rule leads to the faster search of an error on some compilators) <p> 
     96<p class="startli">firstly, system headers should be included (i.e. those with brackets `#include &lt;system_header_name&gt;'), other headers (like `#include "my_header_name.h"') should follow (this rule leads to the faster search of an error on some compilators) </p> 
     97<p class="endli"></p> 
    9098</li> 
    9199<li> 
    92 source code itself should be placed in the `.cpp' file, `.h' should contains only class declarations and documentation (this rule has a few exceptions like inline functions, templates and some extremely short function bodies)<p> 
     100<p class="startli">source code itself should be placed in the `.cpp' file, `.h' should contains only class declarations and documentation (this rule has a few exceptions like inline functions, templates and some extremely short function bodies)</p> 
     101<p class="endli"></p> 
    93102</li> 
    94103</ul> 
    95 <p> 
    96 Rules considering formatting of the source code itself are stored in the file /system/astylerc, which is a configuration file for code formating utility named ASTYLE. To apply them, download the proper version from its web page <a href="http://astyle.sourceforge.net/">http://astyle.sourceforge.net/</a><h2><a class="anchor" name="cr_functions"> 
     104<p>Rules considering formatting of the source code itself are stored in the file /system/astylerc, which is a configuration file for code formating utility named ASTYLE. To apply them, download the proper version from its web page <a href="http://astyle.sourceforge.net/">http://astyle.sourceforge.net/</a></p> 
     105<h2><a class="anchor" id="cr_functions"> 
    97106Default Naming Rules for Functions</a></h2> 
    98 Function names are named using lower-case letters and words are separated using under-score. Abbreviations, when used in function names, are also written with lower-case letters. This rule applies both to stand-alone functions as well as to member functions of classes. Example:<p> 
     107<p>Function names are named using lower-case letters and words are separated using under-score. Abbreviations, when used in function names, are also written with lower-case letters. This rule applies both to stand-alone functions as well as to member functions of classes. Example:</p> 
    99108<ul> 
    100109<li> 
    101110<code>int my_function_name(int a, int b)</code>  </li> 
    102111</ul> 
    103 <h2><a class="anchor" name="cr_specialfunctions"> 
     112<h2><a class="anchor" id="cr_specialfunctions"> 
    104113Convention for sensitive functions</a></h2> 
    105 For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name.<p> 
     114<p>For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name.</p> 
    106115<ul> 
    107116<li> 
    108117<code>mat* _internal_matrix()</code>  </li> 
    109118</ul> 
    110 <h2><a class="anchor" name="cr_classes"> 
     119<h2><a class="anchor" id="cr_classes"> 
    111120Default Naming Rules for Classes and Structures</a></h2> 
    112 Each new word in a class or structure name should always start with a capital letter and the words should not be separated. Abbreviations are written with capital letters. Examples:<p> 
     121<p>Each new word in a class or structure name should always start with a capital letter and the words should not be separated. Abbreviations are written with capital letters. Examples:</p> 
    113122<ul> 
    114123<li> 
     
    119128<code>`OFDM'</code>  </li> 
    120129</ul> 
    121 <h2><a class="anchor" name="cr_classes_functionality"> 
     130<h2><a class="anchor" id="cr_classes_functionality"> 
    122131Default Functionality of Classes</a></h2> 
    123 All classes that are configured by input parameters should include:<p> 
     132<p>All classes that are configured by input parameters should include:</p> 
    124133<ul> 
    125134<li> 
     
    130139setup function, preferably named <code>`setup'</code> or <code>`set_parameters'</code>  </li> 
    131140</ul> 
    132 <p> 
    133 Explicit destructor functions are not required, unless they are needed. It shall not be possible to use any of the other member functions unless the class has been properly initiated with the input parameters. </div> 
    134 <hr size="1"><address style="text-align: right;"><small>Generated on Sat Aug 29 20:49:42 2009 for mixpp by&nbsp; 
     141<p>Explicit destructor functions are not required, unless they are needed. It shall not be possible to use any of the other member functions unless the class has been properly initiated with the input parameters. </p> 
     142</div> 
     143<hr size="1"/><address style="text-align: right;"><small>Generated on Sun Aug 30 22:10:49 2009 for mixpp by&nbsp; 
    135144<a href="http://www.doxygen.org/index.html"> 
    136 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address> 
     145<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address> 
    137146</body> 
    138147</html>