本文整理汇总了C++中dataSize函数的典型用法代码示例。如果您正苦于以下问题:C++ dataSize函数的具体用法?C++ dataSize怎么用?C++ dataSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dataSize函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: boundingRect
QwtDoubleRect QwtHistogram::boundingRect() const
{
QwtDoubleRect rect = QwtPlotCurve::boundingRect();
rect.setLeft(rect.left()-x(1));
rect.setRight(rect.right()+x(dataSize()-1));
rect.setTop(0);
rect.setBottom(1.2*rect.bottom());
return rect;
}
开发者ID:jkrueger1,项目名称:mantid,代码行数:9,代码来源:QwtHistogram.cpp
示例2: drawDots
/*!
Draw a subset of the points
\param painter Painter
\param xMap Maps x-values into pixel coordinates.
\param yMap Maps y-values into pixel coordinates.
\param canvasRect Contents rect of the canvas
\param from Index of the first sample to be painted
\param to Index of the last sample to be painted. If to < 0 the
series will be painted to its last sample.
\sa drawDots()
*/
void QwtPlotSpectroCurve::drawSeries( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const
{
if ( !painter || dataSize() <= 0 )
return;
if ( to < 0 )
to = dataSize() - 1;
if ( from < 0 )
from = 0;
if ( from > to )
return;
drawDots( painter, xMap, yMap, canvasRect, from, to );
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:31,代码来源:qwt_plot_spectrocurve.cpp
示例3: draw
void draw(const ny::EventData*) override
{
if(!surface) return;
auto bufferGuard = surface->buffer();
auto buffer = bufferGuard.get();
auto size = dataSize(buffer);
std::memset(buffer.data, 0xCC, size);
}
开发者ID:nyorain,项目名称:ny,代码行数:9,代码来源:dev.cpp
示例4: JSCell
PropertyTable::PropertyTable(VM& vm, unsigned initialCapacity)
: JSCell(vm, vm.propertyTableStructure.get())
, m_indexSize(sizeForCapacity(initialCapacity))
, m_indexMask(m_indexSize - 1)
, m_index(static_cast<unsigned*>(fastZeroedMalloc(dataSize())))
, m_keyCount(0)
, m_deletedCount(0)
{
ASSERT(isPowerOf2(m_indexSize));
}
开发者ID:3163504123,项目名称:phantomjs,代码行数:10,代码来源:PropertyTable.cpp
示例5: dataSize
void BoxCurve::draw(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const {
if (!painter || dataSize() <= 0) return;
int size = dataSize();
if (to < 0) to = size - 1;
painter->save();
painter->setPen(QwtPlotCurve::pen());
double *dat = new double[size];
for (int i = from; i <= to; i++) dat[i] = y(i);
drawBox(painter, xMap, yMap, dat, size);
drawSymbols(painter, xMap, yMap, dat, size);
painter->restore();
delete[] dat;
}
开发者ID:gitter-badger,项目名称:AlphaPlot,代码行数:19,代码来源:BoxCurve.cpp
示例6: plot
double QwtBarCurve::dataOffset()
{
if (bar_style == Vertical)
{
const QwtScaleMap &xMap = plot()->canvasMap(xAxis());
int dx = abs(xMap.transform(x(1))-xMap.transform(x(0)));
double bar_width = dx*(1-bar_gap*0.01);
if (plot()->isVisible())
{
for (int i = 2; i<dataSize(); i++)
{
int min = abs(xMap.transform(x(i+1))-xMap.transform(x(i)));
if (min <= dx)
dx=min;
}
int x1 = xMap.transform(minXValue()) + int(bar_offset*0.01*bar_width);
return xMap.invTransform(x1) - minXValue();
}
else
return 0.5*bar_offset*0.01*bar_width;
}
else
{
const QwtScaleMap &yMap = plot()->canvasMap(yAxis());
int dy = abs(yMap.transform(y(1))-yMap.transform(y(0)));
double bar_width = dy*(1-bar_gap*0.01);
if (plot()->isVisible())
{
for (int i=2; i<dataSize(); i++)
{
int min = abs(yMap.transform(y(i+1))-yMap.transform(y(i)));
if (min <= dy)
dy=min;
}
int y1 = yMap.transform(minYValue()) + int(bar_offset*0.01*bar_width);
return yMap.invTransform(y1) - minYValue();
}
else
return 0.5*bar_offset*0.01*bar_width;
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:42,代码来源:QwtBarCurve.cpp
示例7: dataSize
bool MobileRecordStore::_resetDataSizeIfNeeded(OperationContext* opCtx, int64_t newDataSize) {
bool wasReset = false;
int64_t currDataSize = dataSize(opCtx);
if (currDataSize != _dataSize) {
wasReset = true;
stdx::lock_guard<stdx::mutex> lock(_dataSizeMutex);
_dataSize = newDataSize;
}
return wasReset;
}
开发者ID:acmorrow,项目名称:mongo,代码行数:11,代码来源:mobile_record_store.cpp
示例8: numRecords
/**
* SQLite does not directly support truncate. The SQLite documentation recommends a DELETE
* statement without a WHERE clause. A Truncate Optimizer deletes all of the table content
* without having to visit each row of the table individually.
*/
Status MobileRecordStore::truncate(OperationContext* opCtx) {
MobileSession* session = MobileRecoveryUnit::get(opCtx)->getSession(opCtx, false);
int64_t numRecsBefore = numRecords(opCtx);
_changeNumRecs(opCtx, -numRecsBefore);
int64_t dataSizeBefore = dataSize(opCtx);
_changeDataSize(opCtx, -dataSizeBefore);
SqliteStatement::execQuery(session, "DELETE FROM \"", _ident, "\";");
return Status::OK();
}
开发者ID:acmorrow,项目名称:mongo,代码行数:17,代码来源:mobile_record_store.cpp
示例9: dataSize
/*!
\brief Checks if a range of indices is valid and corrects it if necessary
\param i1 Index 1
\param i2 Index 2
*/
int QwtCurve::verifyRange(int &i1, int &i2)
{
int size = dataSize();
if (size < 1) return 0;
i1 = qwtLim(i1, 0, size-1);
i2 = qwtLim(i2, 0, size-1);
qwtSort(i1, i2, i1, i2);
return (i2 - i1 + 1);
}
开发者ID:BackupTheBerlios,项目名称:qtiplot-svn,代码行数:17,代码来源:qwt_curve.cpp
示例10: MakMek
EXPORT_C HBufC8* Roap::RRoapStorageClient::GetMeteringDataL(
TDesC8& aRiId,
TDes8& aMacKey,
TDes8& aEncKeyHash,
HBufC8*& aEncryptedMekAndMak )
{
TInt error = KErrNone;
HBufC8* meteringData = NULL;
HBufC8* csBuffer = NULL;
if ( aRiId.Length() )
{
TInt mekAndMakSize = 0;
TInt meteringDataSize = 0;
TPckg<TInt> MakMek( mekAndMakSize );
TPckg<TInt> dataSize( meteringDataSize );
error = SendReceive( Roap::EGetMeteringData, TIpcArgs( &aRiId,
&MakMek, &dataSize ) );
if ( error == KErrNotFound )
{
return NULL;
}
User::LeaveIfError( error );
csBuffer = HBufC8::NewMaxLC( OmaCrypto::KMacSize + SHA1_HASH
+ mekAndMakSize + meteringDataSize );
// Package 'object' into TPtr8.
TPtr8 objectPkg( const_cast<TUint8*> ( csBuffer->Ptr() ),
OmaCrypto::KMacSize + SHA1_HASH + mekAndMakSize
+ meteringDataSize, OmaCrypto::KMacSize + SHA1_HASH
+ mekAndMakSize + meteringDataSize );
User::LeaveIfError( SendReceive( Roap::EGetData,
TIpcArgs( &objectPkg ) ) );
aMacKey = objectPkg.Mid( 0, OmaCrypto::KMacSize );
aEncKeyHash = objectPkg.Mid( OmaCrypto::KMacSize, SHA1_HASH );
aEncryptedMekAndMak = objectPkg.Mid( OmaCrypto::KMacSize + SHA1_HASH,
mekAndMakSize ).AllocL();
meteringData = objectPkg.Mid( OmaCrypto::KMacSize + SHA1_HASH
+ mekAndMakSize, meteringDataSize ).AllocL();
CleanupStack::PopAndDestroy( csBuffer );
}
else
{
User::Leave( KErrArgument );
}
return meteringData;
}
开发者ID:kuailexs,项目名称:symbiandump-mw1,代码行数:53,代码来源:RoapStorageClient.cpp
示例11: JSCell
PropertyTable::PropertyTable(VM& vm, const PropertyTable& other)
: JSCell(vm, vm.propertyTableStructure.get())
, m_indexSize(other.m_indexSize)
, m_indexMask(other.m_indexMask)
, m_index(static_cast<unsigned*>(fastMalloc(dataSize())))
, m_keyCount(other.m_keyCount)
, m_deletedCount(other.m_deletedCount)
{
ASSERT(isPowerOf2(m_indexSize));
memcpy(m_index, other.m_index, dataSize());
iterator end = this->end();
for (iterator iter = begin(); iter != end; ++iter)
iter->key->ref();
// Copy the m_deletedOffsets vector.
Vector<PropertyOffset>* otherDeletedOffsets = other.m_deletedOffsets.get();
if (otherDeletedOffsets)
m_deletedOffsets = std::make_unique<Vector<PropertyOffset>>(*otherDeletedOffsets);
}
开发者ID:eocanha,项目名称:webkit,代码行数:21,代码来源:PropertyTable.cpp
示例12: runtime_error
void
AAKR::add(Math::Matrix v)
{
if (dataSize() == 0)
throw std::runtime_error("unable to add: data window size is undefined.");
if (v.rows() != 1)
throw std::runtime_error("unable to add: new sample is not a row vector.");
if (sampleSize() == 0)
m_data.resize(dataSize(), v.columns());
if ((unsigned)v.columns() != sampleSize())
throw std::runtime_error("unable to add: sample size does not match.");
// Write to the data set.
m_data.set(m_index, m_index, 0, sampleSize() - 1, v);
// Increment data set index.
increment();
}
开发者ID:posilva,项目名称:dune,代码行数:21,代码来源:AAKR.cpp
示例13: drawDots
/*!
Draw a subset of the points
\param painter Painter
\param xMap Maps x-values into pixel coordinates.
\param yMap Maps y-values into pixel coordinates.
\param canvasRect Contents rectangle of the canvas
\param from Index of the first sample to be painted
\param to Index of the last sample to be painted. If to < 0 the
series will be painted to its last sample.
\sa drawDots()
*/
void
CpPlotCurve::drawSeries( QPainter *painter,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
const QRectF &canvasRect, int from, int to ) const
{
if ( !painter || dataSize() <= 0 )
return;
if ( to < 0 )
to = dataSize() - 1;
if ( from < 0 )
from = 0;
if ( from > to )
return;
//drawDots( painter, xMap, yMap, canvasRect, from, to );
// Not working, to debug...
drawLines( painter, xMap, yMap, canvasRect, from, to );
}
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:35,代码来源:CpPlotCurve.cpp
示例14: needsDelete
bool KVRecordStoreCapped::needsDelete(OperationContext* txn) const {
if (dataSize(txn) >= _cappedMaxSize) {
// .. too many bytes
return true;
}
if ((_cappedMaxDocs != -1) && (numRecords(txn) > _cappedMaxDocs)) {
// .. too many documents
return true;
}
// we're ok
return false;
}
开发者ID:kingfs,项目名称:tokumxse,代码行数:14,代码来源:kv_record_store_capped.cpp
示例15: dataSize
void QwtPieCurve::draw(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, int from, int to) const {
int size = dataSize();
if (!painter || size <= 0)
return;
if (to < 0)
to = size - 1;
if (size > 1)
drawSlices(painter, xMap, yMap, from, to);
else
drawDisk(painter, xMap, yMap);
}
开发者ID:liyulun,项目名称:mantid,代码行数:14,代码来源:QwtPieCurve.cpp
示例16: qDebug
void SftpIncomingPacket::consumeData(QByteArray &newData)
{
#ifdef CREATOR_SSH_DEBUG
qDebug("%s: current data size = %d, new data size = %d", Q_FUNC_INFO,
m_data.size(), newData.size());
#endif
if (isComplete() || dataSize() + newData.size() < sizeof m_length)
return;
if (dataSize() < sizeof m_length) {
moveFirstBytes(m_data, newData, sizeof m_length - m_data.size());
m_length = SshPacketParser::asUint32(m_data, static_cast<quint32>(0));
if (m_length < static_cast<quint32>(TypeOffset + 1)
|| m_length > MaxPacketSize) {
throw SSH_SERVER_EXCEPTION(SSH_DISCONNECT_PROTOCOL_ERROR,
"Invalid length field in SFTP packet.");
}
}
moveFirstBytes(m_data, newData,
qMin<quint32>(m_length - dataSize() + 4, newData.size()));
}
开发者ID:nwpc,项目名称:diagnose-playground,代码行数:23,代码来源:sftpincomingpacket.cpp
示例17:
void
AAKR::resize(unsigned r, unsigned c)
{
m_index = 0;
m_num_values = 0;
if (r == dataSize() && c == sampleSize())
return;
m_data.resizeAndFill(r, c, 0.0);
m_norm = m_data;
m_distances.resizeAndFill(r, 1, 0.0);
m_weights.resizeAndFill(r, 1, 0.0);
}
开发者ID:posilva,项目名称:dune,代码行数:14,代码来源:AAKR.cpp
示例18: switch
void QwtPlotCurve::drawCurve(QPainter *painter, int style,
const QwtScaleMap &xMap, const QwtScaleMap &yMap,
int from, int to) const
{
const int numPoints = (int)dataSize();
if (!painter || numPoints < 1)
return;
if (to < 0 || to >= numPoints)
to = numPoints - 1;
switch (style)
{
case Lines:
if ( testCurveAttribute(Fitted) )
{
// we always need the complete
// curve for fitting
from = 0;
to = dataSize() - 1;
}
drawLines(painter, xMap, yMap, from, to);
break;
case Sticks:
drawSticks(painter, xMap, yMap, from, to);
break;
case Steps:
drawSteps(painter, xMap, yMap, from, to);
break;
case Dots:
drawDots(painter, xMap, yMap, from, to);
break;
case NoCurve:
default:
break;
}
}
开发者ID:kuzavas,项目名称:qtiplot,代码行数:37,代码来源:qwt_plot_curve.cpp
示例19: Q_D
QVector<QVector4D> QAttribute::asVector4D() const
{
Q_D(const QAttribute);
const QByteArray buffer = d->m_buffer->data();
const char *rawBuffer = buffer.constData();
rawBuffer += d->m_byteOffset;
const float* fptr;
int stride;
switch (dataType()) {
case QAttribute::Float:
stride = sizeof(float) * dataSize();
break;
default:
qCDebug(Render::Io) << Q_FUNC_INFO << "can't convert" << dataType() << "x" << dataSize() << "to QVector3D";
return QVector<QVector4D>();
}
if (d->m_byteStride != 0)
stride = d->m_byteStride;
QVector<QVector4D> result;
result.resize(d->m_count);
for (uint c = 0; c < d->m_count; ++c) {
QVector4D v;
fptr = reinterpret_cast<const float*>(rawBuffer);
for (uint i = 0, m = dataSize(); i < m; ++i)
v[i] = fptr[i];
result[c] = v;
rawBuffer += stride;
}
return result;
}
开发者ID:James-intern,项目名称:Qt,代码行数:37,代码来源:qattribute.cpp
示例20: dataSize
MemoryTablePrivate::Error MemoryTablePrivate::insert(const key_type &key, const value_type &value, TableMetadata *table)
{
const quint32 valueSize = dataSize(value);
IndexElement *tableEnd = end(table);
IndexElement *position = std::lower_bound(begin(table), tableEnd, key);
if (position != tableEnd && position->key == key) {
// This is a replacement - the item has an allocation already
Allocation *allocation = allocationAt(position->offset, table);
if (allocation->size < requiredSpace(valueSize)) {
// Replace the existing allocation with a bigger one
quint32 newOffset = allocate(valueSize, table, false);
if (!newOffset)
return MemoryTable::InsufficientSpace;
deallocate(position->offset, table);
position->offset = newOffset;
} else {
// Reuse this allocation
// TODO: swap with a better fit from the free list?
}
} else {
// This item needs to be added to the index
if (table->count == std::numeric_limits<quint32>::max())
return MemoryTable::InsufficientSpace;
quint32 offset = allocate(valueSize, table, true);
if (!offset)
return MemoryTable::InsufficientSpace;
// For index insertion, move the displaced elements of the index
if (position != tableEnd)
std::memmove(position + 1, position, (tableEnd - position) * sizeof(IndexElement));
++(table->count);
position->key = key;
position->offset = offset;
}
Q_ASSERT(contains(key, table));
// Ensure that the data allocation does not overlap the index space
Q_ASSERT((reinterpret_cast<char *>(table) + table->freeOffset) >= reinterpret_cast<char *>(end(table)));
// Update the value stored at the position
updateValue(value, valueSize, position->offset, table);
return MemoryTable::NoError;
}
开发者ID:amtep,项目名称:qtcontacts-sqlite,代码行数:49,代码来源:memorytable.cpp
注:本文中的dataSize函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论