diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-09 18:21:07 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-09 18:21:07 +0000 |
commit | f2cd4cf637ae433341e6410145d3590e206889d3 (patch) | |
tree | 848d64bae50a09219d7ea9ed05e7730041b7a758 /vespalib | |
parent | 943a63a1022d90cb16fd34cd1d39d8f6d5586503 (diff) |
Remove unused nbostream methods (only used by removed diskindex checkpointing).
Diffstat (limited to 'vespalib')
-rw-r--r-- | vespalib/src/tests/objects/nbostream/nbostream_test.cpp | 16 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/objects/nbostream.cpp | 12 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/objects/nbostream.h | 10 | ||||
-rw-r--r-- | vespalib/src/vespa/vespalib/objects/nbostream.hpp | 41 |
4 files changed, 2 insertions, 77 deletions
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<int16_t> 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<int16_t> 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 <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/util/stringfmt.h> +#include <cassert> namespace vespalib { @@ -135,13 +136,4 @@ void nbostream::swap(nbostream & os) std::swap(_rbuf, os._rbuf); } -template nbostream& nbostream::saveVector<int16_t>(const std::vector<int16_t> &); -template nbostream& nbostream::restoreVector<int16_t>(std::vector<int16_t> &); -template nbostream& nbostream::saveVector<int32_t>(const std::vector<int32_t> &); -template nbostream& nbostream::restoreVector<int32_t>(std::vector<int32_t> &); -template nbostream& nbostream::saveVector<uint32_t>(const std::vector<uint32_t> &); -template nbostream& nbostream::restoreVector<uint32_t>(std::vector<uint32_t> &); -template nbostream& nbostream::saveVector<uint64_t>(const std::vector<uint64_t> &); -template nbostream& nbostream::restoreVector<uint64_t>(std::vector<uint64_t> &); - } 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 <typename T> - nbostream & - saveVector(const std::vector<T> &val); - - // For checkpointing where capacity should be restored - template <typename T> - nbostream & - restoreVector(std::vector<T> &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 <cassert> - -namespace vespalib { - -template <typename T> -nbostream & -nbostream::saveVector(const std::vector<T> &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 <typename T> -nbostream & -nbostream::restoreVector(std::vector<T> &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; -} - -} |