Avro C++
api
LogicalType.hh
1
/*
2
* Licensed to the Apache Software Foundation (ASF) under one
3
* or more contributor license agreements. See the NOTICE file
4
* distributed with this work for additional information
5
* regarding copyright ownership. The ASF licenses this file
6
* to you under the Apache License, Version 2.0 (the
7
* "License"); you may not use this file except in compliance
8
* with the License. You may obtain a copy of the License at
9
*
10
* https://www.apache.org/licenses/LICENSE-2.0
11
*
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an "AS IS" BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
17
*/
18
19
#ifndef avro_LogicalType_hh__
20
#define avro_LogicalType_hh__
21
22
#include <iostream>
23
24
#include "Config.hh"
25
26
namespace
avro
{
27
28
class
AVRO_DECL
LogicalType
{
29
public
:
30
enum
Type {
31
NONE,
32
DECIMAL,
33
DATE,
34
TIME_MILLIS,
35
TIME_MICROS,
36
TIMESTAMP_MILLIS,
37
TIMESTAMP_MICROS,
38
DURATION
39
};
40
41
explicit
LogicalType
(Type type);
42
43
Type type()
const
;
44
45
// Precision and scale can only be set for the DECIMAL logical type.
46
// Precision must be positive and scale must be either positive or zero. The
47
// setters will throw an exception if they are called on any type other
48
// than DECIMAL.
49
void
setPrecision(
int
precision);
50
int
precision()
const
{
return
precision_; }
51
void
setScale(
int
scale);
52
int
scale()
const
{
return
scale_; }
53
54
void
printJson(std::ostream& os)
const
;
55
56
private
:
57
Type type_;
58
int
precision_;
59
int
scale_;
60
};
61
62
}
// namespace avro
63
64
#endif
avro
A bunch of templates and specializations for encoding and decoding specific types.
Definition:
AvroParse.hh:30
avro::LogicalType
Definition:
LogicalType.hh:28
Generated by
1.8.13