Ejemplo n.º 1
0
void readArchive( const ABCA::ArchiveReaderPtr& iArchiveReader)
{
    std::vector< ABCA::ObjectReaderPtr > objs;
    objs.push_back( iArchiveReader->getTop() );
    TESTING_ASSERT( objs[0]->getNumChildren() == 2 );
    objs.push_back( objs[0]->getChild(0) );
    objs.push_back( objs[0]->getChild(1) );

    std::size_t numObjs = objs.size();
    for (std::size_t i = 1; i < numObjs; ++i)
    {
        TESTING_ASSERT( objs[i]->getNumChildren() == 3 );
        for (std::size_t j = 0; j < numObjs; ++j)
        {
            objs.push_back( objs[i]->getChild(j) );
        }
    }

    for (std::size_t i = 0; i < objs.size(); ++i)
    {
        TESTING_ASSERT( objs[i]->getProperties()->getNumProperties() == 3 );

        ABCA::CompoundPropertyReaderPtr cpr = objs[i]->getProperties();
        ABCA::ArrayPropertyReaderPtr apr = cpr->getArrayProperty("a");

        TESTING_ASSERT( 0 ==
            objs[i]->getProperties()->getArrayProperty("a")->getNumSamples() );
        TESTING_ASSERT( 1 ==
            objs[i]->getProperties()->getArrayProperty("b")->getNumSamples() );
        TESTING_ASSERT( 2 ==
            objs[i]->getProperties()->getArrayProperty("c")->getNumSamples() );
    }

    TESTING_ASSERT( iArchiveReader->getMaxNumSamplesForTimeSamplingIndex(0) == 2 );
}
Ejemplo n.º 2
0
void readArchive( const std::string & iName, std::istream * iStream )
{
    std::vector< std::istream * > streamVec;
    if (iStream)
    {
        streamVec.push_back(iStream);
    }
    Alembic::AbcCoreOgawa::ReadArchive r(streamVec);
    ABCA::ArchiveReaderPtr a = r( iName );
    std::vector< ABCA::ObjectReaderPtr > objs;
    objs.push_back( a->getTop() );
    TESTING_ASSERT( objs[0]->getNumChildren() == 2 );
    objs.push_back( objs[0]->getChild(0) );
    objs.push_back( objs[0]->getChild(1) );

    std::size_t numObjs = objs.size();
    for (std::size_t i = 1; i < numObjs; ++i)
    {
        TESTING_ASSERT( objs[i]->getNumChildren() == 3 );
        for (std::size_t j = 0; j < numObjs; ++j)
        {
            objs.push_back( objs[i]->getChild(j) );
        }
    }

    for (std::size_t i = 0; i < objs.size(); ++i)
    {
        TESTING_ASSERT( objs[i]->getProperties()->getNumProperties() == 3 );

        ABCA::CompoundPropertyReaderPtr cpr = objs[i]->getProperties();
        ABCA::ArrayPropertyReaderPtr apr = cpr->getArrayProperty("a");

        TESTING_ASSERT( 0 ==
            objs[i]->getProperties()->getArrayProperty("a")->getNumSamples() );
        TESTING_ASSERT( 1 ==
            objs[i]->getProperties()->getArrayProperty("b")->getNumSamples() );
        TESTING_ASSERT( 2 ==
            objs[i]->getProperties()->getArrayProperty("c")->getNumSamples() );
    }

    TESTING_ASSERT( a->getMaxNumSamplesForTimeSamplingIndex(0) == 2 );
}