|
|
<ol><li><strong>License header:</strong> All files start with the ADIOS2 Apache license header, file name, creation date, and author. Contact information is encouraged.
|
|
|
<ul><li><pre style="border: 0;"><code> /**
|
|
|
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.
|
|
|
```cpp
|
|
|
/*
|
|
|
* Distributed under the OSI-approved Apache License, Version 2.0. See
|
|
|
* accompanying file Copyright.txt for details.
|
|
|
*
|
... | ... | @@ -8,31 +9,55 @@ |
|
|
* Created on: April 27, 2017
|
|
|
* Author: Mark Alexander Godoy godoyma@email.com
|
|
|
*/
|
|
|
</code></pre></li></ul></li>
|
|
|
```
|
|
|
|
|
|
<li><strong>Include guards:</strong> all headers must have include guards to prevents 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, **adios2/engine/bp/BPFileWriter.h** will contain the following include guards:<ol><li><ul><li><pre style="border: 0;"><code>#ifndef ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
|
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:
|
|
|
```cpp
|
|
|
#ifndef ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
|
#define ADIOS2_ENGINE_BP_BPFILEWRITER_H_<br><br>
|
|
|
//File contents...
|
|
|
...
|
|
|
|
|
|
//End of file
|
|
|
#endif // end of ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
|
</code></pre></li></ul></li></ol></li>
|
|
|
|
|
|
<li><strong>Documenting included headers:</strong> list header components used in the code if header is not self-explanatory<ul><li>Example:</li></ul><ol><li><ul><li><pre style="border: 0;"><code> //vector and map are self-explanatory, no comment needed
|
|
|
#include <vector>
|
|
|
#include <utility> //std::pair
|
|
|
#include <stdexcept> //std::invalid_argument
|
|
|
#include <map>
|
|
|
</code></pre></li></ul></li></ol></li>
|
|
|
|
|
|
<li><strong>Header include organization:</strong> Use the following ordering for the included headers: Example for file ClassName.cpp :<ol><li>Corresponding header: ClassName.h </li><li>System C/POSIX Headers <em>e.g.</em> unistd.h, sys/ipc.h</li><li>C++ versions of system C headers <em>e.g.</em> cstdlib, cstring</li><li>System C++ headers <em>e.g.</em> vector, map</li><li>Other library headers <em>e.g.</em> boost, zfp, bzip2, thrust</li><li>Other headers from this library <em>e.g</em> "adiosFunctions.h"</li></ol><ul><li>Example:</li></ul><ol><li><ul><li><pre style="border: 0;"><code> #include "ClassName.h"
|
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include <unistd.h> // write, close
|
|
|
#include <sys/ipc.h> // key_t
|
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include <vector>
|
|
|
#include <new> // std::bad_alloc
|
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include <bzip2.h>
|
|
|
#include <zfp.h>
|
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include "adiosFunctions.h" // IsLittleEndian
|
|
|
</code></pre></li></ul></li>
|
|
|
</ol> |
|
|
\ No newline at end of file |
|
|
```
|
|
|
|
|
|
3. <strong>Document included headers</strong>: list header components used in the code if header is not self-explanatory. Example:
|
|
|
```cpp
|
|
|
//vector and map are self-explanatory, no comment needed
|
|
|
#include <vector>
|
|
|
#include <utility> //std::pair
|
|
|
#include <stdexcept>; //std::invalid_argument
|
|
|
#include <map>;
|
|
|
```
|
|
|
|
|
|
4. <strong>Header includes organization</strong>: use the following ordering for the included headers:
|
|
|
Example for file ClassName.cpp:
|
|
|
|
|
|
1. Corresponding header: ```ClassName.h```
|
|
|
2. POSIX/C headers: ```sys/ipc.h, unistd.h```
|
|
|
3. C++ headers: ```map, thread, vector```
|
|
|
4. External libraries: ```zfp.h, bzip2.h```
|
|
|
5. ADIOS2 headers: ```adios2/ADIOSTypes.h, adios2/ADIOSMPI.h```
|
|
|
|
|
|
```cpp
|
|
|
#include "ClassName.h"
|
|
|
|
|
|
#include <unistd.h> //key_t
|
|
|
#include <sys/ipc.h> //ftok
|
|
|
|
|
|
#include <map>
|
|
|
#include <thread>
|
|
|
#include <vector>
|
|
|
|
|
|
#ifdef ADIOS_USE_ZFP
|
|
|
#include <zfp.h>
|
|
|
#endif
|
|
|
|
|
|
#ifdef ADIOS_USE_BZip2
|
|
|
#include <bzip2.h>
|
|
|
#endif
|
|
|
|
|
|
#include "adios2/ADIOSTypes.h"
|
|
|
#include "adios2/ADIOSMPI.h"
|
|
|
``` |
|
|
\ No newline at end of file |