Audacity 3.2.0
Classes | Public Member Functions | Private Attributes | List of all members
audacity::cloud::audiocom::sync::BlockHasher Class Referencefinal

#include <BlockHasher.h>

Collaboration diagram for audacity::cloud::audiocom::sync::BlockHasher:
[legend]

Classes

class  Workers
 

Public Member Functions

 BlockHasher ()
 
 ~BlockHasher ()
 
 BlockHasher (const BlockHasher &)=delete
 
 BlockHasher (BlockHasher &&)=delete
 
BlockHasheroperator= (const BlockHasher &)=delete
 
BlockHasheroperator= (BlockHasher &&)=delete
 
bool ComputeHashes (BlockHashCache &cache, std::vector< LockedBlock > blocks, std::function< void()> onComplete)
 
bool IsReady () const
 
std::vector< std::pair< int64_t, std::string > > TakeResult ()
 

Private Attributes

std::unique_ptr< WorkersmWorkers
 

Detailed Description

Definition at line 33 of file BlockHasher.h.

Constructor & Destructor Documentation

◆ BlockHasher() [1/3]

audacity::cloud::audiocom::sync::BlockHasher::BlockHasher ( )
default

◆ ~BlockHasher()

audacity::cloud::audiocom::sync::BlockHasher::~BlockHasher ( )
default

◆ BlockHasher() [2/3]

audacity::cloud::audiocom::sync::BlockHasher::BlockHasher ( const BlockHasher )
delete

◆ BlockHasher() [3/3]

audacity::cloud::audiocom::sync::BlockHasher::BlockHasher ( BlockHasher &&  )
delete

Member Function Documentation

◆ ComputeHashes()

bool audacity::cloud::audiocom::sync::BlockHasher::ComputeHashes ( BlockHashCache cache,
std::vector< LockedBlock blocks,
std::function< void()>  onComplete 
)

Definition at line 160 of file BlockHasher.cpp.

163{
164 if (mWorkers != nullptr && !mWorkers->IsReady())
165 return false;
166
167 if (blocks.empty())
168 {
169 if (onComplete)
170 onComplete();
171
172 return true;
173 }
174
175 mWorkers = std::make_unique<Workers>(
176 cache, std::move(blocks), std::move(onComplete));
177
178 return true;
179}
std::unique_ptr< Workers > mWorkers
Definition: BlockHasher.h:50

References mWorkers.

◆ IsReady()

bool audacity::cloud::audiocom::sync::BlockHasher::IsReady ( ) const

Definition at line 181 of file BlockHasher.cpp.

182{
183 return mWorkers != nullptr && mWorkers->IsReady();
184}

References mWorkers.

◆ operator=() [1/2]

BlockHasher & audacity::cloud::audiocom::sync::BlockHasher::operator= ( BlockHasher &&  )
delete

◆ operator=() [2/2]

BlockHasher & audacity::cloud::audiocom::sync::BlockHasher::operator= ( const BlockHasher )
delete

◆ TakeResult()

std::vector< std::pair< int64_t, std::string > > audacity::cloud::audiocom::sync::BlockHasher::TakeResult ( )

Definition at line 186 of file BlockHasher.cpp.

187{
188 if (mWorkers == nullptr)
189 return {};
190
191 return mWorkers->TakeResult();
192}

References mWorkers.

Member Data Documentation

◆ mWorkers

std::unique_ptr<Workers> audacity::cloud::audiocom::sync::BlockHasher::mWorkers
private

Definition at line 51 of file BlockHasher.h.

Referenced by ComputeHashes(), IsReady(), and TakeResult().


The documentation for this class was generated from the following files: