Files
SDK_SG200x_V2/flatbuffers/docs/source/gRPC/CppUsage.md
carbon 93b1517102 add flatbuffers
commit 6da1cf79d90eb242e7da5318241d42279a3df3ba
Author: Max Burke <max@urbanlogiq.com>
Date:   Sun Jan 19 14:47:28 2020 -0800

    [rust] Add use declarations to Rust-generated bindings for imported FB definitions (#5645)

    * Bugfix for Rust generation of union fields named with language keywords
2024-05-31 14:12:12 +08:00

775 B

Use in C++

Before you get started

Before diving into the FlatBuffers gRPC usage in C++, you should already be familiar with the following:

  • FlatBuffers as a serialization format
  • gRPC usage

Using the FlatBuffers gRPC C++ library

NOTE: The examples below are also in the grpc/samples/greeter directory.

We will illustrate usage with the following schema:

@include grpc/samples/greeter/greeter.fbs

When we run flatc, we pass in the --grpc option and generage an additional greeter.grpc.fb.h and greeter.grpc.fb.cc.

Example server code looks like this:

@include grpc/samples/greeter/server.cpp

Example client code looks like this:

@include grpc/samples/greeter/client.cpp