blob: 66ea61f6488cf6c9cb112215d1e863ed9f9ddd96 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
#pragma once
#include "type_builder.h"
#include "proto_builder.h"
#include <yql/essentials/public/udf/udf_value.h>
#include <google/protobuf/message.h>
namespace NYql::NUdf {
class IProtobufParser {
public:
virtual ~IProtobufParser();
virtual TAutoPtr<NProtoBuf::Message> Parse(const TStringBuf& data) const = 0;
};
class TProtobufValue: public TBoxedValue, public IProtobufParser {
public:
explicit TProtobufValue(TProtoInfo info);
~TProtobufValue() override;
TUnboxedValue Run(
const IValueBuilder* valueBuilder,
const TUnboxedValuePod* args) const override;
protected:
const TProtoInfo Info_;
};
class IProtobufSerialize {
public:
virtual ~IProtobufSerialize();
virtual TMaybe<TString> Serialize(const NProtoBuf::Message& proto) const = 0;
virtual TAutoPtr<NProtoBuf::Message> MakeProto() const = 0;
};
class TProtobufSerialize: public TBoxedValue, public IProtobufSerialize {
public:
explicit TProtobufSerialize(TProtoInfo info);
~TProtobufSerialize() override;
TUnboxedValue Run(
const IValueBuilder* valueBuilder,
const TUnboxedValuePod* args) const override;
protected:
const TProtoInfo Info_;
};
TUnboxedValue FillValueFromProto(
const NProtoBuf::Message& proto,
const IValueBuilder* valueBuilder,
const TProtoInfo& info);
} // namespace NYql::NUdf
|