root/doc/html/codingrules.html @ 324

Revision 323, 5.6 kB (checked in by smidl, 15 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="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 -->
8<script type="text/javascript">
9<!--
10function changeDisplayState (e){
11  var num=this.id.replace(/[^[0-9]/g,'');
12  var button=this.firstChild;
13  var sectionDiv=document.getElementById('dynsection'+num);
14  if (sectionDiv.style.display=='none'||sectionDiv.style.display==''){
15    sectionDiv.style.display='block';
16    button.src='open.gif';
17  }else{
18    sectionDiv.style.display='none';
19    button.src='closed.gif';
20  }
21}
22function initDynSections(){
23  var divs=document.getElementsByTagName('div');
24  var sectionCounter=1;
25  for(var i=0;i<divs.length-1;i++){
26    if(divs[i].className=='dynheader'&&divs[i+1].className=='dynsection'){
27      var header=divs[i];
28      var section=divs[i+1];
29      var button=header.firstChild;
30      if (button!='IMG'){
31        divs[i].insertBefore(document.createTextNode(' '),divs[i].firstChild);
32        button=document.createElement('img');
33        divs[i].insertBefore(button,divs[i].firstChild);
34      }
35      header.style.cursor='pointer';
36      header.onclick=changeDisplayState;
37      header.id='dynheader'+sectionCounter;
38      button.src='closed.gif';
39      section.id='dynsection'+sectionCounter;
40      section.style.display='none';
41      section.style.marginLeft='14px';
42      sectionCounter++;
43    }
44  }
45}
46window.onload = initDynSections;
47-->
48</script>
49<div class="navigation" id="top">
50  <div class="tabs">
51    <ul>
52      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
53      <li class="current"><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
54      <li><a href="modules.html"><span>Modules</span></a></li>
55      <li><a href="annotated.html"><span>Classes</span></a></li>
56      <li><a href="files.html"><span>Files</span></a></li>
57    </ul>
58  </div>
59</div>
60<div class="contents">
61<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">
62Default Naming Rules for Variables</a></h2>
63Variables 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>
64<ul>
65<li>
66<code>`fft_size'</code>  </li>
67<li>
68<code>`nrof_paths'</code>  </li>
69<li>
70<code>`my_variable_name'</code>  </li>
71</ul>
72<p>
73Some 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>
74<ul>
75<li>
76<code>`rows'</code> - number of rows in a matrix  </li>
77<li>
78<code>`cols'</code> - number of columns in a matrix  </li>
79<li>
80<code>`nrof_'</code> - number of ...  </li>
81</ul>
82<h2><a class="anchor" name="cr_files">
83Default Naming Rules for Files</a></h2>
84Files 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>
85Source files are named using <code>`.cpp'</code> suffix, whereas header files end with <code>`.h'</code> extension. Examples:<p>
86<ul>
87<li>
88<code>`my_file.h'</code>  </li>
89<li>
90<code>`my_file.cpp'</code>  </li>
91</ul>
92<h2><a class="anchor" name="cr_functions">
93Default Naming Rules for Functions</a></h2>
94Function 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>
95<ul>
96<li>
97<code>int my_function_name(int a, int b)</code>  </li>
98</ul>
99<h2><a class="anchor" name="cr_specialfunctions">
100Convention for sensitive functions</a></h2>
101For efficiency, some functions may return pointers to internal variables. Such functionality is indicated by underscore as the first letter in the the name.<p>
102<ul>
103<li>
104<code>mat* _internal_matrix()</code>  </li>
105</ul>
106<h2><a class="anchor" name="cr_classes">
107Default Naming Rules for Classes and Structures</a></h2>
108Each 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>
109<ul>
110<li>
111<code>`My_Class_Name'</code>  </li>
112<li>
113<code>`My_Struct_Name'</code>  </li>
114<li>
115<code>`OFDM'</code>  </li>
116</ul>
117<h2><a class="anchor" name="cr_classes_functionality">
118Default Functionality of Classes</a></h2>
119All classes that are configured by input parameters should include:<p>
120<ul>
121<li>
122default empty constructor  </li>
123<li>
124one or more additional constructor(s) that takes input parameters and initializes the class instance  </li>
125<li>
126setup function, preferably named <code>`setup'</code> or <code>`set_parameters'</code>  </li>
127</ul>
128<p>
129Explicit 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>
130<hr size="1"><address style="text-align: right;"><small>Generated on Thu Apr 23 21:06:43 2009 for mixpp by&nbsp;
131<a href="http://www.doxygen.org/index.html">
132<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
133</body>
134</html>
Note: See TracBrowser for help on using the browser.