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 RECORDTYPEINFO_HH_ 20 #define RECORDTYPEINFO_HH_ 21 22 #include "recordio.hh" 23 #include <vector> 24 #include <map> 25 #include "fieldTypeInfo.hh" 26 27 namespace hadoop { 28 29 class RecordTypeInfo : public ::hadoop::Record { 30 31 private: 32 //std::vector<FieldTypeInfo* > typeInfos; 33 std::string name; 34 //std::map<std::string, RecordTypeInfo*> structRTIs; 35 StructTypeID *pStid; 36 RecordTypeInfo(const char * pName,StructTypeID * pStid)37 RecordTypeInfo(const char * pName, StructTypeID* pStid): name(pName),pStid(pStid) {} 38 39 public: 40 RecordTypeInfo(); 41 RecordTypeInfo(const char *pName); 42 //RecordTypeInfo(const RecordTypeInfo& rti); 43 virtual ~RecordTypeInfo(); 44 45 void addField(const std::string* pFieldID, const TypeID* pTypeID); 46 void addAll(std::vector<FieldTypeInfo*>& vec); 47 const std::vector<FieldTypeInfo*>& getFieldTypeInfos() const; 48 void serialize(::hadoop::OArchive& a_, const char* tag) const; 49 void deserialize(::hadoop::IArchive& a_, const char* tag); clone() const50 RecordTypeInfo* clone() const {return new RecordTypeInfo(*this);} 51 RecordTypeInfo* getNestedStructTypeInfo(const char *structName) const; 52 getName() const53 const ::std::string& getName() const {return name;} setName(const::std::string & name)54 void setName(const ::std::string& name) {this->name = name;} 55 type() const56 const ::std::string& type() const {return name;} signature() const57 const ::std::string& signature() const {return name;} 58 59 void print(int space=0) const; 60 61 62 }; 63 64 65 66 } 67 #endif // RECORDTYPEINFO_HH_ 68 69