1 /** 2 * Copyright 2019 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INDEX_H 18 #define MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INDEX_H 19 #pragma once 20 21 #include <stdio.h> 22 #include <iostream> 23 #include <map> 24 #include <string> 25 #include <utility> 26 #include <vector> 27 28 #include "minddata/mindrecord/include/common/log_adapter.h" 29 #include "minddata/mindrecord/include/common/shard_utils.h" 30 #include "minddata/mindrecord/include/mindrecord_macro.h" 31 #include "minddata/mindrecord/include/shard_error.h" 32 #include "minddata/mindrecord/include/shard_schema.h" 33 34 namespace mindspore { 35 namespace mindrecord { 36 using std::cin; 37 using std::endl; 38 using std::pair; 39 using std::string; 40 using std::vector; 41 42 class MINDRECORD_API Index { 43 public: 44 Index(); 45 ~Index()46 ~Index() {} 47 48 /// \brief Add field which from schema according to schemaId 49 /// \param[in] schemaId the id of schema to be added 50 /// \param[in] field the field need to be added 51 /// 52 /// add the field to the fields_ vector 53 void AddIndexField(const int64_t &schemaId, const std::string &field); 54 55 /// \brief get stored fields 56 /// \return fields stored 57 std::vector<std::pair<uint64_t, std::string> > GetFields(); 58 59 private: 60 std::vector<std::pair<uint64_t, std::string> > fields_; 61 string database_name_; 62 string table_name_; 63 }; 64 } // namespace mindrecord 65 } // namespace mindspore 66 67 #endif // MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INDEX_H 68