Basic Image AlgorithmS Library  2.8.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Conventions

Conventions

The programming conventions that all BIAS-programmers should follow are:

Names for Files, Classes, Functions, Variables

Function calls: Parameters and Returns

Code Formatting

Example for MS Visual Studio settings:

Example for XEmacs settings:

Example for proper code formatting: In Declaration (in header):

#include <iostream>
/** @brief formatting example class description
@author Your Name */
class Foo
{
/// @brief short function description
void Bar();
};

Definition (in .cpp file):

void Foo::Bar()
{
std::cout<<"hello";
}

Portability between Linux and Windows

We support MS Windows with Visual Studio (.Net 2003/7.1 and 2005/8.0) compiler and Linux with gcc (3.3.4, 4.1.2 ) compiler actually (as of 2007/09/09).

Static and shared libraries (.so/.dll)

Further programming rules

Const

API - check build configuration in header

The BIAS API varies with the number of available (third party) libraries (and possibly which subdirectories were compiled). To avoid compilation and linking problems and given the user an early hint for a problem you must ifdef code that relies on special features. bias_config.h exists for this purpose. The procedure to catch these problems should be like this:

#include <bias_config>
#ifdndef BIAS_HAVE_<MYSPECIALLIB>
# error BIAS was build without MYSPECIALLIB, please enable USE_MYSPECIALLIB and recompile BIAS.
#endif
...
// or to ifdef only certain functions:
/** minimal docu: @author You */
class MyClass {
public:
#ifdef BIAS_HAVE_<MYSPECIALLIB>
void Function_that_uses_myspeciallib();
#endif
...
void Otherfunction();

Documentation

/** @class TestDoxy
    @test MyTestFile.cpp
    @ingroup the group name, see module_hierarchy.dox for details (such as g_videosource...)
    @brief example to show Doxygen-syntax. A detailed description for every class is necessary!
    @author Your Name
    @date dd/mm/yyyy    
**/
/** @brief example to show Doxygen-syntax
    @param par1 (input)
    @param par2 (output)
    @returns -1=error, 0=OK
    @author Your Name
    @date dd/mm/yyyy
**/

If you write a test - what you should do - include it in the Test subdirectory and add documentation of the style:

/**
   @file MyTestFile.cpp
   @brief Test my class XXX
   @relates MyClass
   @ingroup g_tests
   @author Your Name
   @date dd/mm/yyyy
*/

Examples should be located in the subdirectory Examples and with documentation: The relates tag connects the example with the class, in the documentation a link is added to the class for the example.

/**
   @example ExampleMyClass.cpp
   @class ExampleMyClass 
   @relates MyClass
   @brief Example for usage of class XX
   @ingroup g_examples
   @author Your Name
   @date dd/mm/yyyy
*/

E.g. Linux:

make doc

Windows:

nmake doc

or build

doc.vcproj (within BIAS.sln)

Debug (detailed)

We know that these rules were not followed in all parts of BIAS but we want to be more strict in the future, so please stick to these rules for all new commits.

Supervisors of students which program for BIAS and MIP are strongly urged to enforce a proper programming style by not accepting any work that does not conform.