1 | /*! |
---|
2 | \page codingrules Coding Rules (Mostly inherited from IT++) |
---|
3 | |
---|
4 | In the following sections we describe the naming conventions which are |
---|
5 | used for files, classes, structures, local variables, and global variables. |
---|
6 | |
---|
7 | |
---|
8 | \section cr_variables Default Naming Rules for Variables |
---|
9 | |
---|
10 | Variables are named using lower-case letters and words are separated |
---|
11 | using under-score. Abbreviations, when used in variable names, are also |
---|
12 | written 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 | |
---|
20 | Some variable names or parts of variable names are commonly used in |
---|
21 | several different functions and files to denote the same thing. For |
---|
22 | instance 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 | |
---|
33 | Files are named using lower-case letters and words are separated using |
---|
34 | under-score. Abbreviations, when used in file names, are also written |
---|
35 | with lower-case letters. |
---|
36 | |
---|
37 | Source files are named using <tt>`.cpp'</tt> suffix, whereas header |
---|
38 | files 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 | |
---|
48 | Function names are named using lower-case letters and words are |
---|
49 | separated using under-score. Abbreviations, when used in function |
---|
50 | names, are also written with lower-case letters. This rule applies |
---|
51 | both to stand-alone functions as well as to member functions of |
---|
52 | classes. 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 | |
---|
61 | For efficiency, some functions may return pointers to internal variables. |
---|
62 | Such functionality is indicated by underscore as the first letter in the |
---|
63 | the 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 | |
---|
72 | Each new word in a class or structure name should always start with a |
---|
73 | capital letter and the words should be separated with an |
---|
74 | under-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 | |
---|
85 | All 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 |
---|
90 | and initializes the class instance </li> |
---|
91 | <li> setup function, preferably named \c `setup' or \c |
---|
92 | `set_parameters' </li> |
---|
93 | </ul> |
---|
94 | |
---|
95 | Explicit destructor functions are not required, unless they are |
---|
96 | needed. It shall not be possible to use any of the other member |
---|
97 | functions unless the class has been properly initiated with the input |
---|
98 | parameters. |
---|
99 | |
---|
100 | */ |
---|