|
| 1 | +#pragma once |
| 2 | + |
| 3 | +#cmakedefine VIAMCPPSDK_GRPCXX_LEGACY_FWD |
| 4 | + |
| 5 | +// Forward declaration file grpc client and server types. |
| 6 | +// This file provides includes for recent (>= 1.32.0) versions of grpc or older |
| 7 | +// versions, depending on if `VIAMCPPSDK_GRPCXX_LEGACY_FWD` is defined. |
| 8 | +// The default behavior is for the variable to be undefined, providing the behavior for recent |
| 9 | +// versions. If you are experiencing compilation errors in an installed version of the SDK it may be |
| 10 | +// due to a mismatch with the configured version of this header and the grpc version found by the |
| 11 | +// compiler. You may wish to comment/uncomment the define above as needed, or add the definition |
| 12 | +// with `-D` to the compiler. |
| 13 | +#ifndef VIAMCPPSDK_GRPCXX_LEGACY_FWD |
| 14 | + |
| 15 | +namespace grpc { |
| 16 | + |
| 17 | +class Channel; |
| 18 | + |
| 19 | +class ClientContext; |
| 20 | + |
| 21 | +template <typename> |
| 22 | +class ClientReaderInterface; |
| 23 | + |
| 24 | +class Server; |
| 25 | + |
| 26 | +class ServerBuilder; |
| 27 | + |
| 28 | +class ServerCredentials; |
| 29 | + |
| 30 | +} // namespace grpc |
| 31 | + |
| 32 | +namespace viam { |
| 33 | +namespace sdk { |
| 34 | + |
| 35 | +using GrpcChannel = ::grpc::Channel; |
| 36 | + |
| 37 | +using GrpcClientContext = ::grpc::ClientContext; |
| 38 | + |
| 39 | +template <typename T> |
| 40 | +using GrpcClientReaderInterface = ::grpc::ClientReaderInterface<T>; |
| 41 | + |
| 42 | +using GrpcServer = ::grpc::Server; |
| 43 | + |
| 44 | +using GrpcServerBuilder = ::grpc::ServerBuilder; |
| 45 | + |
| 46 | +using GrpcServerCredentials = ::grpc::ServerCredentials; |
| 47 | + |
| 48 | +} // namespace sdk |
| 49 | +} // namespace viam |
| 50 | + |
| 51 | +#else |
| 52 | + |
| 53 | +namespace grpc_impl { |
| 54 | + |
| 55 | +class Channel; |
| 56 | + |
| 57 | +class ClientContext; |
| 58 | + |
| 59 | +template <typename> |
| 60 | +class ClientReaderInterface; |
| 61 | + |
| 62 | +class Server; |
| 63 | + |
| 64 | +class ServerBuilder; |
| 65 | + |
| 66 | +class ServerCredentials; |
| 67 | + |
| 68 | +} // namespace grpc_impl |
| 69 | + |
| 70 | +namespace viam { |
| 71 | +namespace sdk { |
| 72 | + |
| 73 | +using GrpcChannel = ::grpc_impl::Channel; |
| 74 | + |
| 75 | +using GrpcClientContext = ::grpc_impl::ClientContext; |
| 76 | + |
| 77 | +template <typename T> |
| 78 | +using GrpcClientReaderInterface = ::grpc_impl::ClientReaderInterface<T>; |
| 79 | + |
| 80 | +using GrpcServer = ::grpc_impl::Server; |
| 81 | + |
| 82 | +using GrpcServerBuilder = ::grpc_impl::ServerBuilder; |
| 83 | + |
| 84 | +using GrpcServerCredentials = ::grpc_impl::ServerCredentials; |
| 85 | + |
| 86 | +} // namespace sdk |
| 87 | +} // namespace viam |
| 88 | + |
| 89 | +#endif |
0 commit comments