コード例 #1
0
 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 );
 }
コード例 #2
0
 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 );
 }