From eccfa8ad3774205a929ff70090540d24674618a1 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 10 Oct 2016 08:44:54 +0200 Subject: Simplify FIG allocation code in carousel --- src/fig/FIGCarousel.cpp | 28 +++++----------------------- src/fig/FIGCarousel.h | 5 +---- 2 files changed, 6 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/fig/FIGCarousel.cpp b/src/fig/FIGCarousel.cpp index cbea12b..63226e0 100644 --- a/src/fig/FIGCarousel.cpp +++ b/src/fig/FIGCarousel.cpp @@ -111,11 +111,11 @@ FIGCarousel::FIGCarousel(std::shared_ptr ensemble) : void FIGCarousel::load_and_allocate(IFIG& fig, FIBAllocation fib) { - int type = fig.figtype(); - int extension = fig.figextension(); - - m_figs_available[std::make_pair(type, extension)] = &fig; - allocate_fig_to_fib(type, extension, fib); + FIGCarouselElement el; + el.fig = &fig; + el.deadline = 0; + el.increase_deadline(); + m_fibs[fib].push_back(el); } void FIGCarousel::update(unsigned long currentFrame) @@ -123,24 +123,6 @@ void FIGCarousel::update(unsigned long currentFrame) m_rti.currentFrame = currentFrame; } -void FIGCarousel::allocate_fig_to_fib(int figtype, int extension, FIBAllocation fib) -{ - auto fig = m_figs_available.find(std::make_pair(figtype, extension)); - - if (fig != m_figs_available.end()) { - FIGCarouselElement el; - el.fig = fig->second; - el.deadline = 0; - el.increase_deadline(); - m_fibs[fib].push_back(el); - } - else { - std::stringstream ss; - ss << "No FIG " << figtype << "/" << extension << " available"; - throw std::runtime_error(ss.str()); - } -} - void dumpfib(const uint8_t *buf, size_t bufsize) { std::cerr << "FIB "; for (size_t i = 0; i < bufsize; i++) { diff --git a/src/fig/FIGCarousel.h b/src/fig/FIGCarousel.h index 67772a6..b46f4a6 100644 --- a/src/fig/FIGCarousel.h +++ b/src/fig/FIGCarousel.h @@ -3,7 +3,7 @@ 2011, 2012 Her Majesty the Queen in Right of Canada (Communications Research Center Canada) - Copyright (C) 2015 + Copyright (C) 2016 Matthias P. Braendli, matthias.braendli@mpb.li Implementation of the FIG carousel to schedule the FIGs into the @@ -62,8 +62,6 @@ class FIGCarousel { void update(unsigned long currentFrame); - void allocate_fig_to_fib(int figtype, int extension, FIBAllocation fib); - /* Write all FIBs to the buffer, including correct padding and crc. * Returns number of bytes written. * @@ -81,7 +79,6 @@ class FIGCarousel { void load_and_allocate(IFIG& fig, FIBAllocation fib); FIGRuntimeInformation m_rti; - std::map, IFIG*> m_figs_available; // Some FIGs can be mapped to a specific FIB or to FIB_ANY std::map > m_fibs; -- cgit v1.2.3