本文整理汇总了C++中MemChunk::initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ MemChunk::initialize方法的具体用法?C++ MemChunk::initialize怎么用?C++ MemChunk::initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemChunk
的用法示例。
在下文中一共展示了MemChunk::initialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: materialize
void MaterializedArray::materialize(const shared_ptr<Query>& query,
MemChunk& materializedChunk,
ConstChunk const& chunk,
MaterializeFormat format)
{
nMaterializedChunks += 1;
materializedChunk.initialize(chunk);
materializedChunk.setBitmapChunk((Chunk*)chunk.getBitmapChunk());
boost::shared_ptr<ConstChunkIterator> src
= chunk.getConstIterator(ChunkIterator::IGNORE_DEFAULT_VALUES|ChunkIterator::IGNORE_EMPTY_CELLS|
(chunk.isSolid() ? ChunkIterator::INTENDED_TILE_MODE : 0));
boost::shared_ptr<ChunkIterator> dst
= materializedChunk.getIterator(query,
(src->getMode() & ChunkIterator::TILE_MODE)|ChunkIterator::ChunkIterator::NO_EMPTY_CHECK|ChunkIterator::SEQUENTIAL_WRITE);
size_t count = 0;
while (!src->end()) {
if (!dst->setPosition(src->getPosition()))
throw SYSTEM_EXCEPTION(SCIDB_SE_MERGE, SCIDB_LE_OPERATION_FAILED) << "setPosition";
dst->writeItem(src->getItem());
count += 1;
++(*src);
}
if (!(src->getMode() & ChunkIterator::TILE_MODE) &&
!chunk.getArrayDesc().hasOverlap()) {
materializedChunk.setCount(count);
}
dst->flush();
}
示例2: getChunk
ConstChunk const& getChunk(AttributeID attr, size_t rowIndex)
{
_chunkAddress.coords[1] = _rowIndex -1;
shared_ptr<Query> query = Query::getValidQueryPtr(_query);
_chunk.initialize(this, &super::getArrayDesc(), _chunkAddress, 0);
shared_ptr<ChunkIterator> chunkIt = _chunk.getIterator(query, ChunkIterator::SEQUENTIAL_WRITE | ChunkIterator::NO_EMPTY_CHECK);
Value v;
if(_buffer[_bufferSize-1] == _delimiter) //add the null-termination character; replace the last delimiter character if one is present
{
v.setSize(_bufferSize);
char *d = (char*) v.data();
memcpy(d, _buffer, _bufferSize);
d[_bufferSize-1] = 0;
}
else
{
v.setSize(_bufferSize+1);
char *d = (char*) v.data();
memcpy(d, _buffer, _bufferSize);
d[_bufferSize] = 0;
}
chunkIt->writeItem(v);
chunkIt->flush();
return _chunk;
}
示例3: proceedChunkMsg
bool RemoteArray::proceedChunkMsg(AttributeID attId, MemChunk& chunk)
{
boost::shared_ptr<MessageDesc> chunkDesc = _messages[attId];
_messages[attId].reset();
StatisticsScope sScope(_statistics);
boost::shared_ptr<scidb_msg::Chunk> chunkMsg = chunkDesc->getRecord<scidb_msg::Chunk>();
currentStatistics->receivedSize += chunkDesc->getMessageSize();
currentStatistics->receivedMessages++;
if (!chunkMsg->eof())
{
LOG4CXX_TRACE(logger, "RemoteArray received next chunk message");
assert(chunkDesc->getBinary());
const int compMethod = chunkMsg->compression_method();
const size_t decompressedSize = chunkMsg->decompressed_size();
Address firstElem;
firstElem.attId = attId;
firstElem.arrId = getArrayDesc().getId();
for (int i = 0; i < chunkMsg->coordinates_size(); i++) {
firstElem.coords.push_back(chunkMsg->coordinates(i));
}
chunk.initialize(this, &desc, firstElem, compMethod);
chunk.setSparse(chunkMsg->sparse());
chunk.setCount(chunkMsg->count());
boost::shared_ptr<CompressedBuffer> compressedBuffer = dynamic_pointer_cast<CompressedBuffer>(chunkDesc->getBinary());
compressedBuffer->setCompressionMethod(compMethod);
compressedBuffer->setDecompressedSize(decompressedSize);
chunk.decompress(*compressedBuffer);
LOG4CXX_TRACE(logger, "RemoteArray initializes next chunk");
requestNextChunk(attId);
return true;
}
else
{
return false;
}
}
示例4: _handleChunkOrAggregateChunk
//.........这里部分代码省略.........
shared_ptr<PinBuffer> pinTmpChunk, pinClosure;
if (outputIter->setPosition(coordinates)) { // existing chunk
outChunk = &outputIter->updateChunk();
if (! isAggregateChunk) {
if (outChunk->getDiskChunk() != NULL) {
throw SYSTEM_EXCEPTION(SCIDB_SE_MERGE, SCIDB_LE_CANT_UPDATE_CHUNK);
}
outChunk->setCount(0); // unknown
}
// if (a) either dest is NULL or merge by bitwise-or is possible; and (b) src is not compressed
char* dst = static_cast<char*>(outChunk->getData());
if ( (dst == NULL || (outChunk->isPossibleToMergeByBitwiseOr() && !chunkRecord->sparse() && !chunkRecord->rle()))
&&
compMethod == 0 )
{
char const* src = (char const*)compressedBuffer->getData();
// Special care is needed if shouldCacheEmptyBitmap.
// - If this is the empty bitmap, store it in the SGContext.
// - Otherwise, add the empty bitmap from the SGContext to the chunk's data.
if (shouldCacheEmptyBitmap) {
initMemChunkFromNetwork(pTmpChunk, pinTmpChunk, outputArray, coordinates, attributeID,
compMethod, chunkRecord->sparse() || outChunk->isSparse(), rle, compressedBuffer);
if (isEmptyIndicator) {
sgCtx->setCachedEmptyBitmapChunk(sourceId, pTmpChunk, coordinates);
} else {
shared_ptr<ConstRLEEmptyBitmap> cachedBitmap = sgCtx->getCachedEmptyBitmap(sourceId, coordinates);
assert(cachedBitmap);
pinClosure = make_shared<PinBuffer>(closure);
closure.initialize(*pTmpChunk);
pTmpChunk->makeClosure(closure, cachedBitmap);
src = static_cast<char const*>(closure.getData());
}
}
if (dst == NULL) {
outChunk->allocateAndCopy(src, decompressedSize, chunkRecord->sparse(), chunkRecord->rle(), count, _query);
} else {
outChunk->mergeByBitwiseOr(src, decompressedSize, _query);
}
} else {
initMemChunkFromNetwork(pTmpChunk, pinTmpChunk, outputArray, coordinates, attributeID,
compMethod, chunkRecord->sparse() || outChunk->isSparse(), rle, compressedBuffer);
ConstChunk const* srcChunk = &(*pTmpChunk);
// Special care is needed if shouldCacheEmptyBitmap.
// - If this is the empty bitmap, store it in the SGContext.
// - Otherwise, add the empty bitmap from the SGContext to the chunk's data.
if (shouldCacheEmptyBitmap) {
if (isEmptyIndicator) {
sgCtx->setCachedEmptyBitmapChunk(sourceId, pTmpChunk, coordinates);
} else {
shared_ptr<ConstRLEEmptyBitmap> cachedBitmap = sgCtx->getCachedEmptyBitmap(sourceId, coordinates);
assert(cachedBitmap);
pinClosure = make_shared<PinBuffer>(closure);
closure.initialize(*pTmpChunk);
pTmpChunk->makeClosure(closure, cachedBitmap);
srcChunk = &closure;
}
}