本文整理汇总了C++中BlockFile::GetSpaceUsage方法的典型用法代码示例。如果您正苦于以下问题:C++ BlockFile::GetSpaceUsage方法的具体用法?C++ BlockFile::GetSpaceUsage怎么用?C++ BlockFile::GetSpaceUsage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BlockFile
的用法示例。
在下文中一共展示了BlockFile::GetSpaceUsage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CalculateSpaceUsage
// get the sum of the sizes of all blocks this track list
// references. However, if a block is referred to multiple
// times it is only counted once. Return value is in bytes.
wxLongLong UndoManager::CalculateSpaceUsage(int index)
{
TrackListOfKindIterator iter(Track::Wave);
WaveTrack *wt;
WaveClipList::compatibility_iterator it;
BlockArray *blocks;
unsigned int i;
// get a map of all blocks referenced in this TrackList
std::map<BlockFile*, wxLongLong> cur;
wt = (WaveTrack *) iter.First(stack[index]->tracks);
while (wt) {
for (it = wt->GetClipIterator(); it; it = it->GetNext()) {
blocks = it->GetData()->GetSequenceBlockArray();
for (i = 0; i < blocks->GetCount(); i++)
{
BlockFile* pBlockFile = blocks->Item(i)->f;
if (pBlockFile->GetFileName().FileExists())
cur[pBlockFile] = pBlockFile->GetSpaceUsage();
}
}
wt = (WaveTrack *) iter.Next();
}
if (index > 0) {
// get a set of all blocks referenced in all prev TrackList
std::set<BlockFile*> prev;
while (--index) {
wt = (WaveTrack *) iter.First(stack[index]->tracks);
while (wt) {
for (it = wt->GetClipIterator(); it; it = it->GetNext()) {
blocks = it->GetData()->GetSequenceBlockArray();
for (i = 0; i < blocks->GetCount(); i++) {
prev.insert(blocks->Item(i)->f);
}
}
wt = (WaveTrack *) iter.Next();
}
}
// remove all blocks in prevBlockFiles from curBlockFiles
std::set<BlockFile*>::const_iterator prevIter;
for (prevIter = prev.begin(); prevIter != prev.end(); prevIter++) {
cur.erase(*prevIter);
}
}
// sum the sizes of the blocks remaining in curBlockFiles;
wxLongLong bytes = 0;
std::map<BlockFile*, wxLongLong>::const_iterator curIter;
for (curIter = cur.begin(); curIter != cur.end(); curIter++) {
bytes += curIter->second;
}
return bytes;
}
示例2: CalculateSpaceUsage
void UndoManager::CalculateSpaceUsage()
{
TIMER_START( "CalculateSpaceUsage", space_calc );
TrackListOfKindIterator iter(Track::Wave);
space.Clear();
space.Add(0, stack.GetCount());
Set s1, s2;
Set *prev = &s1;
Set *cur = &s2;
for (size_t i = 0, cnt = stack.GetCount(); i < cnt; i++)
{
// Swap map pointers
std::swap(cur, prev);
// And clean out the NEW current map
cur->clear();
// Scan all tracks at current level
WaveTrack *wt = (WaveTrack *) iter.First(stack[i]->tracks);
while (wt)
{
// Scan all clips within current track
WaveClipList::compatibility_iterator it = wt->GetClipIterator();
while (it)
{
// Scan all blockfiles within current clip
BlockArray *blocks = it->GetData()->GetSequenceBlockArray();
for (size_t b = 0, cnt = blocks->size(); b < cnt; b++)
{
BlockFile *file = (*blocks)[b].f;
// Accumulate space used by the file if the file didn't exist
// in the previous level
if (prev->count(file) == 0 && cur->count(file) == 0)
{
space[i] += file->GetSpaceUsage().GetValue();
}
// Add file to current set
cur->insert(file);
}
it = it->GetNext();
}
wt = (WaveTrack *) iter.Next();
}
}
TIMER_STOP( space_calc );
}