提交 ac85c41f 编写于 作者: W wangguibao

Fix pdcodegen

上级 d7040167
......@@ -95,38 +95,40 @@ class PdsCodeGenerator : public CodeGenerator {
const string body = strip_proto(file->name()) + ".pb.cc";
bool include_inserted = false;
for (int i = 0; i < file->service_count(); ++i) {
const ServiceDescriptor* descriptor = file->service(i);
if (!descriptor) {
*error = "get descriptor failed";
return false;
}
pds::PaddleServiceOption options =
descriptor->options().GetExtension(pds::options);
bool generate_impl = options.generate_impl();
bool generate_stub = options.generate_stub();
if (!generate_impl && !generate_stub) {
return true;
}
if (!include_inserted) {
boost::scoped_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->OpenForInsert(header, "includes"));
google::protobuf::io::Printer printer(output.get(), '$');
if (generate_impl) {
printer.Print("#include \"predictor/common/inner_common.h\"\n");
printer.Print("#include \"predictor/framework/service.h\"\n");
printer.Print("#include \"predictor/framework/manager.h\"\n");
printer.Print("#include \"predictor/framework/service_manager.h\"\n");
const ServiceDescriptor* descriptor = file->service(i);
if (!descriptor) {
*error = "get descriptor failed";
return false;
}
if (generate_stub) {
printer.Print("#include <baidu/rpc/parallel_channel.h>\n");
printer.Print("#include \"sdk-cpp/include/factory.h\"\n");
printer.Print("#include \"sdk-cpp/include/stub.h\"\n");
printer.Print("#include \"sdk-cpp/include/stub_impl.h\"\n");
pds::PaddleServiceOption options =
descriptor->options().GetExtension(pds::options);
bool generate_impl = options.generate_impl();
bool generate_stub = options.generate_stub();
if (!generate_impl && !generate_stub) {
return true;
}
include_inserted = true;
}
const std::string& class_name = descriptor->name();
const std::string& service_name = descriptor->name();
if (!include_inserted) {
boost::scoped_ptr<google::protobuf::io::ZeroCopyOutputStream> output(
context->OpenForInsert(header, "includes"));
google::protobuf::io::Printer printer(output.get(), '$');
if (generate_impl) {
printer.Print("#include \"predictor/common/inner_common.h\"\n");
printer.Print("#include \"predictor/framework/service.h\"\n");
printer.Print("#include \"predictor/framework/manager.h\"\n");
printer.Print("#include \"predictor/framework/service_manager.h\"\n");
}
if (generate_stub) {
printer.Print("#include <baidu/rpc/parallel_channel.h>\n");
printer.Print("#include \"sdk-cpp/include/factory.h\"\n");
printer.Print("#include \"sdk-cpp/include/stub.h\"\n");
printer.Print("#include \"sdk-cpp/include/stub_impl.h\"\n");
}
include_inserted = true;
}
const std::string& class_name = descriptor->name();
const std::string& service_name = descriptor->name();
// xxx.ph.h
{
if (generate_impl) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册