Avro C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Schema.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_Schema_hh__
20 #define avro_Schema_hh__
21 
22 #include "Config.hh"
23 #include "NodeImpl.hh"
24 
30 
31 namespace avro {
32 
33 
35 
36 class AVRO_DECL Schema {
37 public:
38 
39  virtual ~Schema();
40 
41  Type type() const {
42  return node_->type();
43  }
44 
45  const NodePtr &root() const {
46  return node_;
47  }
48 
49  NodePtr &root() {
50  return node_;
51  }
52 
53  protected:
54  Schema();
55  explicit Schema(const NodePtr &node);
56  explicit Schema(Node *node);
57 
58  NodePtr node_;
59 };
60 
61 class AVRO_DECL NullSchema : public Schema {
62 public:
64 };
65 
66 class AVRO_DECL BoolSchema : public Schema {
67 public:
69 };
70 
71 class AVRO_DECL IntSchema : public Schema {
72 public:
74 };
75 
76 class AVRO_DECL LongSchema : public Schema {
77 public:
79 };
80 
81 class AVRO_DECL FloatSchema : public Schema {
82 public:
84 };
85 
86 class AVRO_DECL DoubleSchema : public Schema {
87 public:
89 };
90 
91 class AVRO_DECL StringSchema : public Schema {
92 public:
94 };
95 
96 class AVRO_DECL BytesSchema : public Schema {
97 public:
99 };
100 
101 class AVRO_DECL RecordSchema : public Schema {
102 public:
103  RecordSchema(const std::string &name);
104  void addField(const std::string &name, const Schema &fieldSchema);
105 };
106 
107 class AVRO_DECL EnumSchema : public Schema {
108 public:
109  EnumSchema(const std::string &name);
110  void addSymbol(const std::string &symbol);
111 };
112 
113 class AVRO_DECL ArraySchema : public Schema {
114 public:
115  ArraySchema(const Schema &itemsSchema);
116 };
117 
118 class AVRO_DECL MapSchema : public Schema {
119 public:
120  MapSchema(const Schema &valuesSchema);
121 };
122 
123 class AVRO_DECL UnionSchema : public Schema {
124 public:
125  UnionSchema();
126  void addType(const Schema &typeSchema);
127 };
128 
129 class AVRO_DECL FixedSchema : public Schema {
130 public:
131  FixedSchema(int size, const std::string &name);
132 };
133 
134 class AVRO_DECL SymbolicSchema : public Schema {
135 public:
136  SymbolicSchema(const Name& name, const NodePtr& link);
137 };
138 } // namespace avro
139 
140 #endif
Definition: Schema.hh:101
Node is the building block for parse trees.
Definition: Node.hh:88
Definition: Types.hh:37
Definition: Schema.hh:86
Definition: Node.hh:39
Definition: Schema.hh:81
Definition: Types.hh:40
Type
The "type" for the schema.
Definition: Types.hh:31
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
Definition: Schema.hh:129
The root Schema object is a base class. Nobody constructs this class directly.
Definition: Schema.hh:36
Definition: Types.hh:39
Definition: Types.hh:33
Definition: NodeImpl.hh:201
Definition: Schema.hh:71
Definition: Types.hh:35
Definition: Types.hh:34
Definition: Types.hh:38
Definition: Schema.hh:96
Definition: Schema.hh:66
Definition: Schema.hh:113
Definition: Schema.hh:107
Definition: Schema.hh:76
Definition: Schema.hh:91
Definition: Schema.hh:118
Definition: Schema.hh:61
Definition: Types.hh:36
Definition: Schema.hh:134
Definition: Schema.hh:123