default_reactor_test_peer.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2019 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_TEST_DEFAULT_REACTOR_TEST_PEER_H
20 #define GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H
21 
22 #include <grpcpp/server_context.h>
24 
25 namespace grpc {
26 namespace testing {
27 
36  public:
38  : DefaultReactorTestPeer(ctx, [](Status) {}) {}
40  std::function<void(Status)> finish_func)
41  : ctx_(ctx) {
42  ctx->SetupTestDefaultReactor(std::move(finish_func));
43  }
45  return reinterpret_cast<ServerUnaryReactor*>(&ctx_->default_reactor_);
46  }
47  bool test_status_set() const { return ctx_->test_status_set(); }
48  Status test_status() const { return ctx_->test_status(); }
49 
50  private:
51  CallbackServerContext* const ctx_; // not owned
52 };
53 
54 } // namespace testing
55 } // namespace grpc
56 
57 #endif // GRPCPP_TEST_DEFAULT_REACTOR_TEST_PEER_H
testing
Definition: aws_request_signer_test.cc:25
ctx
Definition: benchmark-async.c:30
grpc
Definition: grpcpp/alarm.h:33
grpc::testing::DefaultReactorTestPeer::DefaultReactorTestPeer
DefaultReactorTestPeer(CallbackServerContext *ctx)
Definition: default_reactor_test_peer.h:37
grpc::testing::DefaultReactorTestPeer::test_status_set
bool test_status_set() const
Definition: default_reactor_test_peer.h:47
absl::move
constexpr absl::remove_reference_t< T > && move(T &&t) noexcept
Definition: abseil-cpp/absl/utility/utility.h:221
grpc::ServerContextBase::test_status_set
bool test_status_set() const
Definition: grpcpp/impl/codegen/server_context.h:507
grpc::CallbackServerContext
Definition: grpcpp/impl/codegen/server_context.h:606
grpc::testing::DefaultReactorTestPeer
Definition: default_reactor_test_peer.h:35
server_callback.h
server_context.h
grpc::Status
Definition: include/grpcpp/impl/codegen/status.h:35
grpc::ServerUnaryReactor
Definition: impl/codegen/server_callback.h:699
function
std::function< bool(GrpcTool *, int, const char **, const CliCredentials &, GrpcToolOutputCallback)> function
Definition: grpc_tool.cc:250
grpc::testing::DefaultReactorTestPeer::DefaultReactorTestPeer
DefaultReactorTestPeer(CallbackServerContext *ctx, std::function< void(Status)> finish_func)
Definition: default_reactor_test_peer.h:39
grpc::testing::DefaultReactorTestPeer::test_status
Status test_status() const
Definition: default_reactor_test_peer.h:48
grpc::testing::DefaultReactorTestPeer::ctx_
CallbackServerContext *const ctx_
Definition: default_reactor_test_peer.h:51
grpc::ServerContextBase::default_reactor_
std::aligned_storage< sizeof(Reactor), alignof(Reactor)>::type default_reactor_
Definition: grpcpp/impl/codegen/server_context.h:542
grpc::testing::DefaultReactorTestPeer::reactor
ServerUnaryReactor * reactor() const
Definition: default_reactor_test_peer.h:44
grpc::ServerContextBase::test_status
grpc::Status test_status() const
Definition: grpcpp/impl/codegen/server_context.h:510


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