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
  • Classes and Structs

Last edited by Chuck Atkins May 05, 2017
Page history

Classes and Structs

  1. Class naming: use PascalCase, also known as UpperCamelCase, for class naming: ADIOS, Transform, Transport.

    • Don't
      class filedescriptor :  public transport
      { ...
      or
      class file_descriptor :  public transport
      { ...
    • Do
      class FileDescriptor :  public Transport
      { ...
  2. Class members naming: Continue to use PascalCase for all class members, function and data, however adding an additional m_ prefix to denote data members: m_XMLConfig, m_Shape, etc. This method enables easy autocomplete of members in many editors as it's encouraged by the clang-format.

    • Don't
      class Transport
      { 
      public: 
         std::string Name;
    • Do
      class Transport
      { 
      public: 
          std::string m_Name;
  3. Structs: reserve structs for public member variables only, structs should not have member functions, derived classes (inheritance), or private members. Structs will using the the same naming convention as Classes, without the m_ prefix on data members.

    • Don't
      struct Attribute
      { 
      public: 
          std::string  m_Name;
          std::string  m_Type;
          std::string  m_Value;
          // Use a class instead
          void SetName( const std::string name );
      };
    • Do
      struct Attribute
      { 
          std::string Name;
          std::string Type;
          std::string Value;
      };
  4. Single header (.h) and source (.cpp) file per class: Example: class Transport must have Transport.h and Transport.cpp only; do not define several classes in the same file. Define structs in single header file, ( e.g. Attribute in Attribute.h ). Exceptions:

    • Templates
    • Nested structs (only used a few times)
    • enum class
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