diff --git a/base/BdaBuffer.cc b/base/BdaBuffer.cc index d6603bdab4f3e27823329aac649f66ed1f5abac1..33107a9c3e264e09914e42ccb9f3cd6f5ad61ec7 100644 --- a/base/BdaBuffer.cc +++ b/base/BdaBuffer.cc @@ -92,34 +92,6 @@ void BdaBuffer::CopyRows(const std::vector<BdaBuffer::Row>& existing_rows) { rows_ = std::move(new_rows); } -void BdaBuffer::SetFields(const Fields& fields) { - if ((fields.data == !data_.empty()) && (fields.flags == !flags_.empty()) && - (fields.weights == !weights_.empty())) { - return; - } - - if (fields.data) { - data_.resize(original_capacity_); - } else { - data_.clear(); - data_.shrink_to_fit(); - } - if (fields.flags) { - flags_.resize(original_capacity_); - } else { - flags_.clear(); - flags_.shrink_to_fit(); - } - if (fields.weights) { - weights_.resize(original_capacity_); - } else { - weights_.clear(); - weights_.shrink_to_fit(); - } - - CopyRows(rows_); -} - void BdaBuffer::Clear() { data_.clear(); flags_.clear(); diff --git a/base/test/unit/tBdaBuffer.cc b/base/test/unit/tBdaBuffer.cc index 948aa8b0c438f8e6bdbc402dcac4a9d7d40d9931..bee6f102e25316f9dc5760397bc63747e03b195b 100644 --- a/base/test/unit/tBdaBuffer.cc +++ b/base/test/unit/tBdaBuffer.cc @@ -212,33 +212,6 @@ BOOST_AUTO_TEST_CASE(copy_add_data_flags) { BOOST_CHECK_EQUAL(copy.GetRemainingCapacity(), 0u); } -BOOST_AUTO_TEST_CASE(set_fields) { - BdaBuffer buffer(kDataSize); - AddBasicRow(buffer); - const BdaBuffer copy(buffer, BdaBuffer::Fields(false)); - dp3::base::test::CheckBDARowMetaData(buffer, copy); - - BOOST_CHECK(buffer.GetData() && buffer.GetData(0)); - BOOST_CHECK(buffer.GetFlags() && buffer.GetFlags(0)); - BOOST_CHECK(buffer.GetWeights() && buffer.GetWeights(0)); - - BdaBuffer::Fields data_and_weights(false); - data_and_weights.data = data_and_weights.weights = true; - buffer.SetFields(data_and_weights); - BOOST_CHECK(buffer.GetData() && buffer.GetData(0)); - BOOST_CHECK(!buffer.GetFlags() && !buffer.GetFlags(0)); - BOOST_CHECK(buffer.GetWeights() && buffer.GetWeights(0)); - - BdaBuffer::Fields flags(false); - flags.flags = true; - buffer.SetFields(flags); - BOOST_CHECK(!buffer.GetData() && !buffer.GetData(0)); - BOOST_CHECK(buffer.GetFlags() && buffer.GetFlags(0)); - BOOST_CHECK(!buffer.GetWeights() && !buffer.GetWeights(0)); - - dp3::base::test::CheckBDARowMetaData(buffer, copy); -} - BOOST_AUTO_TEST_CASE(add_all_fields) { const std::complex<float> kData1[kDataSize]{{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}}; diff --git a/include/dp3/base/BdaBuffer.h b/include/dp3/base/BdaBuffer.h index e2142febbf6733ae08df8b6a5ee83853c66cbca7..cb65ab293ac1ff9f6a06e99840bcf412ab30c0b5 100644 --- a/include/dp3/base/BdaBuffer.h +++ b/include/dp3/base/BdaBuffer.h @@ -90,13 +90,6 @@ class BdaBuffer { BdaBuffer(const BdaBuffer& other, const Fields& fields, const Fields& copy_fields = Fields()); - /** - * Sets the fields that are enabled in this buffer. - * Allocates memory for fields that are added, but does not initialize it. - * @param fields The fields that should be enabled in the buffer. - */ - void SetFields(const Fields& fields); - /** * Add a measurement line to the buffer. *