root/doc/html/codingrules.html @ 99

Revision 99, 4.2 kB (checked in by smidl, 16 years ago)

doc

Line 
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">
3<title>mixpp: Coding Rules (Mostly inherited from IT++)</title>
4<link href="doxygen.css" rel="stylesheet" type="text/css">
5<link href="tabs.css" rel="stylesheet" type="text/css">
6</head><body>
7<!-- Generated by Doxygen 1.5.5 -->
8<div class="navigation" id="top">
9  <div class="tabs">
10    <ul>
11      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
12      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
13      <li><a href="annotated.html"><span>Classes</span></a></li>
14      <li><a href="files.html"><span>Files</span></a></li>
15    </ul>
16  </div>
17</div>
18<div class="contents">
19<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">
20Default Naming Rules for Variables</a></h2>
21Variables are named using lower-case letters and words are separated using under-score. Abbreviations, when used in variable names, are also written with lower-case letters. Examples:<p>
22<ul>
23<li>
24<code>`fft_size'</code>  </li>
25<li>
26<code>`nrof_paths'</code>  </li>
27<li>
28<code>`my_variable_name'</code>  </li>
29</ul>
30<p>
31Some variable names or parts of variable names are commonly used in several different functions and files to denote the same thing. For instance the following common names and prefixes should be used:<p>
32<ul>
33<li>
34<code>`rows'</code> - number of rows in a matrix  </li>
35<li>
36<code>`cols'</code> - number of columns in a matrix  </li>
37<li>
38<code>`nrof_'</code> - number of ...  </li>
39</ul>
40<h2><a class="anchor" name="cr_files">
41Default Naming Rules for Files</a></h2>
42Files are named using lower-case letters and words are separated using under-score. Abbreviations, when used in file names, are also written with lower-case letters.<p>
43Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p>
44<ul>
45<li>
46<code>`my_file.h'</code>  </li>
47<li>
48<code>`my_file.cpp'</code>  </li>
49</ul>
50<h2><a class="anchor" name="cr_functions">
51Default Naming Rules for Functions</a></h2>
52Function 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>
53<ul>
54<li>
55<code>int my_function_name(int a, int b)</code>  </li>
56</ul>
57<h2><a class="anchor" name="cr_specialfunctions">
58Convention for sensitive functions</a></h2>
59For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name.<p>
60<ul>
61<li>
62<code>mat* _internal_matrix()</code>  </li>
63</ul>
64<h2><a class="anchor" name="cr_classes">
65Default Naming Rules for Classes and Structures</a></h2>
66Each new word in a class or structure name should always start with a capital letter and the words should be separated with an under-score. Abbreviations are written with capital letters. Examples:<p>
67<ul>
68<li>
69<code>`My_Class_Name'</code>  </li>
70<li>
71<code>`My_Struct_Name'</code>  </li>
72<li>
73<code>`OFDM'</code>  </li>
74</ul>
75<h2><a class="anchor" name="cr_classes_functionality">
76Default Functionality of Classes</a></h2>
77All classes that are configured by input parameters should include:<p>
78<ul>
79<li>
80default empty constructor  </li>
81<li>
82one or more additional constructor(s) that takes input parameters and initializes the class instance  </li>
83<li>
84setup function, preferably named <code>`setup'</code> or <code>`set_parameters'</code>  </li>
85</ul>
86<p>
87Explicit 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>
88<hr size="1"><address style="text-align: right;"><small>Generated on Fri May 9 16:15:22 2008 for mixpp by&nbsp;
89<a href="http://www.doxygen.org/index.html">
90<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
91</body>
92</html>
Note: See TracBrowser for help on using the browser.