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 164 of file BlockHasher.cpp.

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

References mWorkers.

◆ IsReady()

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

Definition at line 185 of file BlockHasher.cpp.

186{
187 return mWorkers != nullptr && mWorkers->IsReady();
188}

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 190 of file BlockHasher.cpp.

191{
192 if (mWorkers == nullptr)
193 return {};
194
195 return mWorkers->TakeResult();
196}

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: