Beispiel #1
0
ConstArray::ConstArray(
    RC::ConstHandle<RT::Manager> const &rtManager,
    RC::ConstHandle<RT::Desc> const &elementDesc,
    JSON::Entity const &entity
)
{
    entity.requireArray();
    m_fixedArrayDesc = rtManager->getFixedArrayOf( elementDesc, entity.value.array.size );
    m_data.resize( m_fixedArrayDesc->getAllocSize(), 0 );
    m_fixedArrayDesc->decodeJSON( entity, &m_data[0] );
}
Beispiel #2
0
ConstArray::ConstArray(
    RC::ConstHandle<RT::Manager> const &rtManager,
    RC::ConstHandle<RT::ArrayDesc> const &arrayDesc,
    void const *data
)
{

    RC::ConstHandle<RT::Desc> elementDesc = arrayDesc->getMemberDesc();
    size_t count = arrayDesc->getNumMembers( data );

    m_fixedArrayDesc = rtManager->getFixedArrayOf( elementDesc, count );
    m_data.resize( m_fixedArrayDesc->getAllocSize(), 0 );
    for ( size_t i=0; i<count; ++i )
        elementDesc->setData( arrayDesc->getImmutableMemberData( data, i ), m_fixedArrayDesc->getMutableMemberData( &m_data[0], i ) );
}