From 4edd3ad2a48eb1d0db1e035a55bfbedb5f996117 Mon Sep 17 00:00:00 2001 From: yang-g Date: Wed, 28 Aug 2019 10:30:33 -0700 Subject: [PATCH] Update reflection doc --- doc/server_reflection_tutorial.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/doc/server_reflection_tutorial.md b/doc/server_reflection_tutorial.md index acbb4a6ab2d..ccad06057d6 100644 --- a/doc/server_reflection_tutorial.md +++ b/doc/server_reflection_tutorial.md @@ -178,15 +178,12 @@ descriptor database. desc_pool->FindMethodByName("helloworld.Greeter.SayHello"); ``` - * Get message type descriptors. + * Get message type descriptors and create messages dynamically. ```c++ const google::protobuf::Descriptor* request_desc = desc_pool->FindMessageTypeByName("helloworld.HelloRequest"); + google::protobuf::DynamicMessageFactory dmf; + google::protobuf::Message* request = dmf.GetPrototype(request_desc)->New(); ``` - * Feed [google::protobuf::DynamicMessageFactory](https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.dynamic_message#DynamicMessageFactory). - - ```c++ - google::protobuf::DynamicMessageFactory(&desc_pool); - ```