| 390 | //-***************************************************************************** |
| 391 | template <class StringT, class CharT> |
| 392 | static AbcA::ArraySamplePtr |
| 393 | ReadStringArrayT( AbcA::ReadArraySampleCachePtr iCache, |
| 394 | hid_t iParent, |
| 395 | const std::string &iName, |
| 396 | const AbcA::DataType &iDataType ) |
| 397 | { |
| 398 | assert( iDataType.getExtent() > 0 ); |
| 399 | |
| 400 | // Open the data set. |
| 401 | hid_t dsetId = H5Dopen( iParent, iName.c_str(), H5P_DEFAULT ); |
| 402 | ABCA_ASSERT( dsetId >= 0, "Cannot open dataset: " << iName ); |
| 403 | DsetCloser dsetCloser( dsetId ); |
| 404 | |
| 405 | // Read the data space. |
| 406 | hid_t dspaceId = H5Dget_space( dsetId ); |
| 407 | ABCA_ASSERT( dspaceId >= 0, "Could not get dataspace for dataSet: " |
| 408 | << iName ); |
| 409 | DspaceCloser dspaceCloser( dspaceId ); |
| 410 | |
| 411 | // Read the digest, if there's a cache. |
| 412 | AbcA::ArraySample::Key key; |
| 413 | bool foundDigest = false; |
| 414 | |
| 415 | // If we found a digest and there's a cache, see |
| 416 | // if we're in there, and return it if so. |
| 417 | if ( iCache ) |
| 418 | { |
| 419 | key.origPOD = iDataType.getPod(); |
| 420 | key.readPOD = key.origPOD; |
| 421 | |
| 422 | hid_t dsetFtype = H5Dget_type( dsetId ); |
| 423 | DtypeCloser dtypeCloser( dsetFtype ); |
| 424 | |
| 425 | // string arrays get packed together |
| 426 | key.numBytes = H5Sget_simple_extent_npoints( dspaceId ) * |
| 427 | H5Tget_size( dsetFtype ); |
| 428 | |
| 429 | foundDigest = ReadKey( dsetId, "key", key ); |
| 430 | AbcA::ReadArraySampleID found = iCache->find( key ); |
| 431 | if ( found ) |
| 432 | { |
| 433 | AbcA::ArraySamplePtr ret = found.getSample(); |
| 434 | assert( ret ); |
| 435 | if ( ret->getDataType() != iDataType ) |
| 436 | { |
| 437 | ABCA_THROW( "ERROR: Read data type for dset: " << iName |
| 438 | << ": " << ret->getDataType() |
| 439 | << " does not match expected data type: " |
| 440 | << iDataType ); |
| 441 | } |
| 442 | |
| 443 | // Got it! |
| 444 | return ret; |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | // Okay, we haven't found it in a cache. |
| 449 |
nothing calls this directly
no test coverage detected