chromium/third_party/grpc/src/include/grpcpp/impl/call_op_set.h

//
//
// Copyright 2018 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.
//
//

#ifndef GRPCPP_IMPL_CALL_OP_SET_H
#define GRPCPP_IMPL_CALL_OP_SET_H

#include <cstring>
#include <map>
#include <memory>

#include <grpc/grpc.h>
#include <grpc/impl/compression_types.h>
#include <grpc/impl/grpc_types.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpcpp/client_context.h>
#include <grpcpp/completion_queue.h>
#include <grpcpp/impl/call.h>
#include <grpcpp/impl/call_hook.h>
#include <grpcpp/impl/call_op_set_interface.h>
#include <grpcpp/impl/codegen/intercepted_channel.h>
#include <grpcpp/impl/completion_queue_tag.h>
#include <grpcpp/impl/interceptor_common.h>
#include <grpcpp/impl/serialization_traits.h>
#include <grpcpp/support/byte_buffer.h>
#include <grpcpp/support/config.h>
#include <grpcpp/support/slice.h>
#include <grpcpp/support/string_ref.h>

namespace grpc {

namespace internal {
class Call;
class CallHook;

// TODO(yangg) if the map is changed before we send, the pointers will be a
// mess. Make sure it does not happen.
inline grpc_metadata* FillMetadataArray(
    const std::multimap<std::string, std::string>& metadata,
    size_t* metadata_count, const std::string& optional_error_details) {}
}  // namespace internal

/// Per-message write options.
class WriteOptions {};

namespace internal {

/// Default argument for CallOpSet. The Unused parameter is unused by
/// the class, but can be used for generating multiple names for the
/// same thing.
template <int Unused>
class CallNoOp {};

class CallOpSendInitialMetadata {};

class CallOpSendMessage {};

template <class M>
Status CallOpSendMessage::SendMessage(const M& message, WriteOptions options) {}

template <class M>
Status CallOpSendMessage::SendMessage(const M& message) {}

template <class M>
Status CallOpSendMessage::SendMessagePtr(const M* message,
                                         WriteOptions options) {}

template <class M>
Status CallOpSendMessage::SendMessagePtr(const M* message) {}

template <class R>
class CallOpRecvMessage {};

class DeserializeFunc {};

template <class R>
class DeserializeFuncType final : public DeserializeFunc {};

class CallOpGenericRecvMessage {};

class CallOpClientSendClose {};

class CallOpServerSendStatus {};

class CallOpRecvInitialMetadata {};

class CallOpClientRecvStatus {};

template <class Op1 = CallNoOp<1>, class Op2 = CallNoOp<2>,
          class Op3 = CallNoOp<3>, class Op4 = CallNoOp<4>,
          class Op5 = CallNoOp<5>, class Op6 = CallNoOp<6>>
class CallOpSet;

/// Primary implementation of CallOpSetInterface.
/// Since we cannot use variadic templates, we declare slots up to
/// the maximum count of ops we'll need in a set. We leverage the
/// empty base class optimization to slim this class (especially
/// when there are many unused slots used). To avoid duplicate base classes,
/// the template parameter for CallNoOp is varied by argument position.
template <class Op1, class Op2, class Op3, class Op4, class Op5, class Op6>
class CallOpSet : public CallOpSetInterface,
                  public Op1,
                  public Op2,
                  public Op3,
                  public Op4,
                  public Op5,
                  public Op6 {};

}  // namespace internal
}  // namespace grpc

#endif  // GRPCPP_IMPL_CALL_OP_SET_H