From 57493529372c14d674169d6a76a1a686a1eafda3 Mon Sep 17 00:00:00 2001 From: Rick Altherr Date: Tue, 16 Jan 2018 16:11:08 -0800 Subject: [PATCH] lib: xc7series: convience constructor for Configuration Configuration's original constructor expects Spans as part of the map to avoid copying the actual frame data. In tests or any other place that needs to directly construct a Configuration, the caller will already have a map with vector to hold the actual frame data. This new constructor just wraps those vectors in Spans. Signed-off-by: Rick Altherr --- lib/include/prjxray/xilinx/xc7series/configuration.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/include/prjxray/xilinx/xc7series/configuration.h b/lib/include/prjxray/xilinx/xc7series/configuration.h index 0258db12..fa10a19d 100644 --- a/lib/include/prjxray/xilinx/xc7series/configuration.h +++ b/lib/include/prjxray/xilinx/xc7series/configuration.h @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -22,6 +23,15 @@ class Configuration { const Part& part, Collection& packets); + Configuration(const Part& part, + std::map>* frames) + : part_(part) { + for (auto& frame : *frames) { + frames_[frame.first] = + absl::Span(frame.second); + } + } + Configuration(const Part& part, const FrameMap& frames) : part_(part), frames_(std::move(frames)) {}