MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / readRow

Function readRow

src/fe-analyselayout.cc:168–203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168static void readRow(const std::vector<std::string>& row, Image& image)
169{
170 if (row.size() != 13)
171 bad_csv();
172
173 try
174 {
175 Sector::Status status = Sector::stringToStatus(row[12]);
176 if (status == Sector::Status::INTERNAL_ERROR)
177 bad_csv();
178 if (status == Sector::Status::MISSING)
179 return;
180
181 int logicalCylinder = std::stoi(row[3]);
182 int logicalHead = std::stoi(row[4]);
183 int logicalSector = std::stoi(row[2]);
184
185 const auto& sector =
186 image.put(logicalCylinder, logicalHead, logicalSector);
187 sector->physicalLocation = std::make_optional<CylinderHead>(
188 (unsigned)std::stoi(row[0]), (unsigned)std::stoi(row[1]));
189 sector->logicalCylinder = logicalCylinder;
190 sector->logicalHead = logicalHead;
191 sector->logicalSector = logicalSector;
192 sector->clock = std::stod(row[5]);
193 sector->headerStartTime = std::stod(row[6]);
194 sector->headerEndTime = std::stod(row[7]);
195 sector->dataStartTime = std::stod(row[8]);
196 sector->dataEndTime = std::stod(row[9]);
197 sector->status = status;
198 }
199 catch (const std::invalid_argument& e)
200 {
201 bad_csv();
202 }
203}
204
205static Image readCsv(const std::string& filename)
206{

Callers 1

readCsvFunction · 0.85

Calls 3

bad_csvFunction · 0.85
sizeMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected