root/doc/local/codingrules.dox @ 121

Revision 33, 2.9 kB (checked in by smidl, 16 years ago)

Oprava PF a MPF + jejich implementace pro pmsm system

Line 
1/*!
2\page codingrules Coding Rules (Mostly inherited from IT++)
3
4In the following sections we describe the naming conventions which are
5used for files, classes, structures, local variables, and global variables.
6
7
8\section cr_variables Default Naming Rules for Variables
9
10Variables are named using lower-case letters and words are separated
11using under-score. Abbreviations, when used in variable names, are also
12written with lower-case letters. Examples:
13
14<ul>
15<li> \c `fft_size' </li>
16<li> \c `nrof_paths' </li>
17<li> \c `my_variable_name' </li>
18</ul>
19
20Some variable names or parts of variable names are commonly used in
21several different functions and files to denote the same thing. For
22instance the following common names and prefixes should be used:
23
24<ul>
25<li> \c `rows' - number of rows in a matrix </li>
26<li> \c `cols' - number of columns in a matrix </li>
27<li> \c `nrof_' - number of ... </li>
28</ul>
29
30
31\section cr_files Default Naming Rules for Files
32
33Files are named using lower-case letters and words are separated using
34under-score. Abbreviations, when used in file names, are also written
35with lower-case letters.
36
37Source files are named using <tt>`.cpp'</tt> suffix, whereas header
38files end with <tt>`.h'</tt> extension. Examples:
39
40<ul>
41<li> <tt>`my_file.h'</tt> </li>
42<li> <tt>`my_file.cpp'</tt> </li>
43</ul>
44
45
46\section cr_functions Default Naming Rules for Functions
47
48Function names are named using lower-case letters and words are
49separated using under-score. Abbreviations, when used in function
50names, are also written with lower-case letters. This rule applies
51both to stand-alone functions as well as to member functions of
52classes. Example:
53
54<ul>
55<li> <tt>int my_function_name(int a, int b)</tt> </li>
56</ul>
57
58
59\section cr_specialfunctions Convention for sensitive functions
60
61For efficiency, some functions may return pointers to internal variables.
62Such functionality is indicated by underscore as the first letter in the
63the name.
64
65<ul>
66<li> <tt>mat* _internal_matrix()</tt> </li>
67</ul>
68
69
70\section cr_classes Default Naming Rules for Classes and Structures
71
72Each new word in a class or structure name should always start with a
73capital letter and the words should be separated with an
74under-score. Abbreviations are written with capital letters. Examples:
75
76<ul>
77<li> \c `My_Class_Name' </li>
78<li> \c `My_Struct_Name' </li>
79<li> \c `OFDM' </li>
80</ul>
81
82
83\section cr_classes_functionality Default Functionality of Classes
84
85All classes that are configured by input parameters should include:
86
87<ul>
88<li> default empty constructor </li>
89<li> one or more additional constructor(s) that takes input parameters
90and initializes the class instance </li>
91<li> setup function, preferably named \c `setup' or \c
92`set_parameters' </li>
93</ul>
94
95Explicit destructor functions are not required, unless they are
96needed. It shall not be possible to use any of the other member
97functions unless the class has been properly initiated with the input
98parameters.
99
100*/
Note: See TracBrowser for help on using the browser.