|
1. <strong>License header:</strong> All files start with the ADIOS2 Apache license header, file name, creation date, and author's name. Contact information is encouraged.
|
|
1. **License header:** All files start with the ADIOS2 Apache license header, file name, creation date, and author's name. Contact information is encouraged.
|
|
```cpp
|
|
```cpp
|
|
/*
|
|
/*
|
|
* Distributed under the OSI-approved Apache License, Version 2.0. See
|
|
* Distributed under the OSI-approved Apache License, Version 2.0. See
|
... | @@ -11,53 +11,63 @@ |
... | @@ -11,53 +11,63 @@ |
|
*/
|
|
*/
|
|
```
|
|
```
|
|
|
|
|
|
2. <strong>Header files include guards:</strong> all header files must have include guards to prevent name conflict. These are place right after the license and at the end of the file. The adopted format includes the relative path in ADIOS. For example, file _adios2/engine/bp/BPFileWriter.h_ will contain the following include guards:
|
|
1. **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:
|
|
```cpp
|
|
```cpp
|
|
#ifndef ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
#ifndef ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
#define ADIOS2_ENGINE_BP_BPFILEWRITER_H_<br><br>
|
|
#define ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
//File contents...
|
|
//File contents...
|
|
...
|
|
...
|
|
|
|
|
|
//End of file
|
|
//End of file
|
|
#endif // end of ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
#endif // ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
```
|
|
```
|
|
|
|
|
|
3. <strong>Document included headers</strong>: list header components used in the code if header is not self-explanatory. Example:
|
|
1. **Document included headers**: List header components used in the code if header is not self-explanatory. Example:
|
|
```cpp
|
|
```cpp
|
|
//vector and map are self-explanatory, no comment needed
|
|
//vector and map are self-explanatory, no comment needed
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
#include <stdexcept> //std::invalid_argument
|
|
#include <utility> //std::pair
|
|
#include <utility> //std::pair
|
|
#include <stdexcept>; //std::invalid_argument
|
|
#include <vector>
|
|
#include <map>;
|
|
|
|
```
|
|
```
|
|
|
|
|
|
4. <strong>Header includes organization</strong>: use the following ordering for the included headers:
|
|
1. **Header includes organization**: Seperate included headers into the following groups:
|
|
Example for file ClassName.cpp:
|
|
Example for file ClassName.cpp:
|
|
|
|
|
|
1. Corresponding header: ```ClassName.h```
|
|
* Corresponding header: ``ClassName.h``
|
|
2. POSIX/C headers: ```sys/ipc.h, unistd.h```
|
|
* System C headers: ``sys/ipc.h, unistd.h, windows.h``
|
|
3. C++ headers: ```map, thread, vector```
|
|
* C++ Wrapped ISO C headers: ``cmath, cstring``
|
|
4. External libraries: ```zfp.h, bzip2.h```
|
|
* C++ headers: ``map, thread, vector``
|
|
5. ADIOS2 headers: ```adios2/ADIOSTypes.h, adios2/ADIOSMPI.h```
|
|
* 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.
|
|
|
|
|
|
```cpp
|
|
```cpp
|
|
#include "ClassName.h"
|
|
#include "ClassName.h"
|
|
|
|
|
|
#include <unistd.h> //key_t
|
|
#ifdef WIN32
|
|
|
|
#include <windows.h> // CreateProcess, CreateNamedPipe
|
|
|
|
#else
|
|
#include <sys/ipc.h> //ftok
|
|
#include <sys/ipc.h> //ftok
|
|
|
|
#include <unistd.h> //key_t
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <cmath> // sqrt
|
|
|
|
#include <cstring> // memcpy, memset
|
|
|
|
|
|
#include <map>
|
|
#include <map>
|
|
#include <thread>
|
|
#include <thread>
|
|
#include <vector>
|
|
#include <vector>
|
|
|
|
|
|
#ifdef ADIOS_USE_ZFP
|
|
#ifdef ADIOS2_HAVE_ZFP
|
|
#include <zfp.h>
|
|
#include <zfp.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#ifdef ADIOS_USE_BZip2
|
|
#ifdef ADIOS2_HAVE_BZIP2
|
|
#include <bzip2.h>
|
|
#include <bzip2.h>
|
|
#endif
|
|
#endif
|
|
|
|
|
|
#include "adios2/ADIOSTypes.h"
|
|
|
|
#include "adios2/ADIOSMPI.h"
|
|
#include "adios2/ADIOSMPI.h"
|
|
|
|
#include "adios2/ADIOSTypes.h"
|
|
``` |
|
``` |
|
|
|
\ No newline at end of file |