|
<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.
|
|
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.
|
|
<ul><li><pre style="border: 0;"><code> /**
|
|
```cpp
|
|
|
|
/*
|
|
* Distributed under the OSI-approved Apache License, Version 2.0. See
|
|
* Distributed under the OSI-approved Apache License, Version 2.0. See
|
|
* accompanying file Copyright.txt for details.
|
|
* accompanying file Copyright.txt for details.
|
|
*
|
|
*
|
... | @@ -8,31 +9,55 @@ |
... | @@ -8,31 +9,55 @@ |
|
* Created on: April 27, 2017
|
|
* Created on: April 27, 2017
|
|
* Author: Mark Alexander Godoy godoyma@email.com
|
|
* 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>
|
|
#define ADIOS2_ENGINE_BP_BPFILEWRITER_H_<br><br>
|
|
//File contents...
|
|
//File contents...
|
|
...
|
|
...
|
|
|
|
|
|
//End of file
|
|
//End of file
|
|
#endif // end of ADIOS2_ENGINE_BP_BPFILEWRITER_H_
|
|
#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
|
|
3. <strong>Document included headers</strong>: list header components used in the code if header is not self-explanatory. Example:
|
|
#include <vector>
|
|
```cpp
|
|
#include <utility> //std::pair
|
|
//vector and map are self-explanatory, no comment needed
|
|
#include <stdexcept> //std::invalid_argument
|
|
#include <vector>
|
|
#include <map>
|
|
#include <utility> //std::pair
|
|
</code></pre></li></ul></li></ol></li>
|
|
#include <stdexcept>; //std::invalid_argument
|
|
|
|
#include <map>;
|
|
<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
|
|
4. <strong>Header includes organization</strong>: use the following ordering for the included headers:
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include <vector>
|
|
Example for file ClassName.cpp:
|
|
#include <new> // std::bad_alloc
|
|
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include <bzip2.h>
|
|
1. Corresponding header: ```ClassName.h```
|
|
#include <zfp.h>
|
|
2. POSIX/C headers: ```sys/ipc.h, unistd.h```
|
|
</code></pre></li><li><pre style="border: 0;"><code> #include "adiosFunctions.h" // IsLittleEndian
|
|
3. C++ headers: ```map, thread, vector```
|
|
</code></pre></li></ul></li>
|
|
4. External libraries: ```zfp.h, bzip2.h```
|
|
</ol> |
|
5. ADIOS2 headers: ```adios2/ADIOSTypes.h, adios2/ADIOSMPI.h```
|
|
\ No newline at end of file |
|
|
|
|
|
```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 |