Esempio n. 1
0
fulliautomatix_data* AsterixData::getData()
{
  fulliautomatix_data *firstData=NULL,*lastData=NULL;
  int byteoffset = 0;

  std::list<DataBlock*>::iterator it;
  for ( it=m_lDataBlocks.begin() ; it != m_lDataBlocks.end(); it++ )
  {
    DataBlock* db = (DataBlock*)(*it);
    if (db != NULL)
    {
      if (!lastData)
      {
        firstData = lastData = db->getData(byteoffset);
      }
      else
      {
        lastData->next = db->getData(byteoffset);
      }
      while(lastData->next)
      {
        lastData = lastData->next;
      }
      byteoffset = lastData->bytenr + lastData->length;
    }
  }
  return firstData;
}
Esempio n. 2
0
void *DataChunker::alloc(S32 size)
{
   if (size > mChunkSize)
   {
      DataBlock * temp = (DataBlock*)dMalloc(DataChunker::PaddDBSize + size);
      AssertFatal(temp, "Malloc failed");
      constructInPlace(temp);
      if (mCurBlock)
      {
         temp->next = mCurBlock->next;
         mCurBlock->next = temp;
      }
      else
      {
         mCurBlock = temp;
         temp->curIndex = mChunkSize;
      }
      return temp->getData();
   }

   if(!mCurBlock || size + mCurBlock->curIndex > mChunkSize)
   {
      const U32 paddDBSize = (sizeof(DataBlock) + 3) & ~3;
      DataBlock *temp = (DataBlock*)dMalloc(paddDBSize+ mChunkSize);
      AssertFatal(temp, "Malloc failed");
      constructInPlace(temp);
      temp->next = mCurBlock;
      mCurBlock = temp;
   }
   
   void *ret = mCurBlock->getData() + mCurBlock->curIndex;
   mCurBlock->curIndex += (size + 3) & ~3; // dword align
   return ret;
}
Esempio n. 3
0
PyObject* AsterixData::getData()
{
	PyObject* hp = PyList_New(0);

	std::list<DataBlock*>::iterator it;
	for ( it=m_lDataBlocks.begin() ; it != m_lDataBlocks.end(); it++ )
	{
		DataBlock* db = (DataBlock*)(*it);
		if (db != NULL)
		{
			db->getData(hp);
		}
	}
	return hp;
}
Esempio n. 4
0
/*
 * pobieranie calej zawartosci pliku w postaci stringa
 */
std::string Inode::GetData()
{
	std::string temp;
	for(unsigned int i = 0; i < this->i_blocks; i++)
	{
		DataBlock *tempBlock = GetBlock(i);
		char* blockData = tempBlock->getData();
		for(int j = 0; j < Synchro::blockSize; j++)
		{
			if(blockData[j] != '\0')
				temp += (blockData[j]);
		}
		temp += ' ';
	}

	return temp;
}