aboutsummaryrefslogtreecommitdiffstats
path: root/fnet
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 19:19:24 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-09-26 19:19:24 +0000
commit80b2585f2c5bed035d5fb9215533109ad00a3fc5 (patch)
tree6a3158f65d3c336b5ca05804b22171e100ed6bd4 /fnet
parent72b6f0a82a7f1f7caec8cc58815b3802d94fb92d (diff)
Use && qualified member functions.
Diffstat (limited to 'fnet')
-rw-r--r--fnet/src/vespa/fnet/frt/values.cpp7
-rw-r--r--fnet/src/vespa/fnet/frt/values.h6
2 files changed, 12 insertions, 1 deletions
diff --git a/fnet/src/vespa/fnet/frt/values.cpp b/fnet/src/vespa/fnet/frt/values.cpp
index 3b37aa9a1bc..593bbd173c6 100644
--- a/fnet/src/vespa/fnet/frt/values.cpp
+++ b/fnet/src/vespa/fnet/frt/values.cpp
@@ -4,6 +4,7 @@
#include <vespa/fnet/databuffer.h>
#include <vespa/vespalib/util/stringfmt.h>
#include <vespa/vespalib/util/stash.h>
+#include <vespa/vespalib/data/databuffer.h>
#include <cassert>
static_assert(sizeof(uint8_t) == 1, "uint8_t must be 1 byte.");
@@ -300,6 +301,12 @@ FRT_Values::AddData(vespalib::alloc::Alloc && buf, uint32_t len) {
}
void
+FRT_Values::AddData(vespalib::DataBuffer && buf) {
+ const auto len = buf.getDataLen();
+ AddSharedData(&_stash.create<LocalBlob>(std::move(buf).stealBuffer(), len));
+}
+
+void
FRT_Values::AddData(const char *buf, uint32_t len) {
if (len > SHARED_LIMIT) {
return AddSharedData(&_stash.create<LocalBlob>(buf, len));
diff --git a/fnet/src/vespa/fnet/frt/values.h b/fnet/src/vespa/fnet/frt/values.h
index 2aa7551c423..bac1f609fbb 100644
--- a/fnet/src/vespa/fnet/frt/values.h
+++ b/fnet/src/vespa/fnet/frt/values.h
@@ -5,7 +5,10 @@
#include "isharedblob.h"
#include <cstring>
-namespace vespalib { class Stash; }
+namespace vespalib {
+ class Stash;
+ class DataBuffer;
+}
namespace vespalib::alloc { class Alloc; }
namespace fnet {
char * copyString(char *dst, const char *src, size_t len);
@@ -218,6 +221,7 @@ public:
FRT_StringValue *AddStringArray(uint32_t len);
void AddSharedData(FRT_ISharedBlob *blob);
void AddData(Alloc && buf, uint32_t len);
+ void AddData(vespalib::DataBuffer && buf);
void AddData(const char *buf, uint32_t len);
char *AddData(uint32_t len);
FRT_DataValue *AddDataArray(uint32_t len);