COIN-OR::LEMON - Graph Library

Coding Style

General rules

  • Code lines should not be longer than 80 characters.
  • The formatting in general should be something similar to that Emacs C++-mode does by default. I.e.
    • use two spaces for indenting.

Naming Conventions

In order to make development easier we have made some conventions according to coding style. These include names of types, classes, functions, variables, constants and exceptions. If these conventions are met in one's code then it is easier to read and maintain it. Please comply with these conventions if you want to contribute developing LEMON library.

Note: When the coding style requires the capitalization of an abbreviation, only the first letter should be upper case.

XmlReader

Warning: In some cases we diverge from these rules. This is primary done because STL uses different naming convention and in certain cases it is beneficial to provide STL compatible interface.

File names

The header file names should look like the following.

header_file.h

Note that all standard LEMON headers are located in the lemon subdirectory, so you should include them from C++ source like this:

#include <lemon/header_file.h>

The source code files use the same style and they have '.cc' extension.

source_code.cc

Classes and other types

The name of a class or any type should look like the following.

AllWordsCapitalizedWithoutUnderscores 

Methods and other functions

The name of a function should look like the following.

firstWordLowerCaseRestCapitalizedWithoutUnderscores 

Constants and macros

The names of constants and macros should look like the following.

ALL_UPPER_CASE_WITH_UNDERSCORES 

Class and instance member variables, auto variables

The names of class and instance member variables and auto variables (=variables used locally in methods) should look like the following.

all_lower_case_with_underscores 

Private member variables

Private member variables should start with underscore.

_start_with_underscores

Exceptions

When writing exceptions please comply the following naming conventions.

ClassNameEndsWithException

or

ClassNameEndsWithError

Template header file

Each LEMON header file should look like this:

Note, that the script scripts/unify-sources.sh will automatically put this header into your code (or will update it in case of subsequent calls).

/* -*- mode: C++; indent-tabs-mode: nil; -*-
 *
 * This file is a part of LEMON, a generic C++ optimization library.
 *
 * Copyright (C) 2003-2009
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
 *
 * Permission to use, modify and distribute this software is granted
 * provided that this copyright notice appears in all copies. For
 * precise terms see the accompanying LICENSE file.
 *
 * This software is provided "AS IS" with no warranty of any kind,
 * express or implied, and with no claim as to its suitability for any
 * purpose.
 *
 */

#ifndef LEMON_TEMPLATE_H
#define LEMON_TEMPLATE_H

#endif // LEMON_TEMPLATE_H
Last modified 16 years ago Last modified on 03/09/09 17:05:09