MCPcopy Create free account
hub / github.com/Samsung/ONE / DirectoryLoader

Method DirectoryLoader

compiler/circle-eval-diff/src/InputDataLoader.cpp:158–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158DirectoryLoader::DirectoryLoader(const std::string &dir_path,
159 const std::vector<loco::Node *> &input_nodes)
160 : _input_nodes{input_nodes}
161{
162 DIR *dir = opendir(dir_path.c_str());
163 if (not dir)
164 {
165 throw std::runtime_error("Cannot open directory \"" + dir_path + "\".");
166 }
167
168 struct dirent *entry = nullptr;
169 const auto input_total_bytes = getTotalByteSizeOf(input_nodes);
170 while ((entry = readdir(dir)))
171 {
172 // Skip if the entry is not a regular file
173 if (entry->d_type != DT_REG)
174 continue;
175
176 _data_paths.push_back(dir_path + "/" + entry->d_name);
177 }
178
179 closedir(dir);
180}
181
182uint32_t DirectoryLoader::size(void) const { return _data_paths.size(); }
183

Callers

nothing calls this directly

Calls 3

getTotalByteSizeOfFunction · 0.85
push_backMethod · 0.80
c_strMethod · 0.45

Tested by

no test coverage detected