24 #include "openPMD/config.hpp" 25 #include "openPMD/auxiliary/Filesystem.hpp" 26 #include "openPMD/IO/AbstractIOHandler.hpp" 27 #include "openPMD/IO/AbstractIOHandlerImpl.hpp" 28 #include "openPMD/IO/AccessType.hpp" 29 #include "openPMD/IO/JSON/JSONFilePosition.hpp" 31 #include <nlohmann/json.hpp> 36 #include <unordered_map> 37 #include <unordered_set> 59 explicit File( std::string s ) :
60 fileState { std::make_shared< FileState >( s ) }
70 name { std::move( s ) }
78 std::shared_ptr< FileState > fileState;
83 fileState->valid =
false;
89 return fileState->valid;
93 File & operator=( std::string s )
101 fileState = std::make_shared< FileState >( s );
111 return this->fileState == f.fileState;
115 std::string & operator*( )
const 117 return fileState->name;
121 std::string * operator->( )
const 123 return &fileState->name;
127 explicit operator bool( )
const 129 return fileState.operator bool( );
140 typedef std::size_t result_type;
143 result_type operator()( argument_type
const & s )
const noexcept
145 return std::hash< shared_ptr< openPMD::File::FileState>> {}( s.fileState );
155 using json = nlohmann::json;
212 void deleteAttribute(
252 std::future< void > flush( )
override;
257 using FILEHANDLE = std::fstream;
268 std::shared_ptr< nlohmann::json >> m_jsonVals;
271 std::unordered_set< File > m_dirty;
280 std::shared_ptr< FILEHANDLE > getFilehandle(
286 std::string fullPath( File );
288 std::string fullPath( std::string
const & );
292 static void parentDir( std::string & );
296 static std::string filepositionOf( Writable * w );
306 static void syncMultidimensionalJson(
308 Offset
const & offset,
309 Extent
const & extent,
310 Extent
const & multiplicator,
313 size_t currentdim = 0
320 static Extent getMultiplicators( Extent
const & extent );
322 static nlohmann::json initializeNDArray( Extent
const & extent );
324 static Extent getExtent( nlohmann::json & j );
328 static std::string removeSlashes( std::string );
330 template<
typename KeyT >
338 static void ensurePath(
339 nlohmann::json * json,
355 > getPossiblyExisting(
361 std::shared_ptr< nlohmann::json > obtainJsonContents( File );
364 nlohmann::json & obtainJsonContents( Writable * writable );
368 void putJsonContents(
370 bool unsetDirty =
true 376 std::shared_ptr< JSONFilePosition > setAndGetFilePosition(
384 std::shared_ptr< JSONFilePosition > setAndGetFilePosition(
392 File refreshFileFromParent( Writable * writable );
394 void associateWithFile(
400 static bool isGroup( nlohmann::json::const_iterator it );
402 static bool isDataset( nlohmann::json
const & j );
406 template<
typename Param >
408 Param
const & parameters,
412 static nlohmann::json platformSpecifics( );
416 template<
typename T >
418 nlohmann::json & json,
424 nlohmann::json & json,
432 template<
typename T >
434 nlohmann::json & json,
440 nlohmann::json & json,
445 struct AttributeWriter
447 template<
typename T >
450 Attribute::resource
const &
456 Attribute::resource
const &
461 struct AttributeReader
463 template<
typename T >
477 template<
typename T >
480 nlohmann::json operator()(
T const & );
483 template<
typename T >
484 struct CppToJSON< std::vector< T>>
486 nlohmann::json operator()( std::vector< T >
const & );
489 template<
typename T,
int n >
495 nlohmann::json operator()(
509 T operator()( nlohmann::json
const & );
512 template<
typename T >
513 struct JsonToCpp< std::vector< T > >
515 std::vector< T > operator()( nlohmann::json
const & );
518 template<
typename T,
int n >
529 > operator()( nlohmann::json
const & );
532 template<
typename T >
535 typename std::enable_if<
536 std::is_floating_point<
542 T operator()( nlohmann::json
const & );
AccessType
File access mode to use during IO.
Definition: AccessType.hpp:28
Definition: JSONIOHandlerImpl.hpp:67
Definition: IOTask.hpp:191
Definition: IOTask.hpp:287
Definition: JSONIOHandlerImpl.hpp:57
Definition: JSONIOHandlerImpl.hpp:152
Definition: IOTask.hpp:127
Definition: IOTask.hpp:143
Definition: IOTask.hpp:379
Interface for communicating between logical and physically persistent data.
Definition: AbstractIOHandler.hpp:68
Public definitions of openPMD-api.
Definition: Date.cpp:28
Layer to mirror structure of logical data and persistent data in file.
Definition: Writable.hpp:55
Definition: IOTask.hpp:332
Definition: IOTask.hpp:442
Definition: IOTask.hpp:111
Definition: IOTask.hpp:361
Definition: IOTask.hpp:266
Definition: IOTask.hpp:159
Definition: AbstractIOHandlerImpl.hpp:34
Definition: IOTask.hpp:395
Definition: IOTask.hpp:224
Definition: IOTask.hpp:414
Definition: IOTask.hpp:248
Definition: IOTask.hpp:175
Definition: IOTask.hpp:303
Definition: IOTask.hpp:207