Changes between Version 14 and Version 15 of CodingGuidelines


Ignore:
Timestamp:
Mar 29, 2012, 10:56:42 AM (13 years ago)
Author:
FrederikHeber
Comment:

split up example files in header and definition

Legend:

Unmodified
Added
Removed
Modified
  • CodingGuidelines

    v14 v15  
    1212   * identate by two spaces, never tabs
    1313   * Code Style from Eclipse, see [attachment:ESPACK_codestyle.xml]:
     14
     15=== Declaration file === #style-file-declaration
     16
     17Your declaration file should:
     18 * contain all documentation (this is what the user may see in the code, never the implementation)
     19 * contain include of config.h as very first
     20 * always be properly bracketed in __uniquely__ name preprocessor defines to avoid double inclusion.
     21
    1422{{{
    1523/*
    16  * A sample source file for the code formatter preview
    17  */
    18 #include <math.h>
    19 
     24 * Point.hpp
     25 *
     26 *  Created on: <creation date>
     27 *      Author: <author>
     28 */
     29
     30#ifndef POINT_HPP_
     31#define POINT_HPP_
     32
     33// include config.h
     34#ifdef HAVE_CONFIG_H
     35#include <config.h>
     36#endif
     37
     38/** Point is an implementation of a point in 2D space.
     39 *
     40 * With this we have a distance measure between two given coordinates.
     41 */
    2042class Point
    2143{
    2244public:
     45  /** Constructor for class Point.
     46    * @param xc x coordinate
     47    * @param yc y coordinate
     48    */
    2349  Point(double xc, double yc) :
    2450    x(xc), y(yc)
    25   {
    26   }
     51  {}
     52
     53  /** Returns distance to another Point \a other.
     54   *
     55   * @param other other Point
     56   * @return relative euclidian distance to \a other
     57   */
    2758  double distance(const Point& other) const;
    2859
     60  //!> internal x coordinate of this Point
    2961  double x;
     62  //!> internal y coordinate of this Point
    3063  double y;
    3164};
     65
     66#endif /* POINT_HPP_ */
     67}}}
     68
     69=== Definition file === #style-file-definition
     70
     71Your definition file should:
     72 * contain a disclaimer with copyright, the year is initially the current one and should be extended whenever the file is edited again.
     73 * include first config.h then !MemDebug.hpp, then your specific header file of this implementation, then all others
     74
     75{{{
     76/*
     77 * Project: MoleCuilder
     78 * Description: creates and alters molecular systems
     79 * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
     80 * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
     81 */
     82
     83/*
     84 * \file Point.cpp
     85 *
     86 * This file contains Point definition.
     87 *
     88 *  Created on: <creation date>
     89 *      Author: <author>
     90 */
     91
     92// include config.h
     93#ifdef HAVE_CONFIG_H
     94#include <config.h>
     95#endif
     96
     97// always have the MemDebug first
     98#include "CodePatterns/MemDebug.hpp"
     99
     100// then following by include of respective header file (without path)
     101#include "Point.hpp"
     102
     103// then other includes
     104...
     105#include <math.h>
     106...
    32107
    33108double Point::distance(const Point& other) const