Merged features/inband -r4812:5218 into trunk. This group of changes
[debian/gnuradio] / mblock / src / lib / mb_protocol_class.cc
index f3eeb6035bf992bd004919001c464e3b46799518..a11017fa98d221e6b949c2920db4f48d030f43f1 100644 (file)
@@ -24,6 +24,7 @@
 #endif
 
 #include <mb_protocol_class.h>
+#include <iostream>
 
 static pmt_t s_ALL_PROTOCOL_CLASSES = PMT_NIL;
 
@@ -80,3 +81,25 @@ mb_protocol_class_lookup(pmt_t name)
 
   return PMT_NIL;
 }
+
+mb_protocol_class_init::mb_protocol_class_init(const char *data, size_t len)
+{
+  std::stringbuf sb;
+  sb.str(std::string(data, len));
+
+  while (1){
+    pmt_t obj = pmt_deserialize(sb);
+
+    if (0){
+      pmt_write(obj, std::cout);
+      std::cout << std::endl;
+    }
+
+    if (pmt_is_eof_object(obj))
+      return;
+
+    mb_make_protocol_class(pmt_nth(0, obj),   // protocol-class name
+                          pmt_nth(1, obj),   // list of incoming msg names
+                          pmt_nth(2, obj));  // list of outgoing msg names
+  }
+}