Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • A ADIOS2
  • Project information
    • Project information
    • Activity
    • Labels
    • Planning hierarchy
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 97
    • Issues 97
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 9
    • Merge requests 9
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Podhorszki, Norbert
  • ADIOS2
  • Wiki
  • File Header Structure and Includes

Last edited by Chuck Atkins May 05, 2017
Page history

File Header Structure and Includes

  1. License header: All files start with the ADIOS2 Apache license header, file name, creation date, and author's name. Contact information is encouraged.

    /*
     * Distributed under the OSI-approved Apache License, Version 2.0.  See
     * accompanying file Copyright.txt for details.
     *
     * MyClass.h
     *
     *  Created on: April 27, 2017
     *      Author: Mark Alexander Godoy  godoyma@email.com
     */
  2. Header files include guards: All header files must have include guards to prevent name conflict. These are placed right after the license and at the end of the file. The adopted format includes the relative path in ADIOS. For example, the file adios2/engine/bp/BPFileWriter.h will contain the following include guards:

    #ifndef  ADIOS2_ENGINE_BP_BPFILEWRITER_H_
    #define  ADIOS2_ENGINE_BP_BPFILEWRITER_H_
    //File contents...
    ...
    
    //End of file
    #endif  // ADIOS2_ENGINE_BP_BPFILEWRITER_H_
  3. Document included headers: List header components used in the code if header is not self-explanatory. Example:

    //vector and map are self-explanatory, no comment needed
    #include <map>
    #include <stdexcept>  //std::invalid_argument
    #include <utility>    //std::pair
    #include <vector>
  4. Header includes organization: Seperate included headers into the following groups: Example for file ClassName.cpp:

    • Corresponding header: ClassName.h
    • System C headers: sys/ipc.h, unistd.h, windows.h
    • C++ Wrapped ISO C headers: cmath, cstring
    • C++ headers: map, thread, vector
    • External libraries: zfp.h, bzip2.h
    • ADIOS2 headers: adios2/ADIOSMPI.h, adios2/ADIOSTypes.h

    Each group should be seperated by a newline and the headers alphabetically sorted within that group. Use #include "foo.h" for headers part of ADIOS2 and #include <foo.h> for all others.

    #include "ClassName.h"
    
    #ifdef WIN32
    #include <windows.h> // CreateProcess, CreateNamedPipe
    #else
    #include <sys/ipc.h> //ftok
    #include <unistd.h>  //key_t
    #endif
    
    #include <cmath>   // sqrt
    #include <cstring> // memcpy, memset
    
    #include <map>
    #include <thread>
    #include <vector>
    
    #ifdef ADIOS2_HAVE_ZFP
    #include <zfp.h>
    #endif
    
    #ifdef ADIOS2_HAVE_BZIP2
    #include <bzip2.h>
    #endif
    
    #include "adios2/ADIOSMPI.h"
    #include "adios2/ADIOSTypes.h"
Clone repository
  • ADIOS2 Coding Guidelines
  • ADIOS2 Contributing on GitHub
  • Building and installing with CMake
  • C Interoperability and Type Casting
  • Clang Format Text Style
  • Classes and Structs
  • Exceptions for Error Reporting
  • File Header Structure and Includes
  • Generating Doxygen API documentation
  • Hello ADIOS2 Write Read Example
  • Home
  • Proposed ADIOS2 architecture based on standard OSI 7 layer model
  • RAII Memory Management
  • Setting your Local Repository
  • Submitting Changes
View All Pages