Write TPR body as opaque XDR data in big-endian format
[alexxy/gromacs.git] / src / gromacs / utility / inmemoryserializer.h
index 8b6ac98a70f1ba35430753dc3f2fe3ada0cf4afa..b9370404a5ea1d5af6c7aa9252cff54089bfb8aa 100644 (file)
@@ -43,6 +43,8 @@
 #ifndef GMX_UTILITY_INMEMORYSERIALIZER_H
 #define GMX_UTILITY_INMEMORYSERIALIZER_H
 
+#include <cstddef>
+
 #include <vector>
 
 #include "gromacs/utility/arrayref.h"
 namespace gmx
 {
 
-//! Specify endian swapping behvaior
+//! Specify endian swapping behavoir.
+//
+// The host-dependent choices avoid the calling file having to
+// depend on config.h.
+//
 enum class EndianSwapBehavior : int
 {
-    DoSwap,    //!< Swap the bytes
-    DoNotSwap, //!< Do not swap the bytes
-    Count      //!< Number of possible behaviors
+    DoNotSwap,                //!< Don't touch anything
+    Swap,                     //!< User-enforced swapping
+    SwapIfHostIsBigEndian,    //!< Only swap if machine we execute on is big-endian
+    SwapIfHostIsLittleEndian, //!< Only swap if machine we execute on is little-endian
+    Count                     //!< Number of possible behaviors
 };
 
 class InMemorySerializer : public ISerializer
@@ -83,6 +91,7 @@ public:
     void doIvec(ivec* value) override;
     void doRvec(rvec* value) override;
     void doString(std::string* value) override;
+    void doOpaque(char* data, std::size_t size) override;
 
 private:
     class Impl;
@@ -116,6 +125,7 @@ public:
     void doIvec(ivec* value) override;
     void doRvec(rvec* value) override;
     void doString(std::string* value) override;
+    void doOpaque(char* data, std::size_t size) override;
 
 private:
     class Impl;