Example #1
0
//-*****************************************************************************
// With the compound property writer as an input.
CpwImpl::CpwImpl( AbcA::CompoundPropertyWriterPtr iParent,
                  hid_t iParentGroup,
                  const std::string & iName,
                  const AbcA::MetaData & iMeta )
  : BaseCpwImpl( iParentGroup )
  , m_parent( iParent )
  , m_header( new AbcA::PropertyHeader(iName, iMeta) )
{
    // Check the validity of all inputs.
    ABCA_ASSERT( m_parent, "Invalid parent" );
    ABCA_ASSERT( m_header, "Invalid property header" );

    if ( m_header->getPropertyType() != AbcA::kCompoundProperty )
    {
        ABCA_THROW( "Tried to create compound property with the wrong "
                     "property type: " << m_header->getPropertyType() );
    }

    // Set the object.
    AbcA::ObjectWriterPtr optr = m_parent->getObject();
    ABCA_ASSERT( optr, "Invalid object" );
    m_object = optr;

    // Write the property header.
    WritePropertyInfo( iParentGroup, m_header->getName(),
        m_header->getPropertyType(), m_header->getDataType(),
        false, 0, 0, 0, 0 );

    WriteMetaData( iParentGroup, m_header->getName() + ".meta",
        m_header->getMetaData() );
}
Example #2
0
//-*****************************************************************************
OwData::OwData( hid_t iParentGroup,
                const std::string &iName,
                const AbcA::MetaData &iMetaData )
    : m_group( -1 )
{
    // Check validity of all inputs.
    ABCA_ASSERT( iParentGroup >= 0, "Invalid parent group" );

    // Create the HDF5 group corresponding to this object.
    hid_t copl = CreationOrderPlist();
    m_group = H5Gcreate2( iParentGroup, iName.c_str(),
                          H5P_DEFAULT, copl, H5P_DEFAULT );
    H5Pclose( copl );
    ABCA_ASSERT( m_group >= 0,
                 "Could not create group for object: " << iName );

    m_data.reset( new CpwData( ".prop", m_group ) );

    AbcA::PropertyHeader topHeader( ".prop", iMetaData );
    WritePropertyInfo( m_group, topHeader, false, 0, 0, 0, 0 );
}
Example #3
0
//-*****************************************************************************
void CpwData::writePropertyHeaders( MetaDataMapPtr iMetaDataMap )
{
    // pack in child header and other info
    std::vector< Util::uint8_t > data;
    for ( size_t i = 0; i < getNumProperties(); ++i )
    {
        PropertyHeaderPtr prop = m_propertyHeaders[i];
        WritePropertyInfo( data,
                           prop->header,
                           prop->isScalarLike,
                           prop->isHomogenous,
                           prop->timeSamplingIndex,
                           prop->nextSampleIndex,
                           prop->firstChangedIndex,
                           prop->lastChangedIndex,
                           iMetaDataMap );
    }

    if ( !data.empty() )
    {
        m_group->addData( data.size(), &( data.front() ) );
    }
}
Example #4
0
//-*****************************************************************************
SpwImpl::~SpwImpl()
{
    WritePropertyInfo( m_parentGroup, *m_header, true,
        m_timeSamplingIndex, m_nextSampleIndex, m_firstChangedIndex,
        m_lastChangedIndex );
}