本文整理汇总了C++中MemoryBuffer::read方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryBuffer::read方法的具体用法?C++ MemoryBuffer::read怎么用?C++ MemoryBuffer::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryBuffer
的用法示例。
在下文中一共展示了MemoryBuffer::read方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slaveDone
void slaveDone(size32_t slaveIdx, MemoryBuffer &mb)
{
if (mb.length()) // if 0 implies aborted out from this slave.
{
rowcount_t slaveProcessed;
mb.read(slaveProcessed);
recordsProcessed += slaveProcessed;
offset_t size, physicalSize;
mb.read(size);
mb.read(physicalSize);
unsigned fileCrc;
mb.read(fileCrc);
CDateTime modifiedTime(mb);
StringBuffer timeStr;
modifiedTime.getString(timeStr);
IPartDescriptor *partDesc = fileDesc->queryPart(slaveIdx);
IPropertyTree &props = partDesc->queryProperties();
props.setPropInt64("@size", size);
if (fileDesc->isCompressed())
props.setPropInt64("@compressedSize", physicalSize);
props.setPropInt("@fileCrc", fileCrc);
props.setProp("@modified", timeStr.str());
}
}
示例2: init
// IThorSlaveActivity
void CDiskReadSlaveActivityBase::init(MemoryBuffer &data, MemoryBuffer &slaveData)
{
subfileLogicalFilenames.kill();
partDescs.kill();
data.read(logicalFilename);
unsigned subfiles;
data.read(subfiles);
unsigned s=0;
for (; s<subfiles; s++)
{
StringAttr subfile;
data.read(subfile);
subfileLogicalFilenames.append(subfile);
}
unsigned parts;
data.read(parts);
if (parts)
{
deserializePartFileDescriptors(data, partDescs);
// put temp files in individual slave temp dirs (incl port)
if ((helper->getFlags() & TDXtemporary) && (!container.queryJob().queryUseCheckpoints()))
partDescs.item(0).queryOwner().setDefaultDir(queryTempDir());
}
}
示例3: init
void CDiskWriteSlaveActivityBase::init(MemoryBuffer &data, MemoryBuffer &slaveData)
{
diskHelperBase = static_cast <IHThorDiskWriteArg *> (queryHelper());
data.read(logicalFilename);
dlfn.set(logicalFilename);
if (diskHelperBase->getFlags() & TDXtemporary)
data.read(usageCount);
if (diskHelperBase->getFlags() & TDWextend)
{
assertex(!"TBD extended CRC broken");
unsigned crc;
if (partDesc->getCrc(crc))
fileCRC.reset(~crc);
}
partDesc.setown(deserializePartFileDescriptor(data));
if (dlfn.isExternal())
{
mpTag = container.queryJob().deserializeMPTag(data);
if (dlfn.isQuery() && (0 != container.queryJob().getWorkUnitValueInt("rfsqueryparallel", 0)))
rfsQueryParallel = true;
}
if (0 != (diskHelperBase->getFlags() & TDXgrouped))
grouped = true;
compress = partDesc->queryOwner().isCompressed();
void *ekey;
size32_t ekeylen;
diskHelperBase->getEncryptKey(ekeylen,ekey);
if (ekeylen!=0) {
ecomp.setown(createAESCompressor256(ekeylen,ekey));
memset(ekey,0,ekeylen);
free(ekey);
compress = true;
}
}
示例4: deserialize
void FileFormat::deserialize(MemoryBuffer & in)
{
byte tempType;
in.read(tempType); type = (FileFormatType)tempType;
switch (type)
{
case FFTfixed:
case FFTblocked:
in.read(recordSize);
break;
case FFTcsv:
case FFTutf:
case FFTutf8: case FFTutf8n:
case FFTutf16: case FFTutf16be: case FFTutf16le:
case FFTutf32: case FFTutf32be: case FFTutf32le:
in.read(maxRecordSize);
::deserialize(in, separate);
::deserialize(in, quote);
::deserialize(in, terminate);
::deserialize(in, escape);
::deserialize(in, rowTag);
break;
}
}
示例5: doCmdCreateWorkunit
void RemoteDataSourceServer::doCmdCreateWorkunit(MemoryBuffer & in, MemoryBuffer & out)
{
SessionId session;
StringAttr wuid, username, password;
unsigned sequence;
StringAttr name;
in.read(session);
in.read(username).read(password);
in.read(wuid);
in.read(sequence);
in.read(name);
DBGLOG("RemoteFileView:CreateWorkunit('%s',%d,'%s') by[%s:%" I64F "d", wuid.get(), sequence, name ? name.get() : "", username.get(), session);
Owned<IConstWUResult> wuResult = resolveResult(wuid, sequence, name);
Owned<IFvDataSource> ds = createDataSource(wuResult, wuid, username, password);
unique_id_t id = addDataSource(session, ds);
out.append((unsigned short)CurRemoteVersion);
out.append(id);
out.append(ds->numRows(false));
ds->queryMetaData()->serialize(out);
out.append(ds->isIndex());
DBGLOG("RemoteFileView:CreateWorkunit returns %" I64F "d", id);
}
示例6:
DataSourceMetaItem::DataSourceMetaItem(unsigned _flags, MemoryBuffer & in)
{
flags = _flags;
in.read(name);
in.read(xpath);
type.setown(deserializeType(in));
}
示例7: deserialize
void FileFormat::deserialize(MemoryBuffer & in)
{
byte tempType;
in.read(tempType); type = (FileFormatType)tempType;
switch (type)
{
case FFTfixed:
case FFTblocked:
in.read(recordSize);
break;
case FFTcsv:
case FFTutf:
case FFTutf8: case FFTutf8n:
case FFTutf16: case FFTutf16be: case FFTutf16le:
case FFTutf32: case FFTutf32be: case FFTutf32le:
in.read(maxRecordSize);
::deserialize(in, separate);
::deserialize(in, quote);
::deserialize(in, terminate);
::deserialize(in, rowTag);
updateMarkupType(rowTag, NULL); //neither kind nor markup currently serialized. may add later
break;
}
}
示例8: slaveDone
virtual void slaveDone(size32_t slaveIdx, MemoryBuffer &mb)
{
if (mb.length()) // if 0 implies aborted out from this slave.
{
offset_t size;
mb.read(size);
CDateTime modifiedTime(mb);
IPartDescriptor *partDesc = newIndexDesc->queryPart(slaveIdx);
IPropertyTree &props = partDesc->queryProperties();
props.setPropInt64("@size", size);
StringBuffer timeStr;
modifiedTime.getString(timeStr);
props.setProp("@modified", timeStr.str());
if (!local && 0 == slaveIdx)
{
mb.read(size);
CDateTime modifiedTime(mb);
IPartDescriptor *partDesc = newIndexDesc->queryPart(newIndexDesc->numParts()-1);
IPropertyTree &props = partDesc->queryProperties();
props.setPropInt64("@size", size);
StringBuffer timeStr;
modifiedTime.getString(timeStr);
props.setProp("@modified", timeStr.str());
}
}
}
示例9: splitXmlTagNamesFromXPath
DataSourceMetaItem::DataSourceMetaItem(unsigned _flags, MemoryBuffer & in)
{
flags = _flags;
in.read(name);
in.read(xpath);
type.setown(deserializeType(in));
splitXmlTagNamesFromXPath(xpath.get(), tagname);
}
示例10: if
DataSourceMetaData::DataSourceMetaData(MemoryBuffer & buffer)
{
numVirtualFields = 0;
buffer.read(numFieldsToIgnore);
buffer.read(randomIsOk);
buffer.read(hasMixedContent);
buffer.read(isStoredFixedWidth);
buffer.read(minRecordSize);
buffer.read(keyedSize);
buffer.read(maxRecordSize);
unsigned numFields;
buffer.read(numFields);
for (unsigned idx=0; idx < numFields; idx++)
{
byte flags;
buffer.read(flags);
if (flags == FVFFdataset)
fields.append(*new DataSourceDatasetItem(flags, buffer));
else if (flags == FVFFset)
fields.append(*new DataSourceSetItem(flags, buffer));
else
fields.append(*new DataSourceMetaItem(flags, buffer));
if (flags == FVFFvirtual)
++numVirtualFields;
}
gatherAttributes();
}
示例11: RowBlock
VariableRowBlock::VariableRowBlock(MemoryBuffer & inBuffer, __int64 _start) : RowBlock(_start, 0)
{
inBuffer.read(numRows);
for (unsigned row = 0; row < numRows; row++)
{
unsigned thisLength;
rowIndex.append(buffer.length());
inBuffer.read(thisLength);
buffer.append(thisLength, inBuffer.readDirect(thisLength));
}
rowIndex.append(buffer.length());
}
示例12: deserialize
void PartitionPoint::deserialize(MemoryBuffer & in)
{
inputName.deserialize(in);
outputName.deserialize(in);
in.read(whichInput);
in.read(inputOffset);
in.read(inputLength);
in.read(whichOutput);
in.read(outputOffset);
in.read(outputLength);
in.read(whichSlave);
modifiedTime.deserialize(in);
::deserialize(in, fixedText);
}
示例13: processPartitionCommand
bool processPartitionCommand(ISocket * masterSocket, MemoryBuffer & msg, MemoryBuffer & results)
{
FileFormat srcFormat;
FileFormat tgtFormat;
unsigned whichInput;
RemoteFilename fullPath;
offset_t totalSize;
offset_t thisOffset;
offset_t thisSize;
unsigned thisHeaderSize;
unsigned numParts;
bool compressedInput = false;
unsigned compatflags = 0;
srcFormat.deserialize(msg);
tgtFormat.deserialize(msg);
msg.read(whichInput);
fullPath.deserialize(msg);
msg.read(totalSize);
msg.read(thisOffset);
msg.read(thisSize);
msg.read(thisHeaderSize);
msg.read(numParts);
if (msg.remaining())
msg.read(compressedInput);
if (msg.remaining())
msg.read(compatflags); // not yet used
StringAttr decryptkey;
if (msg.remaining())
msg.read(decryptkey);
if (msg.remaining())
{
srcFormat.deserializeExtra(msg, 1);
tgtFormat.deserializeExtra(msg, 1);
}
StringBuffer text;
fullPath.getRemotePath(text);
LOG(MCdebugProgress, unknownJob, "Process partition %d(%s)", whichInput, text.str());
Owned<IFormatProcessor> processor = createFormatProcessor(srcFormat, tgtFormat, true);
Owned<IOutputProcessor> target = createOutputProcessor(tgtFormat);
processor->setTarget(target);
processor->setPartitionRange(totalSize, thisOffset, thisSize, thisHeaderSize, numParts);
processor->setSource(whichInput, fullPath, compressedInput, decryptkey);
processor->calcPartitions(NULL);
PartitionPointArray partition;
processor->getResults(partition);
serialize(partition, results);
return true;
}
示例14: decompressResource
extern DLLSERVER_API bool decompressResource(size32_t len, const void *data, StringBuffer &result)
{
bool hasVersion = len && (*(const byte *)data == 0x80);
MemoryBuffer src;
src.setBuffer(len, const_cast<void *>(data), false);
byte version = 1;
if (hasVersion)
{
src.skip(1);
src.read(version);
}
MemoryBuffer tgt;
switch (version)
{
case 1:
decompressToBuffer(tgt, src);
break;
default:
throwUnexpected();
}
tgt.append((char)0);
unsigned expandedLen = tgt.length();
result.setBuffer(expandedLen, reinterpret_cast<char *>(tgt.detach()), expandedLen-1);
return true;
}
示例15: deserializeStats
void CWriteMasterBase::deserializeStats(unsigned node, MemoryBuffer &mb)
{
CMasterActivity::deserializeStats(node, mb);
unsigned repPerc;
mb.read(repPerc);
replicateProgress->set(node, repPerc);
}