openPMD-api
Writable.hpp
1 /* Copyright 2017-2020 Fabian Koller
2  *
3  * This file is part of openPMD-api.
4  *
5  * openPMD-api is free software: you can redistribute it and/or modify
6  * it under the terms of of either the GNU General Public License or
7  * the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * openPMD-api is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License and the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * and the GNU Lesser General Public License along with openPMD-api.
19  * If not, see <http://www.gnu.org/licenses/>.
20  */
21 #pragma once
22 
23 #include <string>
24 #include <memory>
25 
26 // expose private and protected members for invasive testing
27 #ifndef OPENPMD_private
28 # define OPENPMD_private private
29 #endif
30 
31 
32 namespace openPMD
33 {
34 namespace test
35 {
36 struct TestHelper;
37 } // namespace test
38 class AbstractFilePosition;
39 class AbstractIOHandler;
40 class Attributable;
41 struct ADIOS2FilePosition;
42 template <typename FilePositionType>
44 
45 
55 class Writable final
56 {
57  friend class Attributable;
58  template< typename T_elem >
59  friend class BaseRecord;
60  template<
61  typename T,
62  typename T_key,
63  typename T_container
64  >
65  friend class Container;
66  friend class Iteration;
67  friend class Mesh;
68  friend class ParticleSpecies;
69  friend class Series;
70  friend class Record;
71  friend class ADIOS1IOHandlerImpl;
72  friend class ParallelADIOS1IOHandlerImpl;
73  friend class ADIOS2IOHandlerImpl;
74  friend class HDF5IOHandlerImpl;
75  friend class ParallelHDF5IOHandlerImpl;
76  friend class AbstractIOHandlerImplCommon<ADIOS2FilePosition>;
77  friend class JSONIOHandlerImpl;
78  friend struct test::TestHelper;
79  friend std::string concrete_h5_file_position(Writable*);
80  friend std::string concrete_bp1_file_position(Writable*);
81 
82 public:
83  Writable(Attributable* = nullptr);
84  ~Writable() = default;
85 
86 OPENPMD_private:
87  std::shared_ptr< AbstractFilePosition > abstractFilePosition;
88  std::shared_ptr< AbstractIOHandler > IOHandler;
89  Attributable* attributable;
90  Writable* parent;
91  bool dirty;
92  bool written;
93 };
94 } // namespace openPMD
Logical compilation of data from one snapshot (e.g.
Definition: Iteration.hpp:38
Definition: ADIOS2IOHandler.hpp:78
Definition: JSONIOHandlerImpl.hpp:163
Root level of the openPMD hierarchy.
Definition: Series.hpp:64
Definition: ParallelHDF5IOHandlerImpl.hpp:37
Public definitions of openPMD-api.
Definition: Date.cpp:29
Layer to mirror structure of logical data and persistent data in file.
Definition: Writable.hpp:55
Definition: Record.hpp:33
Definition: ADIOS1IOHandlerImpl.hpp:44
Definition: BaseRecord.hpp:36
Definition: Writable.hpp:43
Definition: ParticleSpecies.hpp:34
Container for N-dimensional, homogeneous Records.
Definition: Mesh.hpp:39
Map-like container that enforces openPMD requirements and handles IO.
Definition: Container.hpp:70
Definition: HDF5IOHandlerImpl.hpp:38
Definition: ParallelADIOS1IOHandlerImpl.hpp:45
Layer to manage storage of attributes associated with file objects.
Definition: Attributable.hpp:65