aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/cpp/util
diff options
context:
space:
mode:
authorGravatar ncteisen <ncteisen@gmail.com>2018-02-27 11:55:10 -0800
committerGravatar ncteisen <ncteisen@gmail.com>2018-04-06 07:05:27 -0700
commitcf5b2666e16f7b6ebc1bda4a884045d1ef1a4134 (patch)
treeb945a65fa777134898ec029cfc094d69b1190024 /src/cpp/util
parent1c73e2c53ddecf3bd45f1c28d23a895fc7cd6e12 (diff)
Make GrpcProtoBufferReaderWriter public
Diffstat (limited to 'src/cpp/util')
-rw-r--r--src/cpp/util/byte_buffer_cc.cc42
-rw-r--r--src/cpp/util/slice_cc.cc55
2 files changed, 0 insertions, 97 deletions
diff --git a/src/cpp/util/byte_buffer_cc.cc b/src/cpp/util/byte_buffer_cc.cc
index fbc1768bcc..d976b69440 100644
--- a/src/cpp/util/byte_buffer_cc.cc
+++ b/src/cpp/util/byte_buffer_cc.cc
@@ -23,34 +23,6 @@
namespace grpc {
-static internal::GrpcLibraryInitializer g_gli_initializer;
-
-ByteBuffer::ByteBuffer(const Slice* slices, size_t nslices) {
- // The following assertions check that the representation of a grpc::Slice is
- // identical to that of a grpc_slice: it has a grpc_slice field, and nothing
- // else.
- static_assert(std::is_same<decltype(slices[0].slice_), grpc_slice>::value,
- "Slice must have same representation as grpc_slice");
- static_assert(sizeof(Slice) == sizeof(grpc_slice),
- "Slice must have same representation as grpc_slice");
- // The following assertions check that the representation of a ByteBuffer is
- // identical to grpc_byte_buffer*: it has a grpc_byte_buffer* field,
- // and nothing else.
- static_assert(std::is_same<decltype(buffer_), grpc_byte_buffer*>::value,
- "ByteBuffer must have same representation as "
- "grpc_byte_buffer*");
- static_assert(sizeof(ByteBuffer) == sizeof(grpc_byte_buffer*),
- "ByteBuffer must have same representation as "
- "grpc_byte_buffer*");
- g_gli_initializer.summon(); // Make sure that initializer linked in
- // The const_cast is legal if grpc_raw_byte_buffer_create() does no more
- // than its advertised side effect of increasing the reference count of the
- // slices it processes, and such an increase does not affect the semantics
- // seen by the caller of this constructor.
- buffer_ = grpc_raw_byte_buffer_create(
- reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices);
-}
-
Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
slices->clear();
if (!buffer_) {
@@ -69,14 +41,6 @@ Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
return Status::OK;
}
-size_t ByteBuffer::Length() const {
- if (buffer_) {
- return grpc_byte_buffer_length(buffer_);
- } else {
- return 0;
- }
-}
-
ByteBuffer::ByteBuffer(const ByteBuffer& buf)
: buffer_(grpc_byte_buffer_copy(buf.buffer_)) {}
@@ -90,10 +54,4 @@ ByteBuffer& ByteBuffer::operator=(const ByteBuffer& buf) {
return *this;
}
-void ByteBuffer::Swap(ByteBuffer* other) {
- grpc_byte_buffer* tmp = other->buffer_;
- other->buffer_ = buffer_;
- buffer_ = tmp;
-}
-
} // namespace grpc
diff --git a/src/cpp/util/slice_cc.cc b/src/cpp/util/slice_cc.cc
deleted file mode 100644
index c72dbdbfc0..0000000000
--- a/src/cpp/util/slice_cc.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- *
- * Copyright 2015 gRPC authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <grpc/slice.h>
-#include <grpcpp/support/slice.h>
-
-namespace grpc {
-
-Slice::Slice() : slice_(grpc_empty_slice()) {}
-
-Slice::~Slice() { grpc_slice_unref(slice_); }
-
-Slice::Slice(grpc_slice slice, AddRef) : slice_(grpc_slice_ref(slice)) {}
-
-Slice::Slice(grpc_slice slice, StealRef) : slice_(slice) {}
-
-Slice::Slice(size_t len) : slice_(grpc_slice_malloc(len)) {}
-
-Slice::Slice(const void* buf, size_t len)
- : slice_(
- grpc_slice_from_copied_buffer(static_cast<const char*>(buf), len)) {}
-
-Slice::Slice(const grpc::string& str)
- : slice_(grpc_slice_from_copied_buffer(str.c_str(), str.length())) {}
-
-Slice::Slice(const void* buf, size_t len, StaticSlice)
- : slice_(
- grpc_slice_from_static_buffer(static_cast<const char*>(buf), len)) {}
-
-Slice::Slice(const Slice& other) : slice_(grpc_slice_ref(other.slice_)) {}
-
-Slice::Slice(void* buf, size_t len, void (*destroy)(void*), void* user_data)
- : slice_(grpc_slice_new_with_user_data(buf, len, destroy, user_data)) {}
-
-Slice::Slice(void* buf, size_t len, void (*destroy)(void*, size_t))
- : slice_(grpc_slice_new_with_len(buf, len, destroy)) {}
-
-grpc_slice Slice::c_slice() const { return grpc_slice_ref(slice_); }
-
-} // namespace grpc