Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator Struct Reference
Collaboration diagram for anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator:

Public Types

using Type = unsigned long long
using SpaceArray = std::vector< Type >

Public Member Functions

Type CalculateUsage (const TrackList &tracks, SampleBlockIDSet &seen)
void Calculate (UndoManager &manager)

Public Attributes

SpaceArray space
Type clipboardSpaceUsage

Detailed Description

Definition at line 55 of file HistoryWindow.cpp.

Member Typedef Documentation

◆ SpaceArray

using anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::SpaceArray = std::vector<Type>

Definition at line 57 of file HistoryWindow.cpp.

◆ Type

using anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::Type = unsigned long long

Definition at line 56 of file HistoryWindow.cpp.

Member Function Documentation

◆ Calculate()

void anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::Calculate ( UndoManager manager)

Definition at line 74 of file HistoryWindow.cpp.

75 {
78 // After copies and pastes, a block file may be used in more than
79 // one place in one undo history state, and it may be used in more than
80 // one undo history state. It might even be used in two states, but not
81 // in another state that is between them -- as when you have state A,
82 // then make a cut to get state B, but then paste it back into state C.
84 // So be sure to count each block file once only, in the last undo item that
85 // contains it.
87 // Why the last and not the first? Because the user of the History dialog
88 // may DELETE undo states, oldest first. To reclaim disk space you must
89 // DELETE all states containing the block file. So the block file's
90 // contribution to space usage should be counted only in that latest
91 // state.
93 manager.VisitStates(
94 [this, &seen](const UndoStackElem &elem) {
95 // Scan all tracks at current level
96 if (auto pTracks = UndoTracks::Find(elem))
97 space.push_back(CalculateUsage(*pTracks, seen));
98 },
99 true // newest state first
100 );
102 // Count the usage of the clipboard separately, using another set. Do not
103 // multiple-count any block occurring multiple times within the clipboard.
104 seen.clear();
106 Clipboard::Get().GetTracks(), seen);
108 //TIMER_STOP( space_calc );
109 }
std::unordered_set< SampleBlockID > SampleBlockIDSet
Definition: CloudSyncDTO.h:27
static const AttachedProjectObjects::RegisteredFactory manager
static Clipboard & Get()
Definition: Clipboard.cpp:28
TRACK_API TrackList * Find(const UndoStackElem &state)
Definition: UndoTracks.cpp:47
Holds one item with description and time range for the UndoManager.
Definition: UndoManager.h:117
Type CalculateUsage(const TrackList &tracks, SampleBlockIDSet &seen)

References UndoTracks::Find(), Clipboard::Get(), and manager.

Here is the call graph for this function:

◆ CalculateUsage()

Type anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::CalculateUsage ( const TrackList tracks,
SampleBlockIDSet seen 

Definition at line 59 of file HistoryWindow.cpp.

60 {
61 Type result = 0;
62 //TIMER_START( "CalculateSpaceUsage", space_calc );
64 tracks,
66 &seen
67 );
68 return result;
69 }
std::function< void(SampleBlockConstPtr) > BlockSpaceUsageAccumulator(unsigned long long &total)
Definition: SampleBlock.h:105
const auto tracks
WAVE_TRACK_API void InspectBlocks(const TrackList &tracks, BlockInspector inspector, SampleBlockIDSet *pIDs=nullptr)

References BlockSpaceUsageAccumulator(), WaveTrackUtilities::InspectBlocks(), and tracks.

Here is the call graph for this function:

Member Data Documentation

◆ clipboardSpaceUsage

Type anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::clipboardSpaceUsage

Definition at line 72 of file HistoryWindow.cpp.

◆ space

SpaceArray anonymous_namespace{HistoryWindow.cpp}::SpaceUsageCalculator::space

Definition at line 71 of file HistoryWindow.cpp.

The documentation for this struct was generated from the following file: