本文整理汇总了C++中clearCache函数的典型用法代码示例。如果您正苦于以下问题:C++ clearCache函数的具体用法?C++ clearCache怎么用?C++ clearCache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clearCache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: int
// Interpolate table (linearly) to some specific k:
// x any y in physical units (to be divided by dx for indices)
double XTable::interpolate(double x, double y, const Interpolant2d& interp) const
{
xdbg << "interpolating " << x << " " << y << " " << std::endl;
x /= _dx;
y /= _dx;
int ixMin, ixMax, iyMin, iyMax;
if ( interp.isExactAtNodes()
&& std::abs(x - std::floor(x+0.01)) < 10.*std::numeric_limits<double>::epsilon()) {
// x coord lies right on integer value, no interpolation in x direction
ixMin = ixMax = int(std::floor(x+0.01));
} else {
ixMin = int(std::ceil(x-interp.xrange()));
ixMax = int(std::floor(x+interp.xrange()));
}
ixMin = std::max(ixMin, -_N/2);
ixMax = std::min(ixMax, _N/2-1);
if (ixMin > ixMax) return 0.;
if ( interp.isExactAtNodes()
&& std::abs(y - std::floor(y+0.01)) < 10.*std::numeric_limits<double>::epsilon()) {
// y coord lies right on integer value, no interpolation in y direction
iyMin = iyMax = int(std::floor(y+0.01));
} else {
iyMin = int(std::ceil(y-interp.xrange()));
iyMax = int(std::floor(y+interp.xrange()));
}
iyMin = std::max(iyMin, -_N/2);
iyMax = std::min(iyMax, _N/2-1);
if (iyMin > iyMax) return 0.;
double sum = 0.;
const InterpolantXY* ixy = dynamic_cast<const InterpolantXY*> (&interp);
if (ixy) {
// Interpolant is seperable
// We have the opportunity to speed up the calculation by
// re-using the sums over rows. So we will keep a
// cache of them.
if (x != _cacheX || ixy != _cacheInterp) {
clearCache();
_cacheX = x;
_cacheInterp = ixy;
} else if (iyMax==iyMin && !_cache.empty()) {
// Special case for interpolation on a single iy value:
// See if we already have this row in cache:
int index = iyMin - _cacheStartY;
if (index < 0) index += _N;
if (index < int(_cache.size()))
// We have it!
return _cache[index];
else
// Desired row not in cache - kill cache, continue as normal.
// (But don't clear xwt, since that's still good.)
_cache.clear();
}
// Build x factors for interpolant
int nx = ixMax - ixMin + 1;
// This is also cached if possible. It gets cleared when kx != cacheX above.
if (_xwt.empty()) {
_xwt.resize(nx);
for (int i=0; i<nx; i++)
_xwt[i] = ixy->xval1d(i+ixMin-x);
} else {
assert(int(_xwt.size()) == nx);
}
// cache always holds sequential y values (no wrap). Throw away
// elements until we get to the one we need first
std::deque<double>::iterator nextSaved = _cache.begin();
while (nextSaved != _cache.end() && _cacheStartY != iyMin) {
_cache.pop_front();
_cacheStartY++;
nextSaved = _cache.begin();
}
for (int iy = iyMin; iy<=iyMax; iy++) {
double sumy = 0.;
if (nextSaved != _cache.end()) {
// This row is cached
sumy = *nextSaved;
++nextSaved;
} else {
// Need to compute a new row's sum
const double* dptr = _array.get() + index(ixMin, iy);
std::vector<double>::const_iterator xwt_it = _xwt.begin();
int count = nx;
for(; count; --count) sumy += (*xwt_it++) * (*dptr++);
assert(xwt_it == _xwt.end());
// Add to back of cache
if (_cache.empty()) _cacheStartY = iy;
_cache.push_back(sumy);
nextSaved = _cache.end();
}
sum += sumy * ixy->xval1d(iy-y);
}
} else {
// Interpolant is not seperable, calculate weight at each point
for (int iy = iyMin; iy<=iyMax; iy++) {
//.........这里部分代码省略.........
开发者ID:alexabate,项目名称:GalSim,代码行数:101,代码来源:FFT.cpp
示例2: clearCache
void Territory::insert(Position pos) {
allSquaresVec.push_back(pos);
allSquares.insert(pos);
clearCache();
}
开发者ID:Knochenschaeler,项目名称:keeperrl,代码行数:5,代码来源:territory.cpp
示例3: m_pCollection
LibraryScanner::LibraryScanner(QWidget* pParentWidget,
TrackCollection* collection,
UserSettingsPointer pConfig)
: m_pCollection(collection),
m_libraryHashDao(m_database),
m_cueDao(m_database),
m_playlistDao(m_database),
m_crateDao(m_database),
m_directoryDao(m_database),
m_analysisDao(m_database, pConfig),
m_trackDao(m_database, m_cueDao, m_playlistDao,
m_crateDao, m_analysisDao, m_libraryHashDao,
pConfig),
m_stateSema(1), // only one transaction is possible at a time
m_state(IDLE) {
// Don't initialize m_database here, we need to do it in run() so the DB
// conn is in the right thread.
qDebug() << "Starting LibraryScanner thread.";
// Move LibraryScanner to its own thread so that our signals/slots will
// queue to our event loop.
moveToThread(this);
m_pool.moveToThread(this);
unsigned static id = 0; // the id of this LibraryScanner, for debugging purposes
setObjectName(QString("LibraryScanner %1").arg(++id));
m_pool.setMaxThreadCount(kScannerThreadPoolSize);
// Listen to signals from our public methods (invoked by other threads) and
// connect them to our slots to run the command on the scanner thread.
connect(this, SIGNAL(startScan()),
this, SLOT(slotStartScan()));
// Force the GUI thread's TrackInfoObject cache to be cleared when a library
// scan is finished, because we might have modified the database directly
// when we detected moved files, and the TIOs corresponding to the moved
// files would then have the wrong track location.
if (collection != NULL) { // false only during test
TrackDAO* dao = &(collection->getTrackDAO());
connect(this, SIGNAL(scanFinished()), dao, SLOT(clearCache()));
connect(this, SIGNAL(trackAdded(TrackPointer)),
dao, SLOT(databaseTrackAdded(TrackPointer)));
connect(this, SIGNAL(tracksMoved(QSet<TrackId>, QSet<TrackId>)),
dao, SLOT(databaseTracksMoved(QSet<TrackId>, QSet<TrackId>)));
connect(this, SIGNAL(tracksChanged(QSet<TrackId>)),
dao, SLOT(databaseTracksChanged(QSet<TrackId>)));
}
// Parented to pParentWidget so we don't need to delete it.
LibraryScannerDlg* pProgress = new LibraryScannerDlg(pParentWidget);
connect(this, SIGNAL(progressLoading(QString)),
pProgress, SLOT(slotUpdate(QString)));
connect(this, SIGNAL(progressHashing(QString)),
pProgress, SLOT(slotUpdate(QString)));
connect(this, SIGNAL(scanStarted()),
pProgress, SLOT(slotScanStarted()));
connect(this, SIGNAL(scanFinished()),
pProgress, SLOT(slotScanFinished()));
connect(pProgress, SIGNAL(scanCancelled()),
this, SLOT(slotCancel()));
connect(&m_trackDao, SIGNAL(progressVerifyTracksOutside(QString)),
pProgress, SLOT(slotUpdate(QString)));
connect(&m_trackDao, SIGNAL(progressCoverArt(QString)),
pProgress, SLOT(slotUpdateCover(QString)));
start();
}
开发者ID:amoghpc,项目名称:mixxx,代码行数:68,代码来源:libraryscanner.cpp
示例4: removeElement
void Territory::remove(Position pos) {
removeElement(allSquaresVec, pos);
allSquares.erase(pos);
clearCache();
}
开发者ID:LibreGames,项目名称:keeperrl,代码行数:5,代码来源:territory.cpp
示例5: clearCache
QgsAbstractGeometry* QgsGeometryCollection::geometryN( int n )
{
clearCache();
return mGeometries.value( n );
}
开发者ID:liminlu0314,项目名称:QGIS,代码行数:5,代码来源:qgsgeometrycollection.cpp
示例6: clearCache
GLES2StateCacheManagerImp::GLES2StateCacheManagerImp(void)
{
clearCache();
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:4,代码来源:OgreGLES2NullStateCacheManagerImp.cpp
示例7: clearCache
void FontManager::setDefaultGlyphLoadFlags(const Flags<FontFace::GlyphLoadFlags>& flags)
{
clearCache();
m_defaultLoadFlags = flags;
}
开发者ID:tylerreisinger,项目名称:rogueframework,代码行数:5,代码来源:FontManager.cpp
示例8: clearCache
void EntityDefinitionManager::updateCache() {
clearCache();
for (EntityDefinition* definition : m_definitions)
m_cache[definition->name()] = definition;
}
开发者ID:kduske,项目名称:TrenchBroom,代码行数:5,代码来源:EntityDefinitionManager.cpp
示例9: clearCache
btGImpactCollisionAlgorithm::~btGImpactCollisionAlgorithm()
{
clearCache();
}
开发者ID:halogenica,项目名称:Aggrogate,代码行数:4,代码来源:btGImpactCollisionAlgorithm.cpp
示例10: clearCache
KateSyntaxDocument::~KateSyntaxDocument()
{
// cleanup, else we have a memory leak!
clearCache();
}
开发者ID:KDE,项目名称:ktexteditor,代码行数:5,代码来源:katesyntaxdocument.cpp
示例11: close
int close()
{ clearCache(); return 0; }
开发者ID:ewwink,项目名称:openlitespeed,代码行数:2,代码来源:chunkostest.cpp
示例12: gpgme_release
KGpgMe::~KGpgMe()
{
if (m_ctx)
gpgme_release(m_ctx);
clearCache();
}
开发者ID:AlD,项目名称:basket,代码行数:6,代码来源:kgpgme.cpp
示例13: qDeleteAll
void QgsGeometryCollection::clear()
{
qDeleteAll( mGeometries );
mGeometries.clear();
clearCache(); //set bounding box invalid
}
开发者ID:liminlu0314,项目名称:QGIS,代码行数:6,代码来源:qgsgeometrycollection.cpp
示例14: addMenu
//.........这里部分代码省略.........
avatar.get(), SLOT(updateMotionBehaviorFromMenu()),
UNSPECIFIED_POSITION, "Developer");
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ScriptedMotorControl, 0, true,
avatar.get(), SLOT(updateMotionBehaviorFromMenu()),
UNSPECIFIED_POSITION, "Developer");
addCheckableActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::ShowTrackedObjects, 0, false, qApp, SLOT(setShowTrackedObjects(bool)));
addActionToQMenuAndActionHash(avatarDebugMenu, MenuOption::PackageModel, 0, qApp, SLOT(packageModel()));
// Developer > Hands >>>
MenuWrapper* handOptionsMenu = developerMenu->addMenu("Hands");
addCheckableActionToQMenuAndActionHash(handOptionsMenu, MenuOption::DisplayHandTargets, 0, false,
avatar.get(), SLOT(setEnableDebugDrawHandControllers(bool)));
// Developer > Entities >>>
MenuWrapper* entitiesOptionsMenu = developerMenu->addMenu("Entities");
addActionToQMenuAndActionHash(entitiesOptionsMenu, MenuOption::OctreeStats, 0,
qApp, SLOT(loadEntityStatisticsDialog()));
addCheckableActionToQMenuAndActionHash(entitiesOptionsMenu, MenuOption::ShowRealtimeEntityStats);
// Developer > Network >>>
MenuWrapper* networkMenu = developerMenu->addMenu("Network");
action = addActionToQMenuAndActionHash(networkMenu, MenuOption::Networking);
connect(action, &QAction::triggered, [] {
qApp->showDialog(QString("hifi/dialogs/NetworkingPreferencesDialog.qml"),
QString("hifi/tablet/TabletNetworkingPreferences.qml"), "NetworkingPreferencesDialog");
});
addActionToQMenuAndActionHash(networkMenu, MenuOption::ReloadContent, 0, qApp, SLOT(reloadResourceCaches()));
addActionToQMenuAndActionHash(networkMenu, MenuOption::ClearDiskCache, 0,
DependencyManager::get<AssetClient>().data(), SLOT(clearCache()));
addCheckableActionToQMenuAndActionHash(networkMenu,
MenuOption::DisableActivityLogger,
0,
false,
&UserActivityLogger::getInstance(),
SLOT(disable(bool)));
addActionToQMenuAndActionHash(networkMenu, MenuOption::ShowDSConnectTable, 0,
qApp, SLOT(loadDomainConnectionDialog()));
#if (PR_BUILD || DEV_BUILD)
addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::SendWrongProtocolVersion, 0, false,
qApp, SLOT(sendWrongProtocolVersionsSignature(bool)));
{
auto nodeList = DependencyManager::get<NodeList>();
addCheckableActionToQMenuAndActionHash(networkMenu, MenuOption::SendWrongDSConnectVersion, 0, false,
nodeList.data(), SLOT(toggleSendNewerDSConnectVersion(bool)));
}
#endif
// Developer >> Tests >>>
MenuWrapper* testMenu = developerMenu->addMenu("Tests");
addActionToQMenuAndActionHash(testMenu, MenuOption::RunClientScriptTests, 0, dialogsManager.data(), SLOT(showTestingResults()));
// Developer > Timing >>>
MenuWrapper* timingMenu = developerMenu->addMenu("Timing");
MenuWrapper* perfTimerMenu = timingMenu->addMenu("Performance Timer");
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::DisplayDebugTimingDetails, 0, false,
qApp, SLOT(enablePerfStats(bool)));
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true);
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandUpdateTiming, 0, false);
开发者ID:Menithal,项目名称:hifi,代码行数:67,代码来源:Menu.cpp
示例15: clearCache
void QgsLineString::swapXy()
{
std::swap( mX, mY );
clearCache();
}
开发者ID:rouault,项目名称:Quantum-GIS,代码行数:5,代码来源:qgslinestring.cpp
示例16: clearCache
BlockFileIO::~BlockFileIO()
{
clearCache( _cache, _blockSize );
delete[] _cache.data;
}
开发者ID:AbbsFarshidi,项目名称:cryptonite,代码行数:5,代码来源:BlockFileIO.cpp
示例17: testChromOrder
bool CloseSweep::chromChange(int dbIdx, RecordKeyVector &retList, bool wantScan)
{
Record *dbRec = _currDbRecs[dbIdx];
bool haveQuery = _currQueryRec != NULL;
bool haveDB = dbRec != NULL;
if (haveQuery && _currQueryChromName != _prevQueryChromName) {
_context->testNameConventions(_currQueryRec);
testChromOrder(_currQueryRec);
}
if (haveDB) {
_context->testNameConventions(dbRec);
testChromOrder(dbRec);
}
// the files are on the same chrom
if (haveQuery && (!haveDB || _currQueryRec->sameChrom(dbRec))) {
//if this is the first time the query's chrom is ahead of the chrom that was in this cache,
//then we have to clear the cache.
if (!_caches[dbIdx].empty() && queryChromAfterDbRec(_caches[dbIdx].begin()->value())) {
clearCache(dbIdx);
clearClosestEndPos(dbIdx);
}
return false;
}
if (!haveQuery || !haveDB) return false;
if (!_caches[dbIdx].empty() && (_caches[dbIdx].begin()->value()->sameChrom(_currQueryRec))) {
//the newest DB record's chrom is ahead of the query, but the cache still
//has old records on that query's chrom
scanCache(dbIdx, retList);
finalizeSelections(dbIdx, retList);
return true;
}
// the query is ahead of the database. fast-forward the database to catch-up.
if (queryChromAfterDbRec(dbRec)) {
string oldDbChrom(dbRec->getChrName());
while (dbRec != NULL &&
queryChromAfterDbRec(dbRec)) {
_dbFRMs[dbIdx]->deleteRecord(dbRec);
if (!nextRecord(false, dbIdx)) break;
dbRec = _currDbRecs[dbIdx];
const string &newDbChrom = dbRec->getChrName();
if (newDbChrom != oldDbChrom) {
testChromOrder(dbRec);
oldDbChrom = newDbChrom;
}
}
clearCache(dbIdx);
clearClosestEndPos(dbIdx);
return false;
}
// the database is ahead of the query.
else {
// 1. scan the cache for remaining hits on the query's current chrom.
if (wantScan) scanCache(dbIdx, retList);
return true;
}
//control can't reach here, but compiler still wants a return statement.
return true;
}
开发者ID:nkindlon,项目名称:bedtools2,代码行数:70,代码来源:CloseSweep.cpp
示例18: DEBUG_ASSERT
SINT SoundSourceFFmpeg::seekSampleFrame(SINT frameIndex) {
DEBUG_ASSERT(isValidFrameIndex(frameIndex));
int ret = 0;
qint64 i = 0;
struct ffmpegLocationObject *l_STestObj = nullptr;
if (frameIndex < 0 || frameIndex < m_lCacheStartFrame) {
// Seek to set (start of the stream which is FFmpeg frame 0)
// because we are dealing with compressed audio FFmpeg takes
// best of to seek that point (in this case 0 Is always there)
// in every other case we should provide MIN and MAX tolerance
// which we can take.
// FFmpeg just just can't take zero as MAX tolerance so we try to
// just make some tolerable (which is never used because zero point
// should always be there) some number (which is 0xffff 65535)
// that is chosen because in WMA frames can be that big and if it's
// smaller than the frame we are seeking we can get into error
ret = avformat_seek_file(m_pFormatCtx,
m_iAudioStream,
0,
0,
0xffff,
AVSEEK_FLAG_BACKWARD);
if (ret < 0) {
qDebug() << "SoundSourceFFmpeg::seek: Can't seek to 0 byte!";
return -1;
}
clearCache();
m_lCacheStartFrame = 0;
m_lCacheEndFrame = 0;
m_lCacheLastPos = 0;
m_lCacheFramePos = 0;
m_lStoredSeekPoint = -1;
// Try to find some jump point near to
// where we are located so we don't needed
// to try guess it
if (m_SJumpPoints.size() > 0) {
l_STestObj = m_SJumpPoints.first();
if (frameIndex > l_STestObj->startFrame) {
for (i = 0; i < m_SJumpPoints.size(); i++) {
if (m_SJumpPoints[i]->startFrame >= frameIndex) {
if (i > 0) {
i--;
}
m_lCacheFramePos = m_SJumpPoints[i]->startFrame;
m_lStoredSeekPoint = m_SJumpPoints[i]->pos;
m_SStoredJumpPoint = m_SJumpPoints[i];
break;
}
}
}
}
if (frameIndex == 0) {
// Because we are in the beginning just read cache full
// but leave 50 of just in case
// -1 one means we are seeking from current position and
// filling the cache
readFramesToCache((AUDIOSOURCEFFMPEG_CACHESIZE - 50),
AUDIOSOURCEFFMPEG_FILL_FROM_CURRENTPOS);
}
}
if (m_lCacheEndFrame <= frameIndex) {
// Cache tries to read until it gets to frameIndex
// after that we still read 100 FFmpeg frames to memory
// so we have good cache to go forward (100) and backward (900)
// from the point
readFramesToCache(100, frameIndex);
}
m_currentMixxxFrameIndex = frameIndex;
m_bIsSeeked = true;
return frameIndex;
}
开发者ID:22degrees,项目名称:mixxx,代码行数:84,代码来源:soundsourceffmpeg.cpp
示例19: setZMTypeFromSubGeometry
void QgsLineString::append( const QgsLineString *line )
{
if ( !line )
{
return;
}
if ( numPoints() < 1 )
{
setZMTypeFromSubGeometry( line, QgsWkbTypes::LineString );
}
// do not store duplicit points
if ( numPoints() > 0 &&
line->numPoints() > 0 &&
endPoint() == line->startPoint() )
{
mX.pop_back();
mY.pop_back();
if ( is3D() )
{
mZ.pop_back();
}
if ( isMeasure() )
{
mM.pop_back();
}
}
mX += line->mX;
mY += line->mY;
if ( is3D() )
{
if ( line->is3D() )
{
mZ += line->mZ;
}
else
{
// if append line does not have z coordinates, fill with NaN to match number of points in final line
mZ.insert( mZ.count(), mX.size() - mZ.size(), std::numeric_limits<double>::quiet_NaN() );
}
}
if ( isMeasure() )
{
if ( line->isMeasure() )
{
mM += line->mM;
}
else
{
// if append line does not have m values, fill with NaN to match number of points in final line
mM.insert( mM.count(), mX.size() - mM.size(), std::numeric_limits<double>::quiet_NaN() );
}
}
clearCache(); //set bounding box invalid
}
开发者ID:rouault,项目名称:Quantum-GIS,代码行数:61,代码来源:qgslinestring.cpp
示例20: clearCache
void PThreadProcessingDevice::clear() { // delete?
clearCache();
clearResult();
}
开发者ID:BGCX261,项目名称:ziphmm-svn-to-git,代码行数:4,代码来源:PThreadProcessingDevice.cpp
注:本文中的clearCache函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论