Add support for serialization
authorSteve Raasch <sraasch@umich.edu>
Thu, 30 Oct 2003 20:15:27 +0000 (15:15 -0500)
committerSteve Raasch <sraasch@umich.edu>
Thu, 30 Oct 2003 20:15:27 +0000 (15:15 -0500)
--HG--
extra : convert_revision : ff6c93ee2f4e6aeb5a824958c52f62d6c2a1cdfd

base/pollevent.cc
base/pollevent.hh

index 45a32581f4dd34bf65326d195015483744133bdf..619bda887f47be1ba088b3f922c83ae41cf38753 100644 (file)
@@ -38,6 +38,9 @@
 #include "base/misc.hh"
 #include "base/pollevent.hh"
 #include "sim/universe.hh"
+#include "sim/serialize.hh"
+
+using namespace std;
 
 PollQueue pollQueue;
 
@@ -76,6 +79,22 @@ PollEvent::enable()
         queue->copy();
 }
 
+void
+PollEvent::serialize(ostream &os)
+{
+    SERIALIZE_SCALAR(pfd.fd);
+    SERIALIZE_SCALAR(pfd.events);
+    SERIALIZE_SCALAR(enabled);
+}
+
+void
+PollEvent::unserialize(Checkpoint *cp, const std::string &section)
+{
+    UNSERIALIZE_SCALAR(pfd.fd);
+    UNSERIALIZE_SCALAR(pfd.events);
+    UNSERIALIZE_SCALAR(enabled);
+}
+
 /////////////////////////////////////////////////////
 //
 PollQueue::PollQueue()
index 393c53996ec3d9d9df2212338521c33439063d94..7ea5b83f4b84b7e25aeb56fcd8ed294b6de7ac53 100644 (file)
@@ -33,6 +33,8 @@
 #include <poll.h>
 #include "sim/universe.hh"
 
+class Checkpoint;
+
 class PollEvent
 {
   private:
@@ -52,6 +54,9 @@ class PollEvent
     virtual void process(int revent) = 0;
 
     bool queued() { return queue != 0; }
+
+    virtual void serialize(std::ostream &os);
+    virtual void unserialize(Checkpoint *cp, const std::string &section);
 };
 
 class PollQueue