Home | History | Annotate | Download | only in proto_text
      1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved.
      2 
      3 Licensed under the Apache License, Version 2.0 (the "License");
      4 you may not use this file except in compliance with the License.
      5 You may obtain a copy of the License at
      6 
      7     http://www.apache.org/licenses/LICENSE-2.0
      8 
      9 Unless required by applicable law or agreed to in writing, software
     10 distributed under the License is distributed on an "AS IS" BASIS,
     11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 See the License for the specific language governing permissions and
     13 limitations under the License.
     14 ==============================================================================*/
     15 
     16 #ifndef TENSORFLOW_CORE_UTIL_CREATE_PROTO_DEBUG_STRING_LIB_H_
     17 #define TENSORFLOW_CORE_UTIL_CREATE_PROTO_DEBUG_STRING_LIB_H_
     18 
     19 #include "tensorflow/core/platform/protobuf.h"
     20 #include "tensorflow/core/platform/types.h"
     21 
     22 namespace tensorflow {
     23 
     24 struct ProtoTextFunctionCode {
     25   string header;       // for a file named proto_name + ".pb_text.h"
     26   string header_impl;  // for a file named proto_name + ".pb_text-impl.h"
     27   string cc;           // for a file named proto_name + ".pb_text.cc"
     28 };
     29 
     30 // Returns the generated source code for a proto file descriptor.
     31 //
     32 // <tf_header_prefix> is used as the prefix for #include paths, when including
     33 // tensorflow library headers.
     34 //
     35 // Only works for proto3 messages.
     36 //
     37 // The generated API has, for enums and messages defined in the proto file:
     38 // 1. For each message:
     39 //    * ProtoDebugString(m): same as msg.DebugString(), except that google.any
     40 //      is not expanded.
     41 //    * ProtoShortDebugString(m): same as msg.ShorDebugString(), except that
     42 //      google.any is not expanded.
     43 //    * ProtoParseFromString(s, m): same as TextFormat.ParseFromString(s, &m);
     44 // 2. For each enum:
     45 //    * EnumName_<EnumTypeName>(enum_value): same as <EnumTypeName>(enum_value)
     46 //      in proto.
     47 ProtoTextFunctionCode GetProtoTextFunctionCode(
     48     const tensorflow::protobuf::FileDescriptor& fd,
     49     const string& tf_header_prefix);
     50 
     51 }  // namespace tensorflow
     52 
     53 #endif  // TENSORFLOW_CORE_UTIL_CREATE_PROTO_DEBUG_STRING_LIB_H_
     54