Avro C++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
Types.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  * 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_Types_hh__
20 #define avro_Types_hh__
21 
22 #include <iostream>
23 
24 #include "Config.hh"
25 
26 namespace avro {
27 
31 enum Type {
32 
51  // The following is a pseudo-type used in implementation
52 
56 };
57 
63 inline bool isPrimitive(Type t) {
64  return (t >= AVRO_STRING) && (t < AVRO_RECORD);
65 }
66 
72 inline bool isCompound(Type t) {
73  return (t>= AVRO_RECORD) && (t < AVRO_NUM_TYPES);
74 }
75 
79 inline bool isAvroType(Type t) {
80  return (t >= AVRO_STRING) && (t < AVRO_NUM_TYPES);
81 }
82 
87 inline bool isAvroTypeOrPseudoType(Type t) {
88  return (t >= AVRO_STRING) && (t <= AVRO_NUM_TYPES);
89 }
90 
94 AVRO_DECL const std::string& toString(Type type);
95 
99 AVRO_DECL std::ostream &operator<< (std::ostream &os, avro::Type type);
100 
102 struct AVRO_DECL Null { };
103 
109 std::ostream& operator<< (std::ostream &os, const Null &null);
110 
111 } // namespace avro
112 
113 
114 #endif
Definition: Types.hh:37
Definition: Types.hh:45
bool isAvroTypeOrPseudoType(Type t)
Returns true if and only if the given type is within the valid range of enumeration.
Definition: Types.hh:87
Definition: Types.hh:40
Type
The "type" for the schema.
Definition: Types.hh:31
Definition: Types.hh:49
A bunch of templates and specializations for encoding and decoding specific types.
Definition: AvroParse.hh:31
Definition: Types.hh:43
bool isAvroType(Type t)
Returns true if and only if the given type is a valid avro type.
Definition: Types.hh:79
Definition: Types.hh:39
Definition: Types.hh:33
Definition: Types.hh:44
Definition: Types.hh:35
Definition: Types.hh:47
Definition: Types.hh:34
Definition: Types.hh:38
define a type to identify Null in template functions
Definition: Types.hh:102
bool isPrimitive(Type t)
Returns true if and only if the given type is a primitive.
Definition: Types.hh:63
Definition: Types.hh:54
Definition: Types.hh:42
Definition: Types.hh:46
AVRO_DECL const std::string & toString(Type type)
Converts the given type into a string.
bool isCompound(Type t)
Returns true if and only if the given type is a non primitive valid type.
Definition: Types.hh:72
Definition: Types.hh:36
Definition: Types.hh:53