@@ -50,14 +50,13 @@ class H5Writer
50
50
51
51
static constexpr auto dimension = GridLayout::dimension;
52
52
static constexpr auto interpOrder = GridLayout::interp_order;
53
- static constexpr auto READ_WRITE = HiFile::ReadWrite | HiFile::Create ;
53
+ static constexpr auto READ_WRITE = HiFile::AccessMode::OpenOrCreate ;
54
54
55
55
// flush_never: disables manual file closing, but still occurrs via RAII
56
56
static constexpr std::size_t flush_never = 0 ;
57
57
58
58
template <typename Hierarchy, typename Model>
59
- H5Writer (Hierarchy& hier, Model& model, std::string const hifivePath,
60
- unsigned _flags /* = HiFile::ReadWrite | HiFile::Create | HiFile::Truncate */ )
59
+ H5Writer (Hierarchy& hier, Model& model, std::string const hifivePath, HiFile::AccessMode _flags)
61
60
: flags{_flags}
62
61
, filePath_{hifivePath}
63
62
, modelView_{hier, model}
@@ -69,8 +68,8 @@ class H5Writer
69
68
template <typename Hierarchy, typename Model>
70
69
static auto make_unique (Hierarchy& hier, Model& model, initializer::PHAREDict const & dict)
71
70
{
72
- std::string filePath = dict[" filePath" ].template to <std::string>();
73
- unsigned flags = READ_WRITE;
71
+ std::string filePath = dict[" filePath" ].template to <std::string>();
72
+ HiFile::AccessMode flags = READ_WRITE;
74
73
if (dict.contains (" mode" ) and dict[" mode" ].template to <std::string>() == " overwrite" )
75
74
flags |= HiFile::Truncate;
76
75
return std::make_unique<This>(hier, model, filePath, flags);
@@ -95,7 +94,7 @@ class H5Writer
95
94
return fileStr + " .h5" ;
96
95
}
97
96
98
- auto makeFile (std::string const filename, unsigned file_flag)
97
+ auto makeFile (std::string const filename, HiFile::AccessMode const file_flag)
99
98
{
100
99
return std::make_unique<HighFiveFile>(filePath_ + " /" + filename, file_flag);
101
100
}
@@ -169,7 +168,7 @@ class H5Writer
169
168
auto & modelView () { return modelView_; }
170
169
171
170
std::size_t minLevel = 0 , maxLevel = 10 ; // TODO hard-coded to be parametrized somehow
172
- unsigned flags;
171
+ HiFile::AccessMode flags;
173
172
174
173
175
174
private:
@@ -179,7 +178,7 @@ class H5Writer
179
178
ModelView modelView_;
180
179
Attributes fileAttributes_;
181
180
182
- std::unordered_map<std::string, unsigned > file_flags;
181
+ std::unordered_map<std::string, HiFile::AccessMode > file_flags;
183
182
184
183
std::unordered_map<std::string, std::shared_ptr<H5TypeWriter<This>>> typeWriters_{
185
184
{" info" , make_writer<InfoDiagnosticWriter<This>>()},
0 commit comments