From f2cd4cf637ae433341e6410145d3590e206889d3 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Mon, 9 Oct 2017 18:21:07 +0000 Subject: Remove unused nbostream methods (only used by removed diskindex checkpointing). --- .../src/tests/objects/nbostream/nbostream_test.cpp | 16 --------- vespalib/src/vespa/vespalib/objects/nbostream.cpp | 12 ++----- vespalib/src/vespa/vespalib/objects/nbostream.h | 10 ------ vespalib/src/vespa/vespalib/objects/nbostream.hpp | 41 ---------------------- 4 files changed, 2 insertions(+), 77 deletions(-) delete mode 100644 vespalib/src/vespa/vespalib/objects/nbostream.hpp diff --git a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp index f2e24f5acdc..8b9ccb8a848 100644 --- a/vespalib/src/tests/objects/nbostream/nbostream_test.cpp +++ b/vespalib/src/tests/objects/nbostream/nbostream_test.cpp @@ -201,22 +201,6 @@ TEST_F("Test serializing std::pair", Fixture) f.assertSerialize(exp, val); } -TEST_F("Test saveVector", Fixture) -{ - std::vector val({ 0x0123, 0x4567 }); - val.reserve(16); - ExpBuffer exp({ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, - 0x01, 0x23, 0x45, 0x67 }); - f._stream.saveVector(val); - EXPECT_EQUAL(exp, f._stream); - std::vector checkVal; - f._stream.restoreVector(checkVal); - EXPECT_EQUAL(val, checkVal); - EXPECT_EQUAL(val.capacity(), checkVal.capacity()); -} - - TEST_F("Test write", Fixture) { f._stream.write("Hello", 5); diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.cpp b/vespalib/src/vespa/vespalib/objects/nbostream.cpp index d8e35a69d16..0225b788e68 100644 --- a/vespalib/src/vespa/vespalib/objects/nbostream.cpp +++ b/vespalib/src/vespa/vespalib/objects/nbostream.cpp @@ -1,8 +1,9 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include "nbostream.hpp" +#include "nbostream.h" #include "hexdump.h" #include #include +#include namespace vespalib { @@ -135,13 +136,4 @@ void nbostream::swap(nbostream & os) std::swap(_rbuf, os._rbuf); } -template nbostream& nbostream::saveVector(const std::vector &); -template nbostream& nbostream::restoreVector(std::vector &); -template nbostream& nbostream::saveVector(const std::vector &); -template nbostream& nbostream::restoreVector(std::vector &); -template nbostream& nbostream::saveVector(const std::vector &); -template nbostream& nbostream::restoreVector(std::vector &); -template nbostream& nbostream::saveVector(const std::vector &); -template nbostream& nbostream::restoreVector(std::vector &); - } diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.h b/vespalib/src/vespa/vespalib/objects/nbostream.h index 75d3bc03313..70a590f79d1 100644 --- a/vespalib/src/vespa/vespalib/objects/nbostream.h +++ b/vespalib/src/vespa/vespalib/objects/nbostream.h @@ -138,16 +138,6 @@ public: return *this; } - // For checkpointing where capacity should be restored - template - nbostream & - saveVector(const std::vector &val); - - // For checkpointing where capacity should be restored - template - nbostream & - restoreVector(std::vector &val); - size_t size() const { return left(); } size_t capacity() const { return _wbuf.size(); } bool empty() const { return size() == 0; } diff --git a/vespalib/src/vespa/vespalib/objects/nbostream.hpp b/vespalib/src/vespa/vespalib/objects/nbostream.hpp deleted file mode 100644 index 8b045f517a1..00000000000 --- a/vespalib/src/vespa/vespalib/objects/nbostream.hpp +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#pragma once - -#include "nbostream.h" -#include - -namespace vespalib { - -template -nbostream & -nbostream::saveVector(const std::vector &val) -{ - size_t valCapacity = val.capacity(); - size_t valSize = val.size(); - assert(valCapacity >= valSize); - *this << valCapacity << valSize; - for (const T & v : val) { - *this << v; - } - return *this; -} - -template -nbostream & -nbostream::restoreVector(std::vector &val) -{ - size_t valCapacity = 0; - size_t valSize = 0; - *this >> valCapacity >> valSize; - assert(valCapacity >= valSize); - val.reserve(valCapacity); - val.clear(); - T i; - for (size_t j = 0; j < valSize; ++j) { - *this >> i; - val.push_back(i); - } - return *this; -} - -} -- cgit v1.2.3