XuvTools is developed in a cooperative effort from:
  • Chair of Pattern Recognition and Image Processing [www]
  • Friedrich Miescher Institute for Biomedical Research [www]
  • Center for Biological Systems Analysis [www]
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

devel:coding_guidelines [2009/05/31 22:52] (current)
mario created small example
Line 1: Line 1:
 +====== XuvTools Coding Style Guidelines / Recommendations ======
 +
 +Here is some example C++ code that should help you getting started. Coding style is not strict, but please try to stick to these guidelines in order to avoid obliteration.
 +
 +<code cpp>
 +  // Return type, class quantifier and function name all go on separate lines.
 +  // Function arguments are CamelCase, but start with a small letter '​a'​.
 +  bool
 +  MyClass::
 +  ParseTimePointAndChannel(size_t&​ aTimePoint, size_t& aChannel)
 +  {
 +    // Indent with two spaces. No tabs, and no more than two spaces.
 +    aTimePoint = 0;
 +    aChannel = 0;
 +    return false;
 +  }
 +
 +  void
 +  MyClass::
 +  ProcessData()
 +  {
 +    // Don't make spaces before or after opening round brackets.
 +    for(size_t vIndex = 0; vIndex < varNames.size();​ ++vIndex)
 +    {
 +      // Local variables are CamelCase, but start with a small letter '​v'​.
 +      size_t vTimePoint;
 +      size_t vChannel;
 +      // Always add curly braces on loops and conditions. The
 +      // curly brackets can go on the same or on the next line.
 +      if(ParseTimePointAndChannel(vTimePoint,​ vChannel)) {
 +        std::cout << "​MyClass::​ProcessData():​ Could parse"
 +            << " timepoint and channel"​ << std::endl;
 +      } else {
 +        // Try quantizing the namespace on the function, rather
 +        // than using 'using namespace xxx'.
 +        std::cerr << "​MyClass::​ProcessData():​ Error parsing"​
 +            << " timepoint and channel"​ << std::endl;
 +      }
 +    }
 +  }
 +</​code>​
  
devel/coding_guidelines.txt ยท Last modified: 2009/05/31 22:52 by mario
Contact: admin(a)xuvtools.org