Avro C++
api
Layout.hh
Go to the documentation of this file.
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_Layout_hh__
20
#define avro_Layout_hh__
21
22
#include "Config.hh"
23
#include <boost/noncopyable.hpp>
24
27
28
namespace
avro
{
29
30
class
AVRO_DECL
Layout
:
private
boost::noncopyable {
31
protected
:
32
explicit
Layout
(
size_t
offset = 0) : offset_(offset) {}
33
34
public
:
35
size_t
offset()
const
{
36
return
offset_;
37
}
38
virtual
~
Layout
() =
default
;
39
40
private
:
41
const
size_t
offset_;
42
};
43
44
class
AVRO_DECL
PrimitiveLayout
:
public
Layout
{
45
public
:
46
explicit
PrimitiveLayout
(
size_t
offset = 0) :
Layout
(offset) {}
47
};
48
49
class
AVRO_DECL
CompoundLayout
:
public
Layout
{
50
51
public
:
52
explicit
CompoundLayout
(
size_t
offset = 0) :
Layout
(offset) {}
53
54
void
add(std::unique_ptr<Layout> &layout) {
55
layouts_.push_back(std::move(layout));
56
}
57
58
const
Layout
&at(
size_t
idx)
const
{
59
return
*layouts_.at(idx);
60
}
61
62
private
:
63
std::vector<std::unique_ptr<Layout>> layouts_;
64
};
65
66
}
// namespace avro
67
68
#endif
avro::CompoundLayout
Definition:
Layout.hh:49
avro
A bunch of templates and specializations for encoding and decoding specific types.
Definition:
AvroParse.hh:30
avro::PrimitiveLayout
Definition:
Layout.hh:44
avro::Layout
Definition:
Layout.hh:30
Generated by
1.8.17