From 2bba7d602744ccd6dab26940661f0fdfbf231af8 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 25 Dec 2016 21:34:03 +0100 Subject: Refactor flowgraph and puncturing rules --- src/ModPlugin.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/ModPlugin.cpp') diff --git a/src/ModPlugin.cpp b/src/ModPlugin.cpp index 1f94770..775b284 100644 --- a/src/ModPlugin.cpp +++ b/src/ModPlugin.cpp @@ -1,6 +1,11 @@ /* Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) + + Copyright (C) 2016 + Matthias P. Braendli, matthias.braendli@mpb.li + + http://opendigitalradio.org */ /* This file is part of ODR-DabMod. @@ -20,4 +25,49 @@ */ #include "ModPlugin.h" +#include "PcDebug.h" +#include +#include + +#define MODASSERT(cond) \ + if (not (cond)) { \ + throw std::runtime_error("Assertion failure: " #cond " for " + \ + std::string(name())); \ + } + +int ModInput::process( + std::vector dataIn, + std::vector dataOut) +{ + MODASSERT(dataIn.empty()); + MODASSERT(dataOut.size() == 1); + return process(dataOut[0]); +} + +int ModCodec::process( + std::vector dataIn, + std::vector dataOut) +{ + MODASSERT(dataIn.size() == 1); + MODASSERT(dataOut.size() == 1); + return process(dataIn[0], dataOut[0]); +} + +int ModMux::process( + std::vector dataIn, + std::vector dataOut) +{ + MODASSERT(not dataIn.empty()); + MODASSERT(dataOut.size() == 1); + return process(dataIn, dataOut[0]); +} + +int ModOutput::process( + std::vector dataIn, + std::vector dataOut) +{ + MODASSERT(dataIn.size() == 1); + MODASSERT(dataOut.empty()); + return process(dataIn[0]); +} -- cgit v1.2.3