grpcpp/impl/codegen/rpc_method.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPCPP_IMPL_CODEGEN_RPC_METHOD_H
20 #define GRPCPP_IMPL_CODEGEN_RPC_METHOD_H
21 
22 // IWYU pragma: private, include <grpcpp/impl/rpc_method.h>
23 
24 #include <memory>
25 
27 
28 namespace grpc {
29 namespace internal {
31 class RpcMethod {
32  public:
33  enum RpcType {
35  CLIENT_STREAMING, // request streaming
36  SERVER_STREAMING, // response streaming
38  };
39 
40  RpcMethod(const char* name, RpcType type)
41  : name_(name),
42  suffix_for_stats_(nullptr),
44  channel_tag_(nullptr) {}
45 
46  RpcMethod(const char* name, const char* suffix_for_stats, RpcType type)
47  : name_(name),
50  channel_tag_(nullptr) {}
51 
52  RpcMethod(const char* name, RpcType type,
53  const std::shared_ptr<ChannelInterface>& channel)
54  : name_(name),
55  suffix_for_stats_(nullptr),
57  channel_tag_(channel->RegisterMethod(name)) {}
58 
59  RpcMethod(const char* name, const char* suffix_for_stats, RpcType type,
60  const std::shared_ptr<ChannelInterface>& channel)
61  : name_(name),
64  channel_tag_(channel->RegisterMethod(name)) {}
65 
66  const char* name() const { return name_; }
67  const char* suffix_for_stats() const { return suffix_for_stats_; }
68  RpcType method_type() const { return method_type_; }
70  void* channel_tag() const { return channel_tag_; }
71 
72  private:
73  const char* const name_;
74  const char* const suffix_for_stats_;
76  void* const channel_tag_;
77 };
78 
79 } // namespace internal
80 } // namespace grpc
81 
82 #endif // GRPCPP_IMPL_CODEGEN_RPC_METHOD_H
grpc::internal::RpcMethod::method_type
RpcType method_type() const
Definition: grpcpp/impl/codegen/rpc_method.h:68
grpc::internal::RpcMethod::RpcMethod
RpcMethod(const char *name, const char *suffix_for_stats, RpcType type)
Definition: grpcpp/impl/codegen/rpc_method.h:46
grpc
Definition: grpcpp/alarm.h:33
grpc::internal::RpcMethod::channel_tag_
void *const channel_tag_
Definition: grpcpp/impl/codegen/rpc_method.h:76
grpc::internal::RpcMethod::name_
const char *const name_
Definition: grpcpp/impl/codegen/rpc_method.h:73
grpc::internal::RpcMethod::SetMethodType
void SetMethodType(RpcType type)
Definition: grpcpp/impl/codegen/rpc_method.h:69
grpc::internal::RpcMethod::NORMAL_RPC
@ NORMAL_RPC
Definition: grpcpp/impl/codegen/rpc_method.h:34
channel
wrapped_grpc_channel * channel
Definition: src/php/ext/grpc/call.h:33
grpc::internal::RpcMethod::RpcMethod
RpcMethod(const char *name, const char *suffix_for_stats, RpcType type, const std::shared_ptr< ChannelInterface > &channel)
Definition: grpcpp/impl/codegen/rpc_method.h:59
grpc::internal::RpcMethod
Descriptor of an RPC method.
Definition: grpcpp/impl/codegen/rpc_method.h:31
grpc::internal::RpcMethod::name
const char * name() const
Definition: grpcpp/impl/codegen/rpc_method.h:66
grpc::internal::RpcMethod::RpcMethod
RpcMethod(const char *name, RpcType type, const std::shared_ptr< ChannelInterface > &channel)
Definition: grpcpp/impl/codegen/rpc_method.h:52
grpc::internal::RpcMethod::RpcType
RpcType
Definition: grpcpp/impl/codegen/rpc_method.h:33
grpc::internal::RpcMethod::suffix_for_stats_
const char *const suffix_for_stats_
Definition: grpcpp/impl/codegen/rpc_method.h:74
grpc::internal::RpcMethod::channel_tag
void * channel_tag() const
Definition: grpcpp/impl/codegen/rpc_method.h:70
channel_interface.h
internal
Definition: benchmark/test/output_test_helper.cc:20
asyncio_get_stats.type
type
Definition: asyncio_get_stats.py:37
grpc::internal::RpcMethod::BIDI_STREAMING
@ BIDI_STREAMING
Definition: grpcpp/impl/codegen/rpc_method.h:37
grpc::internal::RpcMethod::SERVER_STREAMING
@ SERVER_STREAMING
Definition: grpcpp/impl/codegen/rpc_method.h:36
grpc::internal::RpcMethod::CLIENT_STREAMING
@ CLIENT_STREAMING
Definition: grpcpp/impl/codegen/rpc_method.h:35
grpc::internal::RpcMethod::RpcMethod
RpcMethod(const char *name, RpcType type)
Definition: grpcpp/impl/codegen/rpc_method.h:40
grpc::internal::RpcMethod::suffix_for_stats
const char * suffix_for_stats() const
Definition: grpcpp/impl/codegen/rpc_method.h:67
grpc::internal::RpcMethod::method_type_
RpcType method_type_
Definition: grpcpp/impl/codegen/rpc_method.h:75


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:01:13