diff options
author | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-07-26 20:01:02 +0000 |
---|---|---|
committer | jcorgan <jcorgan@221aa14e-8319-0410-a670-987f0aec2ac5> | 2009-07-26 20:01:02 +0000 |
commit | 2bf2a8f2d2a4477818bfa91cae64fb663fdf88c3 (patch) | |
tree | d646b7851ed0ea3015c3480609d03d5589ebd60d /mblock/src/lib/mb_protocol_class.cc | |
parent | 970d850297cf945943528557127db2cd327c3f3c (diff) |
Merged r11491:11494 from jcorgan/pmt into trunk.
Moves pmt types functions into pmt:: from gruel::
Trunk passes distcheck.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11495 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'mblock/src/lib/mb_protocol_class.cc')
-rw-r--r-- | mblock/src/lib/mb_protocol_class.cc | 78 |
1 files changed, 40 insertions, 38 deletions
diff --git a/mblock/src/lib/mb_protocol_class.cc b/mblock/src/lib/mb_protocol_class.cc index 6492c15516..1c696fb7c0 100644 --- a/mblock/src/lib/mb_protocol_class.cc +++ b/mblock/src/lib/mb_protocol_class.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2008 Free Software Foundation, Inc. + * Copyright 2006,2008,2009 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -26,60 +26,62 @@ #include <mblock/protocol_class.h> #include <iostream> -static gruel::pmt_t s_ALL_PROTOCOL_CLASSES = gruel::PMT_NIL; +using namespace pmt; -gruel::pmt_t -mb_make_protocol_class(gruel::pmt_t name, gruel::pmt_t incoming, gruel::pmt_t outgoing) +static pmt_t s_ALL_PROTOCOL_CLASSES = PMT_NIL; + +pmt_t +mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing) { // (protocol-class <name> <incoming> <outgoing>) - if (!gruel::pmt_is_symbol(name)) - throw gruel::pmt_wrong_type("mb_make_protocol_class: NAME must be symbol", name); - if (!(gruel::pmt_is_pair(incoming) || gruel::pmt_is_null(incoming))) - throw gruel::pmt_wrong_type("mb_make_protocol_class: INCOMING must be a list", name); - if (!(gruel::pmt_is_pair(outgoing) || gruel::pmt_is_null(outgoing))) - throw gruel::pmt_wrong_type("mb_make_protocol_class: OUTGOING must be a list", name); + if (!pmt_is_symbol(name)) + throw pmt_wrong_type("mb_make_protocol_class: NAME must be symbol", name); + if (!(pmt_is_pair(incoming) || pmt_is_null(incoming))) + throw pmt_wrong_type("mb_make_protocol_class: INCOMING must be a list", name); + if (!(pmt_is_pair(outgoing) || pmt_is_null(outgoing))) + throw pmt_wrong_type("mb_make_protocol_class: OUTGOING must be a list", name); - gruel::pmt_t t = gruel::pmt_cons(gruel::pmt_intern("protocol-class"), - gruel::pmt_cons(name, - gruel::pmt_cons(incoming, - gruel::pmt_cons(outgoing, gruel::PMT_NIL)))); + pmt_t t = pmt_cons(pmt_intern("protocol-class"), + pmt_cons(name, + pmt_cons(incoming, + pmt_cons(outgoing, PMT_NIL)))); // Remember this protocol class. - s_ALL_PROTOCOL_CLASSES = gruel::pmt_cons(t, s_ALL_PROTOCOL_CLASSES); + s_ALL_PROTOCOL_CLASSES = pmt_cons(t, s_ALL_PROTOCOL_CLASSES); return t; } -gruel::pmt_t -mb_protocol_class_name(gruel::pmt_t pc) +pmt_t +mb_protocol_class_name(pmt_t pc) { - return gruel::pmt_nth(1, pc); + return pmt_nth(1, pc); } -gruel::pmt_t -mb_protocol_class_incoming(gruel::pmt_t pc) +pmt_t +mb_protocol_class_incoming(pmt_t pc) { - return gruel::pmt_nth(2, pc); + return pmt_nth(2, pc); } -gruel::pmt_t -mb_protocol_class_outgoing(gruel::pmt_t pc) +pmt_t +mb_protocol_class_outgoing(pmt_t pc) { - return gruel::pmt_nth(3, pc); + return pmt_nth(3, pc); } -gruel::pmt_t -mb_protocol_class_lookup(gruel::pmt_t name) +pmt_t +mb_protocol_class_lookup(pmt_t name) { - gruel::pmt_t lst = s_ALL_PROTOCOL_CLASSES; + pmt_t lst = s_ALL_PROTOCOL_CLASSES; - while (gruel::pmt_is_pair(lst)){ - if (gruel::pmt_eq(name, mb_protocol_class_name(gruel::pmt_car(lst)))) - return gruel::pmt_car(lst); - lst = gruel::pmt_cdr(lst); + while (pmt_is_pair(lst)){ + if (pmt_eq(name, mb_protocol_class_name(pmt_car(lst)))) + return pmt_car(lst); + lst = pmt_cdr(lst); } - return gruel::PMT_NIL; + return PMT_NIL; } mb_protocol_class_init::mb_protocol_class_init(const char *data, size_t len) @@ -88,18 +90,18 @@ mb_protocol_class_init::mb_protocol_class_init(const char *data, size_t len) sb.str(std::string(data, len)); while (1){ - gruel::pmt_t obj = gruel::pmt_deserialize(sb); + pmt_t obj = pmt_deserialize(sb); if (0){ - gruel::pmt_write(obj, std::cout); + pmt_write(obj, std::cout); std::cout << std::endl; } - if (gruel::pmt_is_eof_object(obj)) + if (pmt_is_eof_object(obj)) return; - mb_make_protocol_class(gruel::pmt_nth(0, obj), // protocol-class name - gruel::pmt_nth(1, obj), // list of incoming msg names - gruel::pmt_nth(2, obj)); // list of outgoing msg names + 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 } } |