summaryrefslogtreecommitdiff
path: root/mblock/src
diff options
context:
space:
mode:
Diffstat (limited to 'mblock/src')
-rw-r--r--mblock/src/Makefile.am22
-rw-r--r--mblock/src/lib/Makefile.am82
-rw-r--r--mblock/src/lib/mb_common.h29
-rw-r--r--mblock/src/lib/mb_mblock.h26
-rw-r--r--mblock/src/lib/mb_message.cc41
-rw-r--r--mblock/src/lib/mb_message.h66
-rw-r--r--mblock/src/lib/mb_protocol_class.cc44
-rw-r--r--mblock/src/lib/mb_protocol_class.h62
8 files changed, 372 insertions, 0 deletions
diff --git a/mblock/src/Makefile.am b/mblock/src/Makefile.am
new file mode 100644
index 000000000..8b32a223c
--- /dev/null
+++ b/mblock/src/Makefile.am
@@ -0,0 +1,22 @@
+#
+# Copyright 2004,2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+SUBDIRS = lib
diff --git a/mblock/src/lib/Makefile.am b/mblock/src/lib/Makefile.am
new file mode 100644
index 000000000..74f1311cc
--- /dev/null
+++ b/mblock/src/lib/Makefile.am
@@ -0,0 +1,82 @@
+#
+# Copyright 2006 Free Software Foundation, Inc.
+#
+# This file is part of GNU Radio
+#
+# GNU Radio is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# GNU Radio is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Radio; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+#
+
+include $(top_srcdir)/Makefile.common
+
+INCLUDES = $(PMT_INCLUDES) $(BOOST_CFLAGS) $(CPPUNIT_INCLUDES)
+
+# TESTS = test_mblock
+
+lib_LTLIBRARIES = libmblock.la libmblock-qa.la
+
+EXTRA_DIST =
+
+
+# These are the source files that go into the mblock shared library
+libmblock_la_SOURCES = \
+ mb_message.cc \
+ mb_protocol_class.cc
+
+
+# magic flags
+libmblock_la_LDFLAGS = $(NO_UNDEFINED) -avoid-version
+
+# link the library against the c++ standard library
+libmblock_la_LIBADD = \
+ $(PMT_LIBS) \
+ -lstdc++
+
+include_HEADERS = \
+ mb_mblock.h \
+ mb_common.h \
+ mb_message.h \
+ mb_protocol_class.h
+
+noinst_HEADERS =
+
+
+# Build the qa code into its own library
+
+libmblock_qa_la_SOURCES =
+
+
+# magic flags
+libmblock_qa_la_LDFLAGS = $(NO_UNDEFINED) -avoid-version
+
+# link the library against the c++ standard library
+libmblock_qa_la_LIBADD = \
+ libmblock.la \
+ $(CPPUNIT_LIBS) \
+ -lstdc++
+
+
+#noinst_PROGRAMS = \
+# test_mblock
+
+
+LIBMBLOCK = libmblock.la
+LIBMBLOCKQA = libmblock-qa.la $(LIBMBLOCK)
+
+#test_mblock_SOURCES = test_mblock.cc
+#test_mblock_LDADD = $(LIBMBLOCKQA)
+
+
+CLEANFILES = $(BUILT_SOURCES) *.pyc
diff --git a/mblock/src/lib/mb_common.h b/mblock/src/lib/mb_common.h
new file mode 100644
index 000000000..abeb06579
--- /dev/null
+++ b/mblock/src/lib/mb_common.h
@@ -0,0 +1,29 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MB_COMMON_H
+#define INCLUDED_MB_COMMON_H
+
+#include <pmt.h>
+
+typedef unsigned int mb_pri_t;
+static const mb_pri_t MB_PRI_DEFAULT = 5;
+
+#endif /* INCLUDED_MB_COMMON_H */
diff --git a/mblock/src/lib/mb_mblock.h b/mblock/src/lib/mb_mblock.h
new file mode 100644
index 000000000..db9d0a33b
--- /dev/null
+++ b/mblock/src/lib/mb_mblock.h
@@ -0,0 +1,26 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MB_MBLOCK_H
+#define INCLUDED_MB_MBLOCK_H
+
+#include <mb_common.h>
+
+#endif /* INCLUDED_MB_MBLOCK_H */
diff --git a/mblock/src/lib/mb_message.cc b/mblock/src/lib/mb_message.cc
new file mode 100644
index 000000000..f494201ac
--- /dev/null
+++ b/mblock/src/lib/mb_message.cc
@@ -0,0 +1,41 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <mb_message.h>
+
+mb_message_sptr
+mb_make_message(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t priority)
+{
+ return mb_message_sptr(new mb_message(signal, data, metadata, priority));
+}
+
+mb_message::mb_message(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t priority)
+ : d_signal(signal), d_data(data), d_metadata(metadata), d_priority(priority)
+{
+}
+
+mb_message::~mb_message()
+{
+ // NOP
+}
diff --git a/mblock/src/lib/mb_message.h b/mblock/src/lib/mb_message.h
new file mode 100644
index 000000000..ee88d79f7
--- /dev/null
+++ b/mblock/src/lib/mb_message.h
@@ -0,0 +1,66 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MB_MESSAGE_H
+#define INCLUDED_MB_MESSAGE_H
+
+#include <mb_common.h>
+
+class mb_message;
+typedef boost::shared_ptr<mb_message> mb_message_sptr;
+
+/*!
+ * \brief construct a message and return boost::shared_ptr
+ *
+ * \param signal identifier of the message
+ * \param data the data to be operated on
+ * \param metadata information about the data
+ * \param priority urgency
+ */
+mb_message_sptr
+mb_make_message(pmt_t signal,
+ pmt_t data = PMT_NIL,
+ pmt_t metadata = PMT_NIL,
+ mb_pri_t priority = MB_PRI_DEFAULT);
+
+class mb_message {
+ pmt_t d_signal;
+ pmt_t d_data;
+ pmt_t d_metadata;
+ mb_pri_t d_priority;
+ // foo d_rcvd_port_id;
+
+ friend mb_message_sptr
+ mb_make_message(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t priority);
+
+ // private constructor
+ mb_message(pmt_t signal, pmt_t data, pmt_t metadata, mb_pri_t priority);
+
+public:
+ ~mb_message();
+
+ pmt_t signal() const { return d_signal; }
+ pmt_t data() const { return d_data; }
+ pmt_t metadata() const { return d_metadata; }
+ mb_pri_t priority() const { return d_priority; }
+ // foo rcvd_port_id const { return d_rcvd_port_id; }
+};
+
+#endif /* INCLUDED_MB_MESSAGE_H */
diff --git a/mblock/src/lib/mb_protocol_class.cc b/mblock/src/lib/mb_protocol_class.cc
new file mode 100644
index 000000000..a34f073d2
--- /dev/null
+++ b/mblock/src/lib/mb_protocol_class.cc
@@ -0,0 +1,44 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <mb_protocol_class.h>
+
+
+mb_protocol_class_sptr
+mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing)
+{
+ return mb_protocol_class_sptr(new mb_protocol_class(name, incoming, outgoing));
+}
+
+mb_protocol_class::mb_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing)
+ : d_name(name), d_incoming(incoming), d_outgoing(outgoing)
+{
+}
+
+mb_protocol_class_sptr
+mb_protocol_class::conj() const
+{
+ return mb_make_protocol_class(name(), outgoing(), incoming());
+}
diff --git a/mblock/src/lib/mb_protocol_class.h b/mblock/src/lib/mb_protocol_class.h
new file mode 100644
index 000000000..771a63e09
--- /dev/null
+++ b/mblock/src/lib/mb_protocol_class.h
@@ -0,0 +1,62 @@
+/* -*- c++ -*- */
+/*
+ * Copyright 2006 Free Software Foundation, Inc.
+ *
+ * This file is part of GNU Radio
+ *
+ * GNU Radio is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * GNU Radio is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+#ifndef INCLUDED_MB_PROTOCOL_CLASS_H
+#define INCLUDED_MB_PROTOCOL_CLASS_H
+
+#include <mb_common.h>
+
+// FIXME maybe this should just be a pmt_t aggregate???
+
+class mb_protocol_class;
+typedef boost::shared_ptr<mb_protocol_class> mb_protocol_class_sptr;
+
+/*!
+ * \brief construct a protocol_class and return boost::shared_ptr
+ *
+ * \param name the name of the class (symbol)
+ * \param incoming incoming message set (dict: keys are message types)
+ * \param outgoing outgoing message set (dict: keys are message types)
+ */
+mb_protocol_class_sptr
+mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
+
+class mb_protocol_class {
+ pmt_t d_name;
+ pmt_t d_incoming;
+ pmt_t d_outgoing;
+
+ friend mb_protocol_class_sptr
+ mb_make_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
+
+ // private constructor
+ mb_protocol_class(pmt_t name, pmt_t incoming, pmt_t outgoing);
+
+public:
+ ~mb_protocol_class();
+
+ pmt_t name() const { return d_name; }
+ pmt_t incoming() const { return d_incoming; }
+ pmt_t outgoing() const { return d_outgoing; }
+
+ mb_protocol_class_sptr conj() const; // return the conjugate of this protocol class
+};
+
+#endif /* INCLUDED_MB_PROTOCOL_CLASS_H */