This repository was archived by the owner on Feb 26, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 158
Review anonymous file mode enum. #902
Copy link
Copy link
Open
Labels
v3Anything that needs to be resolved before `v3`.Anything that needs to be resolved before `v3`.
Description
HighFive/include/highfive/H5File.hpp
Lines 28 to 45 in 7638232
| enum : unsigned { | |
| /// Open flag: Read only access | |
| ReadOnly = 0x00u, | |
| /// Open flag: Read Write access | |
| ReadWrite = 0x01u, | |
| /// Open flag: Truncate a file if already existing | |
| Truncate = 0x02u, | |
| /// Open flag: Open will fail if file already exist | |
| Excl = 0x04u, | |
| /// Open flag: Open in debug mode | |
| Debug = 0x08u, | |
| /// Open flag: Create non existing file | |
| Create = 0x10u, | |
| /// Derived open flag: common write mode (=ReadWrite|Create|Truncate) | |
| Overwrite = Truncate, | |
| /// Derived open flag: Opens RW or exclusively creates | |
| OpenOrCreate = ReadWrite | Create | |
| }; |
and then here:
HighFive/include/highfive/H5File.hpp
Lines 54 to 56 in 7638232
| explicit File(const std::string& filename, | |
| unsigned openFlags = ReadOnly, | |
| const FileAccessProps& fileAccessProps = FileAccessProps::Default()); |
isn't particularly type safe. One option is:
class File {
enum class FileMode {
ReadOnly,
};
static constexpr ReadOnly = FileMode::ReadOnly;
};
and a lot of boiler plate to allow it to work properly as a bitset. Or use:
using FileMode = std::bitset<?>;
class File {
static constexpr FileMode ReadOnly = {...};
};
Metadata
Metadata
Assignees
Labels
v3Anything that needs to be resolved before `v3`.Anything that needs to be resolved before `v3`.