%% -*- coding: utf-8 -*-
%% @private
%% Automatically @generated, do not edit
%% Generated by gpb_compile version 5.0.0
%% Version source: file
-module(route_guide_pb).
-export([encode_msg/2, encode_msg/3]).
-export([decode_msg/2, decode_msg/3]).
-export([merge_msgs/3, merge_msgs/4]).
-export([verify_msg/2, verify_msg/3]).
-export([get_msg_defs/0]).
-export([get_msg_names/0]).
-export([get_group_names/0]).
-export([get_msg_or_group_names/0]).
-export([get_enum_names/0]).
-export([find_msg_def/1, fetch_msg_def/1]).
-export([find_enum_def/1, fetch_enum_def/1]).
-export([enum_symbol_by_value/2, enum_value_by_symbol/2]).
-export([get_service_names/0]).
-export([get_service_def/1]).
-export([get_rpc_names/1]).
-export([find_rpc_def/2, fetch_rpc_def/2]).
-export([fqbin_to_service_name/1]).
-export([service_name_to_fqbin/1]).
-export([fqbins_to_service_and_rpc_name/2]).
-export([service_and_rpc_name_to_fqbins/2]).
-export([fqbin_to_msg_name/1]).
-export([msg_name_to_fqbin/1]).
-export([fqbin_to_enum_name/1]).
-export([enum_name_to_fqbin/1]).
-export([get_package_name/0]).
-export([uses_packages/0]).
-export([source_basename/0]).
-export([get_all_source_basenames/0]).
-export([get_all_proto_names/0]).
-export([get_msg_containment/1]).
-export([get_pkg_containment/1]).
-export([get_service_containment/1]).
-export([get_rpc_containment/1]).
-export([get_enum_containment/1]).
-export([get_proto_by_msg_name_as_fqbin/1]).
-export([get_proto_by_service_name_as_fqbin/1]).
-export([get_proto_by_enum_name_as_fqbin/1]).
-export([get_protos_by_pkg_name_as_fqbin/1]).
-export([descriptor/0, descriptor/1]).
-export([gpb_version_as_string/0, gpb_version_as_list/0]).
-export([gpb_version_source/0]).
%% enumerated types
-export_type([]).
%% message types
-type 'Point'() ::
#{latitude => integer(), % = 1, optional, 32 bits
longitude => integer() % = 2, optional, 32 bits
}.
-type 'Rectangle'() ::
#{lo => 'Point'(), % = 1, optional
hi => 'Point'() % = 2, optional
}.
-type 'Feature'() ::
#{name => unicode:chardata(), % = 1, optional
location => 'Point'() % = 2, optional
}.
-type 'RouteNote'() ::
#{location => 'Point'(), % = 1, optional
message => unicode:chardata() % = 2, optional
}.
-type 'RouteSummary'() ::
#{point_count => integer(), % = 1, optional, 32 bits
feature_count => integer(), % = 2, optional, 32 bits
distance => integer() % = 3, optional, 32 bits
}.
-export_type(['Point'/0, 'Rectangle'/0, 'Feature'/0, 'RouteNote'/0, 'RouteSummary'/0]).
-type '$msg_name'() :: 'Point' | 'Rectangle' | 'Feature' | 'RouteNote' | 'RouteSummary'.
-type '$msg'() :: 'Point'() | 'Rectangle'() | 'Feature'() | 'RouteNote'() | 'RouteSummary'().
-export_type(['$msg_name'/0, '$msg'/0]).
-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/2}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'()) -> binary().
encode_msg(Msg, MsgName) when is_atom(MsgName) -> encode_msg(Msg, MsgName, []).
-if(?OTP_RELEASE >= 24).
-dialyzer({no_underspecs, encode_msg/3}).
-endif.
-spec encode_msg('$msg'(), '$msg_name'(), list()) -> binary().
encode_msg(Msg, MsgName, Opts) ->
case proplists:get_bool(verify, Opts) of
true -> verify_msg(Msg, MsgName, Opts);
false -> ok
end,
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
'Point' -> encode_msg_Point(id(Msg, TrUserData), TrUserData);
'Rectangle' -> encode_msg_Rectangle(id(Msg, TrUserData), TrUserData);
'Feature' -> encode_msg_Feature(id(Msg, TrUserData), TrUserData);
'RouteNote' -> encode_msg_RouteNote(id(Msg, TrUserData), TrUserData);
'RouteSummary' -> encode_msg_RouteSummary(id(Msg, TrUserData), TrUserData)
end.
encode_msg_Point(Msg, TrUserData) -> encode_msg_Point(Msg, <<>>, TrUserData).
encode_msg_Point(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{latitude := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true -> e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{longitude := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= 0 -> B1;
true -> e_type_int32(TrF2, <<B1/binary, 16>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_Rectangle(Msg, TrUserData) -> encode_msg_Rectangle(Msg, <<>>, TrUserData).
encode_msg_Rectangle(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{lo := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= undefined -> Bin;
true -> e_mfield_Rectangle_lo(TrF1, <<Bin/binary, 10>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{hi := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= undefined -> B1;
true -> e_mfield_Rectangle_hi(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_Feature(Msg, TrUserData) -> encode_msg_Feature(Msg, <<>>, TrUserData).
encode_msg_Feature(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{name := F1} ->
begin
TrF1 = id(F1, TrUserData),
case is_empty_string(TrF1) of
true -> Bin;
false -> e_type_string(TrF1, <<Bin/binary, 10>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{location := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= undefined -> B1;
true -> e_mfield_Feature_location(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_RouteNote(Msg, TrUserData) -> encode_msg_RouteNote(Msg, <<>>, TrUserData).
encode_msg_RouteNote(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{location := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= undefined -> Bin;
true -> e_mfield_RouteNote_location(TrF1, <<Bin/binary, 10>>, TrUserData)
end
end;
_ -> Bin
end,
case M of
#{message := F2} ->
begin
TrF2 = id(F2, TrUserData),
case is_empty_string(TrF2) of
true -> B1;
false -> e_type_string(TrF2, <<B1/binary, 18>>, TrUserData)
end
end;
_ -> B1
end.
encode_msg_RouteSummary(Msg, TrUserData) -> encode_msg_RouteSummary(Msg, <<>>, TrUserData).
encode_msg_RouteSummary(#{} = M, Bin, TrUserData) ->
B1 = case M of
#{point_count := F1} ->
begin
TrF1 = id(F1, TrUserData),
if TrF1 =:= 0 -> Bin;
true -> e_type_int32(TrF1, <<Bin/binary, 8>>, TrUserData)
end
end;
_ -> Bin
end,
B2 = case M of
#{feature_count := F2} ->
begin
TrF2 = id(F2, TrUserData),
if TrF2 =:= 0 -> B1;
true -> e_type_int32(TrF2, <<B1/binary, 16>>, TrUserData)
end
end;
_ -> B1
end,
case M of
#{distance := F3} ->
begin
TrF3 = id(F3, TrUserData),
if TrF3 =:= 0 -> B2;
true -> e_type_int32(TrF3, <<B2/binary, 24>>, TrUserData)
end
end;
_ -> B2
end.
e_mfield_Rectangle_lo(Msg, Bin, TrUserData) ->
SubBin = encode_msg_Point(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_Rectangle_hi(Msg, Bin, TrUserData) ->
SubBin = encode_msg_Point(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_Feature_location(Msg, Bin, TrUserData) ->
SubBin = encode_msg_Point(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
e_mfield_RouteNote_location(Msg, Bin, TrUserData) ->
SubBin = encode_msg_Point(Msg, <<>>, TrUserData),
Bin2 = e_varint(byte_size(SubBin), Bin),
<<Bin2/binary, SubBin/binary>>.
-compile({nowarn_unused_function,e_type_sint/3}).
e_type_sint(Value, Bin, _TrUserData) when Value >= 0 -> e_varint(Value * 2, Bin);
e_type_sint(Value, Bin, _TrUserData) -> e_varint(Value * -2 - 1, Bin).
-compile({nowarn_unused_function,e_type_int32/3}).
e_type_int32(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <<Bin/binary, Value>>;
e_type_int32(Value, Bin, _TrUserData) ->
<<N:64/unsigned-native>> = <<Value:64/signed-native>>,
e_varint(N, Bin).
-compile({nowarn_unused_function,e_type_int64/3}).
e_type_int64(Value, Bin, _TrUserData) when 0 =< Value, Value =< 127 -> <<Bin/binary, Value>>;
e_type_int64(Value, Bin, _TrUserData) ->
<<N:64/unsigned-native>> = <<Value:64/signed-native>>,
e_varint(N, Bin).
-compile({nowarn_unused_function,e_type_bool/3}).
e_type_bool(true, Bin, _TrUserData) -> <<Bin/binary, 1>>;
e_type_bool(false, Bin, _TrUserData) -> <<Bin/binary, 0>>;
e_type_bool(1, Bin, _TrUserData) -> <<Bin/binary, 1>>;
e_type_bool(0, Bin, _TrUserData) -> <<Bin/binary, 0>>.
-compile({nowarn_unused_function,e_type_string/3}).
e_type_string(S, Bin, _TrUserData) ->
Utf8 = unicode:characters_to_binary(S),
Bin2 = e_varint(byte_size(Utf8), Bin),
<<Bin2/binary, Utf8/binary>>.
-compile({nowarn_unused_function,e_type_bytes/3}).
e_type_bytes(Bytes, Bin, _TrUserData) when is_binary(Bytes) ->
Bin2 = e_varint(byte_size(Bytes), Bin),
<<Bin2/binary, Bytes/binary>>;
e_type_bytes(Bytes, Bin, _TrUserData) when is_list(Bytes) ->
BytesBin = iolist_to_binary(Bytes),
Bin2 = e_varint(byte_size(BytesBin), Bin),
<<Bin2/binary, BytesBin/binary>>.
-compile({nowarn_unused_function,e_type_fixed32/3}).
e_type_fixed32(Value, Bin, _TrUserData) -> <<Bin/binary, Value:32/little>>.
-compile({nowarn_unused_function,e_type_sfixed32/3}).
e_type_sfixed32(Value, Bin, _TrUserData) -> <<Bin/binary, Value:32/little-signed>>.
-compile({nowarn_unused_function,e_type_fixed64/3}).
e_type_fixed64(Value, Bin, _TrUserData) -> <<Bin/binary, Value:64/little>>.
-compile({nowarn_unused_function,e_type_sfixed64/3}).
e_type_sfixed64(Value, Bin, _TrUserData) -> <<Bin/binary, Value:64/little-signed>>.
-compile({nowarn_unused_function,e_type_float/3}).
e_type_float(V, Bin, _) when is_number(V) -> <<Bin/binary, V:32/little-float>>;
e_type_float(infinity, Bin, _) -> <<Bin/binary, 0:16, 128, 127>>;
e_type_float('-infinity', Bin, _) -> <<Bin/binary, 0:16, 128, 255>>;
e_type_float(nan, Bin, _) -> <<Bin/binary, 0:16, 192, 127>>.
-compile({nowarn_unused_function,e_type_double/3}).
e_type_double(V, Bin, _) when is_number(V) -> <<Bin/binary, V:64/little-float>>;
e_type_double(infinity, Bin, _) -> <<Bin/binary, 0:48, 240, 127>>;
e_type_double('-infinity', Bin, _) -> <<Bin/binary, 0:48, 240, 255>>;
e_type_double(nan, Bin, _) -> <<Bin/binary, 0:48, 248, 127>>.
-compile({nowarn_unused_function,e_unknown_elems/2}).
e_unknown_elems([Elem | Rest], Bin) ->
BinR = case Elem of
{varint, FNum, N} ->
BinF = e_varint(FNum bsl 3, Bin),
e_varint(N, BinF);
{length_delimited, FNum, Data} ->
BinF = e_varint(FNum bsl 3 bor 2, Bin),
BinL = e_varint(byte_size(Data), BinF),
<<BinL/binary, Data/binary>>;
{group, FNum, GroupFields} ->
Bin1 = e_varint(FNum bsl 3 bor 3, Bin),
Bin2 = e_unknown_elems(GroupFields, Bin1),
e_varint(FNum bsl 3 bor 4, Bin2);
{fixed32, FNum, V} ->
BinF = e_varint(FNum bsl 3 bor 5, Bin),
<<BinF/binary, V:32/little>>;
{fixed64, FNum, V} ->
BinF = e_varint(FNum bsl 3 bor 1, Bin),
<<BinF/binary, V:64/little>>
end,
e_unknown_elems(Rest, BinR);
e_unknown_elems([], Bin) -> Bin.
-compile({nowarn_unused_function,e_varint/3}).
e_varint(N, Bin, _TrUserData) -> e_varint(N, Bin).
-compile({nowarn_unused_function,e_varint/2}).
e_varint(N, Bin) when N =< 127 -> <<Bin/binary, N>>;
e_varint(N, Bin) ->
Bin2 = <<Bin/binary, (N band 127 bor 128)>>,
e_varint(N bsr 7, Bin2).
is_empty_string("") -> true;
is_empty_string(<<>>) -> true;
is_empty_string(L) when is_list(L) -> not string_has_chars(L);
is_empty_string(B) when is_binary(B) -> false.
string_has_chars([C | _]) when is_integer(C) -> true;
string_has_chars([H | T]) ->
case string_has_chars(H) of
true -> true;
false -> string_has_chars(T)
end;
string_has_chars(B) when is_binary(B), byte_size(B) =/= 0 -> true;
string_has_chars(C) when is_integer(C) -> true;
string_has_chars(<<>>) -> false;
string_has_chars([]) -> false.
decode_msg(Bin, MsgName) when is_binary(Bin) -> decode_msg(Bin, MsgName, []).
decode_msg(Bin, MsgName, Opts) when is_binary(Bin) ->
TrUserData = proplists:get_value(user_data, Opts),
decode_msg_1_catch(Bin, MsgName, TrUserData).
decode_msg_1_catch(Bin, MsgName, TrUserData) ->
try decode_msg_2_doit(MsgName, Bin, TrUserData)
catch
error:{gpb_error,_}=Reason:StackTrace ->
erlang:raise(error, Reason, StackTrace);
Class:Reason:StackTrace ->
error({gpb_error,
{decoding_failure,
{Bin, MsgName, {Class, Reason, StackTrace}}}})
end.
decode_msg_2_doit('Point', Bin, TrUserData) -> id(decode_msg_Point(Bin, TrUserData), TrUserData);
decode_msg_2_doit('Rectangle', Bin, TrUserData) -> id(decode_msg_Rectangle(Bin, TrUserData), TrUserData);
decode_msg_2_doit('Feature', Bin, TrUserData) -> id(decode_msg_Feature(Bin, TrUserData), TrUserData);
decode_msg_2_doit('RouteNote', Bin, TrUserData) -> id(decode_msg_RouteNote(Bin, TrUserData), TrUserData);
decode_msg_2_doit('RouteSummary', Bin, TrUserData) -> id(decode_msg_RouteSummary(Bin, TrUserData), TrUserData).
decode_msg_Point(Bin, TrUserData) -> dfp_read_field_def_Point(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), TrUserData).
dfp_read_field_def_Point(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Point_latitude(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Point(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Point_longitude(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Point(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{latitude => F@_1, longitude => F@_2};
dfp_read_field_def_Point(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_Point(Other, Z1, Z2, F, F@_1, F@_2, TrUserData).
dg_read_field_def_Point(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_Point(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
dg_read_field_def_Point(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 -> d_field_Point_latitude(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
16 -> d_field_Point_longitude(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
_ ->
case Key band 7 of
0 -> skip_varint_Point(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
1 -> skip_64_Point(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
2 -> skip_length_delimited_Point(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
3 -> skip_group_Point(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
5 -> skip_32_Point(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_Point(<<>>, 0, 0, _, F@_1, F@_2, _) -> #{latitude => F@_1, longitude => F@_2}.
d_field_Point_latitude(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Point_latitude(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Point_latitude(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
{NewFValue, RestF} = {begin <<Res:32/signed-native>> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest},
dfp_read_field_def_Point(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
d_field_Point_longitude(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Point_longitude(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Point_longitude(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) ->
{NewFValue, RestF} = {begin <<Res:32/signed-native>> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest},
dfp_read_field_def_Point(RestF, 0, 0, F, F@_1, NewFValue, TrUserData).
skip_varint_Point(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_Point(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
skip_varint_Point(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Point(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_length_delimited_Point(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_Point(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
skip_length_delimited_Point(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_Point(Rest2, 0, 0, F, F@_1, F@_2, TrUserData).
skip_group_Point(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_Point(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData).
skip_32_Point(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Point(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_64_Point(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Point(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
decode_msg_Rectangle(Bin, TrUserData) -> dfp_read_field_def_Rectangle(Bin, 0, 0, 0, id('$undef', TrUserData), id('$undef', TrUserData), TrUserData).
dfp_read_field_def_Rectangle(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Rectangle_lo(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Rectangle(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Rectangle_hi(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Rectangle(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{},
S2 = if F@_1 == '$undef' -> S1;
true -> S1#{lo => F@_1}
end,
if F@_2 == '$undef' -> S2;
true -> S2#{hi => F@_2}
end;
dfp_read_field_def_Rectangle(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_Rectangle(Other, Z1, Z2, F, F@_1, F@_2, TrUserData).
dg_read_field_def_Rectangle(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_Rectangle(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
dg_read_field_def_Rectangle(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 -> d_field_Rectangle_lo(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
18 -> d_field_Rectangle_hi(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
_ ->
case Key band 7 of
0 -> skip_varint_Rectangle(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
1 -> skip_64_Rectangle(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
2 -> skip_length_delimited_Rectangle(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
3 -> skip_group_Rectangle(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
5 -> skip_32_Rectangle(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_Rectangle(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{},
S2 = if F@_1 == '$undef' -> S1;
true -> S1#{lo => F@_1}
end,
if F@_2 == '$undef' -> S2;
true -> S2#{hi => F@_2}
end.
d_field_Rectangle_lo(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Rectangle_lo(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Rectangle_lo(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bs:Len/binary, Rest2/binary>> = Rest, {id(decode_msg_Point(Bs, TrUserData), TrUserData), Rest2} end,
dfp_read_field_def_Rectangle(RestF,
0,
0,
F,
if Prev == '$undef' -> NewFValue;
true -> merge_msg_Point(Prev, NewFValue, TrUserData)
end,
F@_2,
TrUserData).
d_field_Rectangle_hi(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Rectangle_hi(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Rectangle_hi(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bs:Len/binary, Rest2/binary>> = Rest, {id(decode_msg_Point(Bs, TrUserData), TrUserData), Rest2} end,
dfp_read_field_def_Rectangle(RestF,
0,
0,
F,
F@_1,
if Prev == '$undef' -> NewFValue;
true -> merge_msg_Point(Prev, NewFValue, TrUserData)
end,
TrUserData).
skip_varint_Rectangle(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_Rectangle(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
skip_varint_Rectangle(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Rectangle(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_length_delimited_Rectangle(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_Rectangle(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
skip_length_delimited_Rectangle(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_Rectangle(Rest2, 0, 0, F, F@_1, F@_2, TrUserData).
skip_group_Rectangle(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_Rectangle(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData).
skip_32_Rectangle(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Rectangle(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_64_Rectangle(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Rectangle(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
decode_msg_Feature(Bin, TrUserData) -> dfp_read_field_def_Feature(Bin, 0, 0, 0, id(<<>>, TrUserData), id('$undef', TrUserData), TrUserData).
dfp_read_field_def_Feature(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Feature_name(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Feature(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_Feature_location(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_Feature(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{name => F@_1},
if F@_2 == '$undef' -> S1;
true -> S1#{location => F@_2}
end;
dfp_read_field_def_Feature(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_Feature(Other, Z1, Z2, F, F@_1, F@_2, TrUserData).
dg_read_field_def_Feature(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_Feature(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
dg_read_field_def_Feature(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 -> d_field_Feature_name(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
18 -> d_field_Feature_location(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
_ ->
case Key band 7 of
0 -> skip_varint_Feature(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
1 -> skip_64_Feature(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
2 -> skip_length_delimited_Feature(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
3 -> skip_group_Feature(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
5 -> skip_32_Feature(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_Feature(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{name => F@_1},
if F@_2 == '$undef' -> S1;
true -> S1#{location => F@_2}
end.
d_field_Feature_name(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Feature_name(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Feature_name(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_Feature(RestF, 0, 0, F, NewFValue, F@_2, TrUserData).
d_field_Feature_location(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_Feature_location(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_Feature_location(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, Prev, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bs:Len/binary, Rest2/binary>> = Rest, {id(decode_msg_Point(Bs, TrUserData), TrUserData), Rest2} end,
dfp_read_field_def_Feature(RestF,
0,
0,
F,
F@_1,
if Prev == '$undef' -> NewFValue;
true -> merge_msg_Point(Prev, NewFValue, TrUserData)
end,
TrUserData).
skip_varint_Feature(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_Feature(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
skip_varint_Feature(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Feature(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_length_delimited_Feature(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_Feature(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
skip_length_delimited_Feature(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_Feature(Rest2, 0, 0, F, F@_1, F@_2, TrUserData).
skip_group_Feature(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_Feature(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData).
skip_32_Feature(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Feature(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_64_Feature(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_Feature(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
decode_msg_RouteNote(Bin, TrUserData) -> dfp_read_field_def_RouteNote(Bin, 0, 0, 0, id('$undef', TrUserData), id(<<>>, TrUserData), TrUserData).
dfp_read_field_def_RouteNote(<<10, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_RouteNote_location(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_RouteNote(<<18, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> d_field_RouteNote_message(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
dfp_read_field_def_RouteNote(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{message => F@_2},
if F@_1 == '$undef' -> S1;
true -> S1#{location => F@_1}
end;
dfp_read_field_def_RouteNote(Other, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dg_read_field_def_RouteNote(Other, Z1, Z2, F, F@_1, F@_2, TrUserData).
dg_read_field_def_RouteNote(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 32 - 7 -> dg_read_field_def_RouteNote(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
dg_read_field_def_RouteNote(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, TrUserData) ->
Key = X bsl N + Acc,
case Key of
10 -> d_field_RouteNote_location(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
18 -> d_field_RouteNote_message(Rest, 0, 0, 0, F@_1, F@_2, TrUserData);
_ ->
case Key band 7 of
0 -> skip_varint_RouteNote(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
1 -> skip_64_RouteNote(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
2 -> skip_length_delimited_RouteNote(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
3 -> skip_group_RouteNote(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData);
5 -> skip_32_RouteNote(Rest, 0, 0, Key bsr 3, F@_1, F@_2, TrUserData)
end
end;
dg_read_field_def_RouteNote(<<>>, 0, 0, _, F@_1, F@_2, _) ->
S1 = #{message => F@_2},
if F@_1 == '$undef' -> S1;
true -> S1#{location => F@_1}
end.
d_field_RouteNote_location(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_RouteNote_location(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_RouteNote_location(<<0:1, X:7, Rest/binary>>, N, Acc, F, Prev, F@_2, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bs:Len/binary, Rest2/binary>> = Rest, {id(decode_msg_Point(Bs, TrUserData), TrUserData), Rest2} end,
dfp_read_field_def_RouteNote(RestF,
0,
0,
F,
if Prev == '$undef' -> NewFValue;
true -> merge_msg_Point(Prev, NewFValue, TrUserData)
end,
F@_2,
TrUserData).
d_field_RouteNote_message(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> d_field_RouteNote_message(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
d_field_RouteNote_message(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, TrUserData) ->
{NewFValue, RestF} = begin Len = X bsl N + Acc, <<Bytes:Len/binary, Rest2/binary>> = Rest, Bytes2 = binary:copy(Bytes), {id(Bytes2, TrUserData), Rest2} end,
dfp_read_field_def_RouteNote(RestF, 0, 0, F, F@_1, NewFValue, TrUserData).
skip_varint_RouteNote(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> skip_varint_RouteNote(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData);
skip_varint_RouteNote(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_RouteNote(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_length_delimited_RouteNote(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) when N < 57 -> skip_length_delimited_RouteNote(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, TrUserData);
skip_length_delimited_RouteNote(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_RouteNote(Rest2, 0, 0, F, F@_1, F@_2, TrUserData).
skip_group_RouteNote(Bin, _, Z2, FNum, F@_1, F@_2, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_RouteNote(Rest, 0, Z2, FNum, F@_1, F@_2, TrUserData).
skip_32_RouteNote(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_RouteNote(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
skip_64_RouteNote(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, TrUserData) -> dfp_read_field_def_RouteNote(Rest, Z1, Z2, F, F@_1, F@_2, TrUserData).
decode_msg_RouteSummary(Bin, TrUserData) -> dfp_read_field_def_RouteSummary(Bin, 0, 0, 0, id(0, TrUserData), id(0, TrUserData), id(0, TrUserData), TrUserData).
dfp_read_field_def_RouteSummary(<<8, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_RouteSummary_point_count(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
dfp_read_field_def_RouteSummary(<<16, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_RouteSummary_feature_count(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
dfp_read_field_def_RouteSummary(<<24, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> d_field_RouteSummary_distance(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
dfp_read_field_def_RouteSummary(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{point_count => F@_1, feature_count => F@_2, distance => F@_3};
dfp_read_field_def_RouteSummary(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dg_read_field_def_RouteSummary(Other, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
dg_read_field_def_RouteSummary(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 32 - 7 -> dg_read_field_def_RouteSummary(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
dg_read_field_def_RouteSummary(<<0:1, X:7, Rest/binary>>, N, Acc, _, F@_1, F@_2, F@_3, TrUserData) ->
Key = X bsl N + Acc,
case Key of
8 -> d_field_RouteSummary_point_count(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
16 -> d_field_RouteSummary_feature_count(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
24 -> d_field_RouteSummary_distance(Rest, 0, 0, 0, F@_1, F@_2, F@_3, TrUserData);
_ ->
case Key band 7 of
0 -> skip_varint_RouteSummary(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
1 -> skip_64_RouteSummary(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
2 -> skip_length_delimited_RouteSummary(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
3 -> skip_group_RouteSummary(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData);
5 -> skip_32_RouteSummary(Rest, 0, 0, Key bsr 3, F@_1, F@_2, F@_3, TrUserData)
end
end;
dg_read_field_def_RouteSummary(<<>>, 0, 0, _, F@_1, F@_2, F@_3, _) -> #{point_count => F@_1, feature_count => F@_2, distance => F@_3}.
d_field_RouteSummary_point_count(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_RouteSummary_point_count(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
d_field_RouteSummary_point_count(<<0:1, X:7, Rest/binary>>, N, Acc, F, _, F@_2, F@_3, TrUserData) ->
{NewFValue, RestF} = {begin <<Res:32/signed-native>> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest},
dfp_read_field_def_RouteSummary(RestF, 0, 0, F, NewFValue, F@_2, F@_3, TrUserData).
d_field_RouteSummary_feature_count(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_RouteSummary_feature_count(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
d_field_RouteSummary_feature_count(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, _, F@_3, TrUserData) ->
{NewFValue, RestF} = {begin <<Res:32/signed-native>> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest},
dfp_read_field_def_RouteSummary(RestF, 0, 0, F, F@_1, NewFValue, F@_3, TrUserData).
d_field_RouteSummary_distance(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> d_field_RouteSummary_distance(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
d_field_RouteSummary_distance(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, _, TrUserData) ->
{NewFValue, RestF} = {begin <<Res:32/signed-native>> = <<(X bsl N + Acc):32/unsigned-native>>, id(Res, TrUserData) end, Rest},
dfp_read_field_def_RouteSummary(RestF, 0, 0, F, F@_1, F@_2, NewFValue, TrUserData).
skip_varint_RouteSummary(<<1:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> skip_varint_RouteSummary(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData);
skip_varint_RouteSummary(<<0:1, _:7, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_RouteSummary(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
skip_length_delimited_RouteSummary(<<1:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) when N < 57 -> skip_length_delimited_RouteSummary(Rest, N + 7, X bsl N + Acc, F, F@_1, F@_2, F@_3, TrUserData);
skip_length_delimited_RouteSummary(<<0:1, X:7, Rest/binary>>, N, Acc, F, F@_1, F@_2, F@_3, TrUserData) ->
Length = X bsl N + Acc,
<<_:Length/binary, Rest2/binary>> = Rest,
dfp_read_field_def_RouteSummary(Rest2, 0, 0, F, F@_1, F@_2, F@_3, TrUserData).
skip_group_RouteSummary(Bin, _, Z2, FNum, F@_1, F@_2, F@_3, TrUserData) ->
{_, Rest} = read_group(Bin, FNum),
dfp_read_field_def_RouteSummary(Rest, 0, Z2, FNum, F@_1, F@_2, F@_3, TrUserData).
skip_32_RouteSummary(<<_:32, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_RouteSummary(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
skip_64_RouteSummary(<<_:64, Rest/binary>>, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData) -> dfp_read_field_def_RouteSummary(Rest, Z1, Z2, F, F@_1, F@_2, F@_3, TrUserData).
read_group(Bin, FieldNum) ->
{NumBytes, EndTagLen} = read_gr_b(Bin, 0, 0, 0, 0, FieldNum),
<<Group:NumBytes/binary, _:EndTagLen/binary, Rest/binary>> = Bin,
{Group, Rest}.
%% Like skipping over fields, but record the total length,
%% Each field is <(FieldNum bsl 3) bor FieldType> ++ <FieldValue>
%% Record the length because varints may be non-optimally encoded.
%%
%% Groups can be nested, but assume the same FieldNum cannot be nested
%% because group field numbers are shared with the rest of the fields
%% numbers. Thus we can search just for an group-end with the same
%% field number.
%%
%% (The only time the same group field number could occur would
%% be in a nested sub message, but then it would be inside a
%% length-delimited entry, which we skip-read by length.)
read_gr_b(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen, FieldNum)
when N < (32-7) ->
read_gr_b(Tl, N+7, X bsl N + Acc, NumBytes, TagLen+1, FieldNum);
read_gr_b(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, TagLen,
FieldNum) ->
Key = X bsl N + Acc,
TagLen1 = TagLen + 1,
case {Key bsr 3, Key band 7} of
{FieldNum, 4} -> % 4 = group_end
{NumBytes, TagLen1};
{_, 0} -> % 0 = varint
read_gr_vi(Tl, 0, NumBytes + TagLen1, FieldNum);
{_, 1} -> % 1 = bits64
<<_:64, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 8, 0, FieldNum);
{_, 2} -> % 2 = length_delimited
read_gr_ld(Tl, 0, 0, NumBytes + TagLen1, FieldNum);
{_, 3} -> % 3 = group_start
read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum);
{_, 4} -> % 4 = group_end
read_gr_b(Tl, 0, 0, NumBytes + TagLen1, 0, FieldNum);
{_, 5} -> % 5 = bits32
<<_:32, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes + TagLen1 + 4, 0, FieldNum)
end.
read_gr_vi(<<1:1, _:7, Tl/binary>>, N, NumBytes, FieldNum)
when N < (64-7) ->
read_gr_vi(Tl, N+7, NumBytes+1, FieldNum);
read_gr_vi(<<0:1, _:7, Tl/binary>>, _, NumBytes, FieldNum) ->
read_gr_b(Tl, 0, 0, NumBytes+1, 0, FieldNum).
read_gr_ld(<<1:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum)
when N < (64-7) ->
read_gr_ld(Tl, N+7, X bsl N + Acc, NumBytes+1, FieldNum);
read_gr_ld(<<0:1, X:7, Tl/binary>>, N, Acc, NumBytes, FieldNum) ->
Len = X bsl N + Acc,
NumBytes1 = NumBytes + 1,
<<_:Len/binary, Tl2/binary>> = Tl,
read_gr_b(Tl2, 0, 0, NumBytes1 + Len, 0, FieldNum).
merge_msgs(Prev, New, MsgName) when is_atom(MsgName) -> merge_msgs(Prev, New, MsgName, []).
merge_msgs(Prev, New, MsgName, Opts) ->
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
'Point' -> merge_msg_Point(Prev, New, TrUserData);
'Rectangle' -> merge_msg_Rectangle(Prev, New, TrUserData);
'Feature' -> merge_msg_Feature(Prev, New, TrUserData);
'RouteNote' -> merge_msg_RouteNote(Prev, New, TrUserData);
'RouteSummary' -> merge_msg_RouteSummary(Prev, New, TrUserData)
end.
-compile({nowarn_unused_function,merge_msg_Point/3}).
merge_msg_Point(PMsg, NMsg, _) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{latitude := NFlatitude}} -> S1#{latitude => NFlatitude};
{#{latitude := PFlatitude}, _} -> S1#{latitude => PFlatitude};
_ -> S1
end,
case {PMsg, NMsg} of
{_, #{longitude := NFlongitude}} -> S2#{longitude => NFlongitude};
{#{longitude := PFlongitude}, _} -> S2#{longitude => PFlongitude};
_ -> S2
end.
-compile({nowarn_unused_function,merge_msg_Rectangle/3}).
merge_msg_Rectangle(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{#{lo := PFlo}, #{lo := NFlo}} -> S1#{lo => merge_msg_Point(PFlo, NFlo, TrUserData)};
{_, #{lo := NFlo}} -> S1#{lo => NFlo};
{#{lo := PFlo}, _} -> S1#{lo => PFlo};
{_, _} -> S1
end,
case {PMsg, NMsg} of
{#{hi := PFhi}, #{hi := NFhi}} -> S2#{hi => merge_msg_Point(PFhi, NFhi, TrUserData)};
{_, #{hi := NFhi}} -> S2#{hi => NFhi};
{#{hi := PFhi}, _} -> S2#{hi => PFhi};
{_, _} -> S2
end.
-compile({nowarn_unused_function,merge_msg_Feature/3}).
merge_msg_Feature(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{name := NFname}} -> S1#{name => NFname};
{#{name := PFname}, _} -> S1#{name => PFname};
_ -> S1
end,
case {PMsg, NMsg} of
{#{location := PFlocation}, #{location := NFlocation}} -> S2#{location => merge_msg_Point(PFlocation, NFlocation, TrUserData)};
{_, #{location := NFlocation}} -> S2#{location => NFlocation};
{#{location := PFlocation}, _} -> S2#{location => PFlocation};
{_, _} -> S2
end.
-compile({nowarn_unused_function,merge_msg_RouteNote/3}).
merge_msg_RouteNote(PMsg, NMsg, TrUserData) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{#{location := PFlocation}, #{location := NFlocation}} -> S1#{location => merge_msg_Point(PFlocation, NFlocation, TrUserData)};
{_, #{location := NFlocation}} -> S1#{location => NFlocation};
{#{location := PFlocation}, _} -> S1#{location => PFlocation};
{_, _} -> S1
end,
case {PMsg, NMsg} of
{_, #{message := NFmessage}} -> S2#{message => NFmessage};
{#{message := PFmessage}, _} -> S2#{message => PFmessage};
_ -> S2
end.
-compile({nowarn_unused_function,merge_msg_RouteSummary/3}).
merge_msg_RouteSummary(PMsg, NMsg, _) ->
S1 = #{},
S2 = case {PMsg, NMsg} of
{_, #{point_count := NFpoint_count}} -> S1#{point_count => NFpoint_count};
{#{point_count := PFpoint_count}, _} -> S1#{point_count => PFpoint_count};
_ -> S1
end,
S3 = case {PMsg, NMsg} of
{_, #{feature_count := NFfeature_count}} -> S2#{feature_count => NFfeature_count};
{#{feature_count := PFfeature_count}, _} -> S2#{feature_count => PFfeature_count};
_ -> S2
end,
case {PMsg, NMsg} of
{_, #{distance := NFdistance}} -> S3#{distance => NFdistance};
{#{distance := PFdistance}, _} -> S3#{distance => PFdistance};
_ -> S3
end.
verify_msg(Msg, MsgName) when is_atom(MsgName) -> verify_msg(Msg, MsgName, []).
verify_msg(Msg, MsgName, Opts) ->
TrUserData = proplists:get_value(user_data, Opts),
case MsgName of
'Point' -> v_msg_Point(Msg, [MsgName], TrUserData);
'Rectangle' -> v_msg_Rectangle(Msg, [MsgName], TrUserData);
'Feature' -> v_msg_Feature(Msg, [MsgName], TrUserData);
'RouteNote' -> v_msg_RouteNote(Msg, [MsgName], TrUserData);
'RouteSummary' -> v_msg_RouteSummary(Msg, [MsgName], TrUserData);
_ -> mk_type_error(not_a_known_message, Msg, [])
end.
-compile({nowarn_unused_function,v_submsg_Point/3}).
-dialyzer({nowarn_function,v_submsg_Point/3}).
v_submsg_Point(Msg, Path, TrUserData) -> v_msg_Point(Msg, Path, TrUserData).
-compile({nowarn_unused_function,v_msg_Point/3}).
-dialyzer({nowarn_function,v_msg_Point/3}).
v_msg_Point(#{} = M, Path, TrUserData) ->
case M of
#{latitude := F1} -> v_type_int32(F1, [latitude | Path], TrUserData);
_ -> ok
end,
case M of
#{longitude := F2} -> v_type_int32(F2, [longitude | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (latitude) -> ok;
(longitude) -> ok;
(OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_Point(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), 'Point'}, M, Path);
v_msg_Point(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Point'}, X, Path).
-compile({nowarn_unused_function,v_msg_Rectangle/3}).
-dialyzer({nowarn_function,v_msg_Rectangle/3}).
v_msg_Rectangle(#{} = M, Path, TrUserData) ->
case M of
#{lo := F1} -> v_submsg_Point(F1, [lo | Path], TrUserData);
_ -> ok
end,
case M of
#{hi := F2} -> v_submsg_Point(F2, [hi | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (lo) -> ok;
(hi) -> ok;
(OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_Rectangle(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), 'Rectangle'}, M, Path);
v_msg_Rectangle(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Rectangle'}, X, Path).
-compile({nowarn_unused_function,v_msg_Feature/3}).
-dialyzer({nowarn_function,v_msg_Feature/3}).
v_msg_Feature(#{} = M, Path, TrUserData) ->
case M of
#{name := F1} -> v_type_string(F1, [name | Path], TrUserData);
_ -> ok
end,
case M of
#{location := F2} -> v_submsg_Point(F2, [location | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (name) -> ok;
(location) -> ok;
(OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_Feature(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), 'Feature'}, M, Path);
v_msg_Feature(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'Feature'}, X, Path).
-compile({nowarn_unused_function,v_msg_RouteNote/3}).
-dialyzer({nowarn_function,v_msg_RouteNote/3}).
v_msg_RouteNote(#{} = M, Path, TrUserData) ->
case M of
#{location := F1} -> v_submsg_Point(F1, [location | Path], TrUserData);
_ -> ok
end,
case M of
#{message := F2} -> v_type_string(F2, [message | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (location) -> ok;
(message) -> ok;
(OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_RouteNote(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), 'RouteNote'}, M, Path);
v_msg_RouteNote(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'RouteNote'}, X, Path).
-compile({nowarn_unused_function,v_msg_RouteSummary/3}).
-dialyzer({nowarn_function,v_msg_RouteSummary/3}).
v_msg_RouteSummary(#{} = M, Path, TrUserData) ->
case M of
#{point_count := F1} -> v_type_int32(F1, [point_count | Path], TrUserData);
_ -> ok
end,
case M of
#{feature_count := F2} -> v_type_int32(F2, [feature_count | Path], TrUserData);
_ -> ok
end,
case M of
#{distance := F3} -> v_type_int32(F3, [distance | Path], TrUserData);
_ -> ok
end,
lists:foreach(fun (point_count) -> ok;
(feature_count) -> ok;
(distance) -> ok;
(OtherKey) -> mk_type_error({extraneous_key, OtherKey}, M, Path)
end,
maps:keys(M)),
ok;
v_msg_RouteSummary(M, Path, _TrUserData) when is_map(M) -> mk_type_error({missing_fields, [] -- maps:keys(M), 'RouteSummary'}, M, Path);
v_msg_RouteSummary(X, Path, _TrUserData) -> mk_type_error({expected_msg, 'RouteSummary'}, X, Path).
-compile({nowarn_unused_function,v_type_int32/3}).
-dialyzer({nowarn_function,v_type_int32/3}).
v_type_int32(N, _Path, _TrUserData) when is_integer(N), -2147483648 =< N, N =< 2147483647 -> ok;
v_type_int32(N, Path, _TrUserData) when is_integer(N) -> mk_type_error({value_out_of_range, int32, signed, 32}, N, Path);
v_type_int32(X, Path, _TrUserData) -> mk_type_error({bad_integer, int32, signed, 32}, X, Path).
-compile({nowarn_unused_function,v_type_string/3}).
-dialyzer({nowarn_function,v_type_string/3}).
v_type_string(S, Path, _TrUserData) when is_list(S); is_binary(S) ->
try unicode:characters_to_binary(S) of
B when is_binary(B) -> ok;
{error, _, _} -> mk_type_error(bad_unicode_string, S, Path)
catch
error:badarg -> mk_type_error(bad_unicode_string, S, Path)
end;
v_type_string(X, Path, _TrUserData) -> mk_type_error(bad_unicode_string, X, Path).
-compile({nowarn_unused_function,mk_type_error/3}).
-spec mk_type_error(_, _, list()) -> no_return().
mk_type_error(Error, ValueSeen, Path) ->
Path2 = prettify_path(Path),
erlang:error({gpb_type_error, {Error, [{value, ValueSeen}, {path, Path2}]}}).
-compile({nowarn_unused_function,prettify_path/1}).
-dialyzer({nowarn_function,prettify_path/1}).
prettify_path([]) -> top_level;
prettify_path(PathR) -> lists:append(lists:join(".", lists:map(fun atom_to_list/1, lists:reverse(PathR)))).
-compile({nowarn_unused_function,id/2}).
-compile({inline,id/2}).
id(X, _TrUserData) -> X.
-compile({nowarn_unused_function,v_ok/3}).
-compile({inline,v_ok/3}).
v_ok(_Value, _Path, _TrUserData) -> ok.
-compile({nowarn_unused_function,m_overwrite/3}).
-compile({inline,m_overwrite/3}).
m_overwrite(_Prev, New, _TrUserData) -> New.
-compile({nowarn_unused_function,cons/3}).
-compile({inline,cons/3}).
cons(Elem, Acc, _TrUserData) -> [Elem | Acc].
-compile({nowarn_unused_function,lists_reverse/2}).
-compile({inline,lists_reverse/2}).
'lists_reverse'(L, _TrUserData) -> lists:reverse(L).
-compile({nowarn_unused_function,'erlang_++'/3}).
-compile({inline,'erlang_++'/3}).
'erlang_++'(A, B, _TrUserData) -> A ++ B.
get_msg_defs() ->
[{{msg, 'Point'}, [#{name => latitude, fnum => 1, rnum => 2, type => int32, occurrence => optional, opts => []}, #{name => longitude, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}]},
{{msg, 'Rectangle'}, [#{name => lo, fnum => 1, rnum => 2, type => {msg, 'Point'}, occurrence => optional, opts => []}, #{name => hi, fnum => 2, rnum => 3, type => {msg, 'Point'}, occurrence => optional, opts => []}]},
{{msg, 'Feature'}, [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => location, fnum => 2, rnum => 3, type => {msg, 'Point'}, occurrence => optional, opts => []}]},
{{msg, 'RouteNote'}, [#{name => location, fnum => 1, rnum => 2, type => {msg, 'Point'}, occurrence => optional, opts => []}, #{name => message, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}]},
{{msg, 'RouteSummary'},
[#{name => point_count, fnum => 1, rnum => 2, type => int32, occurrence => optional, opts => []},
#{name => feature_count, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []},
#{name => distance, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}]}].
get_msg_names() -> ['Point', 'Rectangle', 'Feature', 'RouteNote', 'RouteSummary'].
get_group_names() -> [].
get_msg_or_group_names() -> ['Point', 'Rectangle', 'Feature', 'RouteNote', 'RouteSummary'].
get_enum_names() -> [].
fetch_msg_def(MsgName) ->
case find_msg_def(MsgName) of
Fs when is_list(Fs) -> Fs;
error -> erlang:error({no_such_msg, MsgName})
end.
-spec fetch_enum_def(_) -> no_return().
fetch_enum_def(EnumName) -> erlang:error({no_such_enum, EnumName}).
find_msg_def('Point') -> [#{name => latitude, fnum => 1, rnum => 2, type => int32, occurrence => optional, opts => []}, #{name => longitude, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []}];
find_msg_def('Rectangle') -> [#{name => lo, fnum => 1, rnum => 2, type => {msg, 'Point'}, occurrence => optional, opts => []}, #{name => hi, fnum => 2, rnum => 3, type => {msg, 'Point'}, occurrence => optional, opts => []}];
find_msg_def('Feature') -> [#{name => name, fnum => 1, rnum => 2, type => string, occurrence => optional, opts => []}, #{name => location, fnum => 2, rnum => 3, type => {msg, 'Point'}, occurrence => optional, opts => []}];
find_msg_def('RouteNote') -> [#{name => location, fnum => 1, rnum => 2, type => {msg, 'Point'}, occurrence => optional, opts => []}, #{name => message, fnum => 2, rnum => 3, type => string, occurrence => optional, opts => []}];
find_msg_def('RouteSummary') ->
[#{name => point_count, fnum => 1, rnum => 2, type => int32, occurrence => optional, opts => []},
#{name => feature_count, fnum => 2, rnum => 3, type => int32, occurrence => optional, opts => []},
#{name => distance, fnum => 3, rnum => 4, type => int32, occurrence => optional, opts => []}];
find_msg_def(_) -> error.
find_enum_def(_) -> error.
-spec enum_symbol_by_value(_, _) -> no_return().
enum_symbol_by_value(E, V) -> erlang:error({no_enum_defs, E, V}).
-spec enum_value_by_symbol(_, _) -> no_return().
enum_value_by_symbol(E, V) -> erlang:error({no_enum_defs, E, V}).
get_service_names() -> ['RouteGuide'].
get_service_def('RouteGuide') ->
{{service, 'RouteGuide'},
[#{name => 'GetFeature', input => 'Point', output => 'Feature', input_stream => false, output_stream => false, opts => []},
#{name => 'ListFeatures', input => 'Rectangle', output => 'Feature', input_stream => false, output_stream => true, opts => []},
#{name => 'RecordRoute', input => 'Point', output => 'RouteSummary', input_stream => true, output_stream => false, opts => []},
#{name => 'RouteChat', input => 'RouteNote', output => 'RouteNote', input_stream => true, output_stream => true, opts => []}]};
get_service_def(_) -> error.
get_rpc_names('RouteGuide') -> ['GetFeature', 'ListFeatures', 'RecordRoute', 'RouteChat'];
get_rpc_names(_) -> error.
find_rpc_def('RouteGuide', RpcName) -> find_rpc_def_RouteGuide(RpcName);
find_rpc_def(_, _) -> error.
find_rpc_def_RouteGuide('GetFeature') -> #{name => 'GetFeature', input => 'Point', output => 'Feature', input_stream => false, output_stream => false, opts => []};
find_rpc_def_RouteGuide('ListFeatures') -> #{name => 'ListFeatures', input => 'Rectangle', output => 'Feature', input_stream => false, output_stream => true, opts => []};
find_rpc_def_RouteGuide('RecordRoute') -> #{name => 'RecordRoute', input => 'Point', output => 'RouteSummary', input_stream => true, output_stream => false, opts => []};
find_rpc_def_RouteGuide('RouteChat') -> #{name => 'RouteChat', input => 'RouteNote', output => 'RouteNote', input_stream => true, output_stream => true, opts => []};
find_rpc_def_RouteGuide(_) -> error.
fetch_rpc_def(ServiceName, RpcName) ->
case find_rpc_def(ServiceName, RpcName) of
Def when is_map(Def) -> Def;
error -> erlang:error({no_such_rpc, ServiceName, RpcName})
end.
%% Convert a a fully qualified (ie with package name) service name
%% as a binary to a service name as an atom.
fqbin_to_service_name(<<"routeguide.RouteGuide">>) -> 'RouteGuide';
fqbin_to_service_name(X) -> error({gpb_error, {badservice, X}}).
%% Convert a service name as an atom to a fully qualified
%% (ie with package name) name as a binary.
service_name_to_fqbin('RouteGuide') -> <<"routeguide.RouteGuide">>;
service_name_to_fqbin(X) -> error({gpb_error, {badservice, X}}).
%% Convert a a fully qualified (ie with package name) service name
%% and an rpc name, both as binaries to a service name and an rpc
%% name, as atoms.
fqbins_to_service_and_rpc_name(<<"routeguide.RouteGuide">>, <<"GetFeature">>) -> {'RouteGuide', 'GetFeature'};
fqbins_to_service_and_rpc_name(<<"routeguide.RouteGuide">>, <<"ListFeatures">>) -> {'RouteGuide', 'ListFeatures'};
fqbins_to_service_and_rpc_name(<<"routeguide.RouteGuide">>, <<"RecordRoute">>) -> {'RouteGuide', 'RecordRoute'};
fqbins_to_service_and_rpc_name(<<"routeguide.RouteGuide">>, <<"RouteChat">>) -> {'RouteGuide', 'RouteChat'};
fqbins_to_service_and_rpc_name(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}).
%% Convert a service name and an rpc name, both as atoms,
%% to a fully qualified (ie with package name) service name and
%% an rpc name as binaries.
service_and_rpc_name_to_fqbins('RouteGuide', 'GetFeature') -> {<<"routeguide.RouteGuide">>, <<"GetFeature">>};
service_and_rpc_name_to_fqbins('RouteGuide', 'ListFeatures') -> {<<"routeguide.RouteGuide">>, <<"ListFeatures">>};
service_and_rpc_name_to_fqbins('RouteGuide', 'RecordRoute') -> {<<"routeguide.RouteGuide">>, <<"RecordRoute">>};
service_and_rpc_name_to_fqbins('RouteGuide', 'RouteChat') -> {<<"routeguide.RouteGuide">>, <<"RouteChat">>};
service_and_rpc_name_to_fqbins(S, R) -> error({gpb_error, {badservice_or_rpc, {S, R}}}).
fqbin_to_msg_name(<<"routeguide.Point">>) -> 'Point';
fqbin_to_msg_name(<<"routeguide.Rectangle">>) -> 'Rectangle';
fqbin_to_msg_name(<<"routeguide.Feature">>) -> 'Feature';
fqbin_to_msg_name(<<"routeguide.RouteNote">>) -> 'RouteNote';
fqbin_to_msg_name(<<"routeguide.RouteSummary">>) -> 'RouteSummary';
fqbin_to_msg_name(E) -> error({gpb_error, {badmsg, E}}).
msg_name_to_fqbin('Point') -> <<"routeguide.Point">>;
msg_name_to_fqbin('Rectangle') -> <<"routeguide.Rectangle">>;
msg_name_to_fqbin('Feature') -> <<"routeguide.Feature">>;
msg_name_to_fqbin('RouteNote') -> <<"routeguide.RouteNote">>;
msg_name_to_fqbin('RouteSummary') -> <<"routeguide.RouteSummary">>;
msg_name_to_fqbin(E) -> error({gpb_error, {badmsg, E}}).
-spec fqbin_to_enum_name(_) -> no_return().
fqbin_to_enum_name(E) -> error({gpb_error, {badenum, E}}).
-spec enum_name_to_fqbin(_) -> no_return().
enum_name_to_fqbin(E) -> error({gpb_error, {badenum, E}}).
get_package_name() -> routeguide.
%% Whether or not the message names
%% are prepended with package name or not.
uses_packages() -> false.
source_basename() -> "route_guide.proto".
%% Retrieve all proto file names, also imported ones.
%% The order is top-down. The first element is always the main
%% source file. The files are returned with extension,
%% see get_all_proto_names/0 for a version that returns
%% the basenames sans extension
get_all_source_basenames() -> ["route_guide.proto"].
%% Retrieve all proto file names, also imported ones.
%% The order is top-down. The first element is always the main
%% source file. The files are returned sans .proto extension,
%% to make it easier to use them with the various get_xyz_containment
%% functions.
get_all_proto_names() -> ["route_guide"].
get_msg_containment("route_guide") -> ['Feature', 'Point', 'Rectangle', 'RouteNote', 'RouteSummary'];
get_msg_containment(P) -> error({gpb_error, {badproto, P}}).
get_pkg_containment("route_guide") -> undefined;
get_pkg_containment(P) -> error({gpb_error, {badproto, P}}).
get_service_containment("route_guide") -> ['RouteGuide'];
get_service_containment(P) -> error({gpb_error, {badproto, P}}).
get_rpc_containment("route_guide") -> [{'RouteGuide', 'GetFeature'}, {'RouteGuide', 'ListFeatures'}, {'RouteGuide', 'RecordRoute'}, {'RouteGuide', 'RouteChat'}];
get_rpc_containment(P) -> error({gpb_error, {badproto, P}}).
get_enum_containment("route_guide") -> [];
get_enum_containment(P) -> error({gpb_error, {badproto, P}}).
get_proto_by_msg_name_as_fqbin(<<"routeguide.Point">>) -> "route_guide";
get_proto_by_msg_name_as_fqbin(<<"routeguide.Rectangle">>) -> "route_guide";
get_proto_by_msg_name_as_fqbin(<<"routeguide.Feature">>) -> "route_guide";
get_proto_by_msg_name_as_fqbin(<<"routeguide.RouteNote">>) -> "route_guide";
get_proto_by_msg_name_as_fqbin(<<"routeguide.RouteSummary">>) -> "route_guide";
get_proto_by_msg_name_as_fqbin(E) -> error({gpb_error, {badmsg, E}}).
get_proto_by_service_name_as_fqbin(<<"routeguide.RouteGuide">>) -> "route_guide";
get_proto_by_service_name_as_fqbin(E) -> error({gpb_error, {badservice, E}}).
-spec get_proto_by_enum_name_as_fqbin(_) -> no_return().
get_proto_by_enum_name_as_fqbin(E) -> error({gpb_error, {badenum, E}}).
-spec get_protos_by_pkg_name_as_fqbin(_) -> no_return().
get_protos_by_pkg_name_as_fqbin(E) -> error({gpb_error, {badpkg, E}}).
descriptor() ->
<<10, 130, 5, 10, 28, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 47, 114, 111, 117, 116, 101, 95, 103, 117, 105, 100, 101, 46, 112, 114, 111, 116, 111, 18, 10, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 34, 60, 10, 7, 70, 101, 97, 116,
117, 114, 101, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 35, 10, 8, 108, 111, 99, 97, 116, 105, 111, 110, 24, 2, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 34, 44, 10, 5,
80, 111, 105, 110, 116, 18, 16, 10, 8, 108, 97, 116, 105, 116, 117, 100, 101, 24, 1, 32, 1, 40, 5, 18, 17, 10, 9, 108, 111, 110, 103, 105, 116, 117, 100, 101, 24, 2, 32, 1, 40, 5, 34, 73, 10, 9, 82, 101, 99, 116, 97, 110, 103, 108, 101, 18, 29, 10,
2, 108, 111, 24, 1, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 18, 29, 10, 2, 104, 105, 24, 2, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111,
105, 110, 116, 34, 65, 10, 9, 82, 111, 117, 116, 101, 78, 111, 116, 101, 18, 35, 10, 8, 108, 111, 99, 97, 116, 105, 111, 110, 24, 1, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 18, 15, 10,
7, 109, 101, 115, 115, 97, 103, 101, 24, 2, 32, 1, 40, 9, 34, 76, 10, 12, 82, 111, 117, 116, 101, 83, 117, 109, 109, 97, 114, 121, 18, 19, 10, 11, 112, 111, 105, 110, 116, 95, 99, 111, 117, 110, 116, 24, 1, 32, 1, 40, 5, 18, 21, 10, 13, 102, 101, 97,
116, 117, 114, 101, 95, 99, 111, 117, 110, 116, 24, 2, 32, 1, 40, 5, 18, 16, 10, 8, 100, 105, 115, 116, 97, 110, 99, 101, 24, 3, 32, 1, 40, 5, 50, 133, 2, 10, 10, 82, 111, 117, 116, 101, 71, 117, 105, 100, 101, 18, 56, 10, 10, 71, 101, 116, 70, 101,
97, 116, 117, 114, 101, 18, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 26, 19, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 70, 101, 97, 116, 117, 114, 101, 40, 0, 48, 0, 18, 62, 10, 12, 76,
105, 115, 116, 70, 101, 97, 116, 117, 114, 101, 115, 18, 21, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 101, 99, 116, 97, 110, 103, 108, 101, 26, 19, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 70, 101, 97, 116, 117,
114, 101, 40, 0, 48, 1, 18, 62, 10, 11, 82, 101, 99, 111, 114, 100, 82, 111, 117, 116, 101, 18, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 26, 24, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46,
82, 111, 117, 116, 101, 83, 117, 109, 109, 97, 114, 121, 40, 1, 48, 0, 18, 61, 10, 9, 82, 111, 117, 116, 101, 67, 104, 97, 116, 18, 21, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 78, 111, 116, 101, 26, 21, 46,
114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 78, 111, 116, 101, 40, 1, 48, 1, 98, 6, 112, 114, 111, 116, 111, 51>>.
descriptor("route_guide") ->
<<10, 28, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 47, 114, 111, 117, 116, 101, 95, 103, 117, 105, 100, 101, 46, 112, 114, 111, 116, 111, 18, 10, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 34, 60, 10, 7, 70, 101, 97, 116, 117, 114,
101, 18, 12, 10, 4, 110, 97, 109, 101, 24, 1, 32, 1, 40, 9, 18, 35, 10, 8, 108, 111, 99, 97, 116, 105, 111, 110, 24, 2, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 34, 44, 10, 5, 80, 111,
105, 110, 116, 18, 16, 10, 8, 108, 97, 116, 105, 116, 117, 100, 101, 24, 1, 32, 1, 40, 5, 18, 17, 10, 9, 108, 111, 110, 103, 105, 116, 117, 100, 101, 24, 2, 32, 1, 40, 5, 34, 73, 10, 9, 82, 101, 99, 116, 97, 110, 103, 108, 101, 18, 29, 10, 2, 108,
111, 24, 1, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 18, 29, 10, 2, 104, 105, 24, 2, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110,
116, 34, 65, 10, 9, 82, 111, 117, 116, 101, 78, 111, 116, 101, 18, 35, 10, 8, 108, 111, 99, 97, 116, 105, 111, 110, 24, 1, 32, 1, 40, 11, 50, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 18, 15, 10, 7, 109,
101, 115, 115, 97, 103, 101, 24, 2, 32, 1, 40, 9, 34, 76, 10, 12, 82, 111, 117, 116, 101, 83, 117, 109, 109, 97, 114, 121, 18, 19, 10, 11, 112, 111, 105, 110, 116, 95, 99, 111, 117, 110, 116, 24, 1, 32, 1, 40, 5, 18, 21, 10, 13, 102, 101, 97, 116,
117, 114, 101, 95, 99, 111, 117, 110, 116, 24, 2, 32, 1, 40, 5, 18, 16, 10, 8, 100, 105, 115, 116, 97, 110, 99, 101, 24, 3, 32, 1, 40, 5, 50, 133, 2, 10, 10, 82, 111, 117, 116, 101, 71, 117, 105, 100, 101, 18, 56, 10, 10, 71, 101, 116, 70, 101, 97,
116, 117, 114, 101, 18, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 26, 19, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 70, 101, 97, 116, 117, 114, 101, 40, 0, 48, 0, 18, 62, 10, 12, 76, 105,
115, 116, 70, 101, 97, 116, 117, 114, 101, 115, 18, 21, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 101, 99, 116, 97, 110, 103, 108, 101, 26, 19, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 70, 101, 97, 116, 117, 114,
101, 40, 0, 48, 1, 18, 62, 10, 11, 82, 101, 99, 111, 114, 100, 82, 111, 117, 116, 101, 18, 17, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 80, 111, 105, 110, 116, 26, 24, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82,
111, 117, 116, 101, 83, 117, 109, 109, 97, 114, 121, 40, 1, 48, 0, 18, 61, 10, 9, 82, 111, 117, 116, 101, 67, 104, 97, 116, 18, 21, 46, 114, 111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 78, 111, 116, 101, 26, 21, 46, 114,
111, 117, 116, 101, 103, 117, 105, 100, 101, 46, 82, 111, 117, 116, 101, 78, 111, 116, 101, 40, 1, 48, 1, 98, 6, 112, 114, 111, 116, 111, 51>>;
descriptor(X) -> error({gpb_error, {badname, X}}).
gpb_version_as_string() ->
"5.0.0".
gpb_version_as_list() ->
[5,0,0].
gpb_version_source() ->
"file".