summaryrefslogtreecommitdiff
path: root/netfs/xfers.h
diff options
context:
space:
mode:
Diffstat (limited to 'netfs/xfers.h')
-rw-r--r--netfs/xfers.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/netfs/xfers.h b/netfs/xfers.h
new file mode 100644
index 0000000..c1369eb
--- /dev/null
+++ b/netfs/xfers.h
@@ -0,0 +1,53 @@
+#ifndef XFERS_H
+#define XFERS_H
+
+#define Xfer1(Ptype, Pbase, v1) \
+void \
+Ptype::Send(FILE*f) const \
+{ \
+ Pbase::Send(f); \
+ *f << v1; \
+} \
+void \
+Ptype::Read(FILE*f) \
+{ \
+ Pbase::Read(f); \
+ *f >> v1; \
+}
+
+#define Xfer2(Ptype, Pbase, v1, v2) \
+void \
+Ptype::Send(FILE*f) const \
+{ \
+ Pbase::Send(f); \
+ *f << v1; \
+ *f << v2; \
+} \
+void \
+Ptype::Read(FILE*f) \
+{ \
+ Pbase::Read(f); \
+ *f >> v1; \
+ *f >> v2; \
+}
+
+#define Xfer3(Ptype, Pbase, v1, v2, v3) \
+void \
+Ptype::Send(FILE*f) const \
+{ \
+ Pbase::Send(f); \
+ *f << v1; \
+ *f << v2; \
+ *f << v3; \
+} \
+void \
+Ptype::Read(FILE*f) \
+{ \
+ Pbase::Read(f); \
+ *f >> v1; \
+ *f >> v2; \
+ *f >> v3; \
+}
+
+#endif
+