Avro C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
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  * http://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 <boost/noncopyable.hpp>
23 #include "Config.hh"
24 #include "Boost.hh"
25 
28 
29 namespace avro {
30 
31 class AVRO_DECL Layout : private boost::noncopyable {
32 
33  protected:
34 
35  Layout(size_t offset = 0) :
36  offset_(offset)
37  {}
38 
39  public:
40 
41  size_t offset() const {
42  return offset_;
43  }
44 
45  virtual ~Layout() {}
46 
47  private:
48 
49  const size_t offset_;
50 };
51 
52 class AVRO_DECL PrimitiveLayout : public Layout {
53 
54  public:
55 
56  PrimitiveLayout(size_t offset = 0) :
57  Layout(offset)
58  {}
59 };
60 
61 class AVRO_DECL CompoundLayout : public Layout {
62 
63  public:
64 
65  CompoundLayout(size_t offset = 0) :
66  Layout(offset)
67  {}
68 
69  void add(Layout *layout) {
70  layouts_.push_back(layout);
71  }
72 
73  const Layout &at (size_t idx) const {
74  return layouts_.at(idx);
75  }
76 
77  private:
78 
80 };
81 
82 } // namespace avro
83 
84 #endif
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
Definition: Layout.hh:61
Definition: Layout.hh:31
Definition: Layout.hh:52
Definition: Boost.hh:68