Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve binary read/write for code readability #137

Closed
ggutierrez-sunbright opened this issue Dec 6, 2024 · 0 comments · Fixed by #142
Closed

Improve binary read/write for code readability #137

ggutierrez-sunbright opened this issue Dec 6, 2024 · 0 comments · Fixed by #142
Assignees
Labels
quality upgrade a design modification, refactor, or component replacement

Comments

@ggutierrez-sunbright
Copy link
Contributor

There's a good opportunity to make the code more readable when it comes to serialization/deserialization of many classes (like grids, file source/sinks, coords, etc).

currently, the code looks like this:
Rbt::WriteWithThrow(ostr, (const char*)&m_NX, sizeof(m_NX));

improvements:

  1. we should replace this (const char*) casting with a reinterpret_cast
  2. encapsulate all this within a templated function
  3. explicitly set the flags for ostream right after instantiation to automatically raise an exception in case an operation fails(ostr.exceptions(...))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
quality upgrade a design modification, refactor, or component replacement
Projects
Development

Successfully merging a pull request may close this issue.

1 participant