| 116 | } |
| 117 | |
| 118 | inline void ParseIndexFile(std::vector<SampleDesc>& samples_container, |
| 119 | std::vector<ComponentDesc>& components_container, |
| 120 | const std::string& index_path) { |
| 121 | std::ifstream index_file(index_path); |
| 122 | |
| 123 | // Index Checking |
| 124 | std::string global_meta; |
| 125 | getline(index_file, global_meta); |
| 126 | std::stringstream global_meta_stream(global_meta); |
| 127 | std::string index_version_str; |
| 128 | DALI_ENFORCE(global_meta_stream >> index_version_str, |
| 129 | IndexFileErrMsg(index_path, 0, "no version signature found")); |
| 130 | DALI_ENFORCE( |
| 131 | kSupportedIndexVersions.count(index_version_str) > 0, |
| 132 | IndexFileErrMsg(index_path, 0, |
| 133 | make_string("Unsupported version of the index file (", |
| 134 | index_version_str, ")."))); |
| 135 | int index_version = ParseIndexVersion(index_version_str); |
| 136 | |
| 137 | // Getting the number of samples in the index file |
| 138 | int64_t sample_desc_num_signed; |
| 139 | DALI_ENFORCE(global_meta_stream >> sample_desc_num_signed, |
| 140 | IndexFileErrMsg(index_path, 0, "no sample count found")); |
| 141 | DALI_ENFORCE(sample_desc_num_signed > 0, |
| 142 | IndexFileErrMsg(index_path, 0, "sample count must be positive")); |
| 143 | |
| 144 | const size_t sample_desc_num = sample_desc_num_signed; |
| 145 | samples_container.reserve(samples_container.size() + sample_desc_num); |
| 146 | for (size_t sample_index = 0; sample_index < sample_desc_num; sample_index++) { |
| 147 | ParseSampleDesc(samples_container, components_container, index_file, index_path, |
| 148 | sample_index + 1, index_version); |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | std::tuple<std::string, std::string> split_name(const std::string& filepath) { |
| 153 | size_t dot_pos = filepath.find('.', filepath.rfind('/') + 1); |
no test coverage detected