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 #include "minddata/mindrecord/include/common/shard_utils.h" 28 #include "minddata/mindrecord/include/shard_error.h" 29 #include "minddata/mindrecord/include/shard_schema.h" 30 #include "utils/log_adapter.h" 31 32 namespace mindspore { 33 namespace mindrecord { 34 using std::cin; 35 using std::endl; 36 using std::pair; 37 using std::string; 38 using std::vector; 39 40 class __attribute__((visibility("default"))) Index { 41 public: 42 Index(); 43 ~Index()44 ~Index() {} 45 46 /// \brief Add field which from schema according to schemaId 47 /// \param[in] schemaId the id of schema to be added 48 /// \param[in] field the field need to be added 49 /// 50 /// add the field to the fields_ vector 51 void AddIndexField(const int64_t &schemaId, const std::string &field); 52 53 /// \brief get stored fields 54 /// \return fields stored 55 std::vector<std::pair<uint64_t, std::string> > GetFields(); 56 57 private: 58 std::vector<std::pair<uint64_t, std::string> > fields_; 59 string database_name_; 60 string table_name_; 61 }; 62 } // namespace mindrecord 63 } // namespace mindspore 64 65 #endif // MINDSPORE_CCSRC_MINDDATA_MINDRECORD_INDEX_H 66