| 290 | } |
| 291 | |
| 292 | void PcdReader::initialize() |
| 293 | { |
| 294 | if (m_filename.empty()) |
| 295 | throwError("Can't read PCD file without filename."); |
| 296 | |
| 297 | m_istreamPtr = Utils::openFile(m_filename, true); |
| 298 | if (!m_istreamPtr) |
| 299 | throwError("Can't open file '" + m_filename + "'."); |
| 300 | try |
| 301 | { |
| 302 | m_header.clear(); |
| 303 | *m_istreamPtr >> m_header; |
| 304 | } |
| 305 | catch( ... ) |
| 306 | { |
| 307 | Utils::closeFile(m_istreamPtr); |
| 308 | m_istreamPtr = nullptr; |
| 309 | throw; |
| 310 | } |
| 311 | m_line = m_header.m_numLines; |
| 312 | |
| 313 | Utils::closeFile(m_istreamPtr); |
| 314 | } |
| 315 | |
| 316 | void PcdReader::done(PointTableRef table) |
| 317 | { |