]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/doc/README.CodingConvention
018597f92fea051e900501aef7b71370af6d85c7
[u/mrichter/AliRoot.git] / AliGeant4 / doc / README.CodingConvention
1 $ Id:$
2 --------------------------------------------------------------
3  Coding Standards
4  ================
5
6  additional to the ALICE C++ Coding Conventions 
7
8  1. Ordering of headers:
9     1. Ali*
10     2. G4*
11     3. other packages (CLHEP, ODBMS, ROOT, ...)
12     4. system (eg. <iostrem.h>)      
13
14  2. Use G4 basic type instead of "raw" types:
15     G4int, G4double, G4bool, G4String, ...
16        
17  3. Inline fuctions:
18     When implementation of inline methods is within two lines,
19     put it in the header file after the class
20     declaration in the header file (*.hh);
21     otherwise put it in a separated *.cc file.  
22     
23  4. Re-declare virtual member functions in a derived class
24     with a keyword virtual.
25     
26  6. Header file:
27     Place each section in the class declarations 
28     (public, protected, private) in this order:
29     // constructors 
30     // destructor 
31     // operators
32     // static methods
33     // methods
34     // set methods
35     // get methods
36     // static data members
37     // data members
38     Use comment line for all sections except for
39     constructors and destructors.
40     
41  7. Implementation file:
42     declare class definitions in this order:
43     // static data members
44     // static methods
45     // constructors
46     // destructors
47     // methods 
48     Private definitions should be declared first,
49     then protected and public.
50     
51  8. Exception/Warning:
52     Use AliGlobal::Exception()/Warning(); (or TG4Global in TGeant4)
53     use this form of text:
54     class_name::method_name: exception/warning_text    
55
56  9. Style:
57     Standard indention:  2 spaces;
58     Max. line length:   80 characters;  
59
60  Recomendations:
61       - default constructor - protected in suitable cases
62         (to prevent from creation of invalid objects)