SlicedArrayImpl::SlicedArrayImpl( std::string const &codeName, RC::ConstHandle<Impl> const &memberImpl ) : ArrayImpl( codeName, DT_SLICED_ARRAY, memberImpl ) , m_memberImpl( memberImpl ) , m_memberSize( memberImpl->getAllocSize() ) , m_variableArrayImpl( memberImpl->getVariableArrayImpl() ) { setSize( sizeof(bits_t) ); }
DictImpl::DictImpl( std::string const &codeName, RC::ConstHandle<ComparableImpl> const &keyImpl, RC::ConstHandle<Impl> const &valueImpl ) : m_keyImpl( keyImpl ) , m_keySize( keyImpl->getAllocSize() ) , m_valueImpl( valueImpl ) , m_valueSize( valueImpl->getAllocSize() ) , m_nodeSize( sizeof(node_t) + m_keySize + m_valueSize ) { size_t flags = 0; if ( keyImpl->isNoAliasUnsafe() || valueImpl->isNoAliasUnsafe() ) flags |= FlagNoAliasUnsafe; if ( m_keyImpl->isExportable() && m_valueImpl->isExportable() ) flags |= FlagExportable; initialize( codeName, DT_DICT, sizeof(bits_t *), flags ); }
void ArrayProducer::ComputeState::produceJSON( size_t index, JSON::Encoder &jg ) const { RC::ConstHandle<RT::Desc> elementDesc = m_arrayProducer->getElementDesc(); size_t allocSize = elementDesc->getAllocSize(); void *valueData = alloca( allocSize ); memset( valueData, 0, allocSize ); produce( index, valueData ); elementDesc->encodeJSON( valueData, jg ); elementDesc->disposeData( valueData ); }
void ArrayProducer::ComputeState::produceJSON( size_t index, size_t count, JSON::Encoder &jg ) const { RC::ConstHandle<RT::Desc> elementDesc = m_arrayProducer->getElementDesc(); size_t allocSize = elementDesc->getAllocSize(); size_t totalAllocSize = allocSize * count; void *datas = alloca( totalAllocSize ); memset( datas, 0, totalAllocSize ); produce( index, count, datas ); { JSON::ArrayEncoder jag = jg.makeArray(); uint8_t *data = reinterpret_cast<uint8_t *>( datas ); for ( size_t i=0; i<count; ++i ) { JSON::Encoder elementEncoder = jag.makeElement(); elementDesc->encodeJSON( data, elementEncoder ); data += allocSize; } } elementDesc->disposeDatas( datas, count, allocSize ); }
bool OpaqueImpl::isEquivalentTo( RC::ConstHandle<Impl> const &impl ) const { if ( !isOpaque( impl->getType() ) ) return false; return getAllocSize() == impl->getAllocSize(); }