Beispiel #1
0
void OrData::getChildrenHash( Util::Digest & oDigest, size_t iThreadId )
{
    std::size_t numChildren = m_group->getNumChildren();
    Ogawa::IDataPtr data = m_group->getData( numChildren - 1, iThreadId );
    if ( data && data->getSize() >= 32 )
    {
        // children hash is the last 16 bytes
        data->read( 16, oDigest.d, data->getSize() - 16, iThreadId );
    }
}
Beispiel #2
0
void OrData::getPropertiesHash( Util::Digest & oDigest, size_t iThreadId )
{
    std::size_t numChildren = m_group->getNumChildren();
    Ogawa::IDataPtr data = m_group->getData( numChildren - 1, iThreadId );
    if ( data && data->getSize() >= 32 )
    {
        // last 32 bytes are properties hash, followed by children hash
        data->read( 16, oDigest.d, data->getSize() - 32, iThreadId );
    }
}
Beispiel #3
0
//-*****************************************************************************
void ArImpl::init()
{
    Ogawa::IGroupPtr group = m_archive.getGroup();

    int version = -1;
    std::size_t numChildren = group->getNumChildren();

    if ( numChildren > 5 && group->isChildData( 0 ) &&
         group->isChildData( 1 ) && group->isChildGroup( 2 ) &&
         group->isChildData( 3 ) && group->isChildData( 4 ) &&
         group->isChildData( 5 ) )
    {
        Ogawa::IDataPtr data = group->getData( 0, 0 );
        if ( data->getSize() == 4 )
        {
            data->read( 4, &version, 0, 0 );
        }
    }
    else
    {
        ABCA_THROW( "Invalid Alembic file." );
    }

    ABCA_ASSERT( version >= 0 && version <= ALEMBIC_OGAWA_FILE_VERSION,
        "Unsupported file version detected: " << version );

    // if it isn't there, something is wrong
    int fileVersion = 0;

    Ogawa::IDataPtr data = group->getData( 1, 0 );
    if ( data->getSize() == 4 )
    {
        data->read( 4, &fileVersion, 0, 0 );
    }

    ABCA_ASSERT( fileVersion >= 9999,
        "Unsupported Alembic version detected: " << fileVersion );

    m_archiveVersion = fileVersion;

    ReadTimeSamplesAndMax( group->getData( 4, 0 ),
                           m_timeSamples, m_maxSamples );

    ReadIndexedMetaData( group->getData( 5, 0 ), m_indexMetaData );

    m_data.reset( new OrData( group->getGroup( 2, false, 0 ), "", 0, *this,
                              m_indexMetaData ) );

    m_header->setName( "ABC" );
    m_header->setFullName( "/" );

    // read archive metadata
    data = group->getData( 3, 0 );
    if ( data->getSize() > 0 )
    {
        char * buf = new char[ data->getSize() ];
        data->read( data->getSize(), buf, 0, 0 );
        std::string metaData(buf, data->getSize() );
        m_header->getMetaData().deserialize( metaData );
        delete [] buf;
    }

}