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 20 #ifndef IMAGINARY_HH_3460301992__H_ 21 #define IMAGINARY_HH_3460301992__H_ 22 23 24 #include "boost/any.hpp" 25 #include "avro/Specific.hh" 26 #include "avro/Encoder.hh" 27 #include "avro/Decoder.hh" 28 29 namespace i { 30 struct cpx { 31 double im; 32 }; 33 34 } 35 namespace avro { 36 template<> struct codec_traits<i::cpx> { encodeavro::codec_traits37 static void encode(Encoder& e, const i::cpx& v) { 38 avro::encode(e, v.im); 39 } decodeavro::codec_traits40 static void decode(Decoder& d, i::cpx& v) { 41 avro::decode(d, v.im); 42 } 43 }; 44 45 } 46 #endif 47