BTHashMaker Class Reference

#include <hashsetmaker.h>

Inheritance diagram for BTHashMaker:

Inheritance graph
[legend]
Collaboration diagram for BTHashMaker:

Collaboration graph
[legend]
List of all members.

Detailed Description

Generates BTHashSet, with varying chunksize.

Uses Sha1Transformer internally. BTHashSet is a tricky one - it doesn't have a file hash at all, to the best of my knowledge. And the chunk size varies. As such, we cannot generate BTHashSet by default at all - only on specific request.

Definition at line 108 of file hashsetmaker.h.


Public Member Functions

 BTHashMaker (uint32_t chunkSize)
 Constructor.
virtual ~BTHashMaker ()
 Destructor.
virtual void sumUp (const char *data, uint32_t length)
 Continue hash calculation.
virtual HashSetBasegetHashSet ()

Private Types

typedef std::vector< Hash<
SHA1Hash > >::iterator 
Iter
 Makes life simpler.

Private Member Functions

 BTHashMaker ()
 Default constructor protected - need chunkSize.

Private Attributes

bool m_completed
 If hashset generation has been completed.
Sha1Transformm_transformer
 Transformer used for calculation.
std::vector< Hash< SHA1Hash > > m_partHashes
 Receives part hashes.
const uint32_t m_chunkSize
 Size of one chunk.

Member Typedef Documentation

typedef std::vector< Hash<SHA1Hash> >::iterator BTHashMaker::Iter [private]
 

Makes life simpler.

Definition at line 144 of file hashsetmaker.h.


Constructor & Destructor Documentation

BTHashMaker::BTHashMaker uint32_t  chunkSize  ) 
 

Constructor.

Parameters:
chunkSize Size of one piece/chunk/part

Definition at line 117 of file hashsetmaker.cpp.

BTHashMaker::~BTHashMaker  )  [virtual]
 

Destructor.

Definition at line 123 of file hashsetmaker.cpp.

References m_completed, and m_transformer.

BTHashMaker::BTHashMaker  )  [private]
 

Default constructor protected - need chunkSize.


Member Function Documentation

HashSetBase * BTHashMaker::getHashSet  )  [virtual]
 

Returns:
Resulting hashset, downcasted to abstract base class

Pointer to newly allocated HashSet object

Implements HashSetMaker.

Definition at line 162 of file hashsetmaker.cpp.

References HashSet< HashType, FileHashType, ChunkSize >::addChunkHash(), CHECK_THROW, Sha1Transform::getHash(), m_chunkSize, m_completed, m_partHashes, and m_transformer.

Here is the call graph for this function:

void BTHashMaker::sumUp const char *  data,
uint32_t  length
[virtual]
 

Continue hash calculation.

Parameters:
data Data to be hashed. May not be 0.
length Length of data. May not be 0.

Implements HashSetMaker.

Definition at line 130 of file hashsetmaker.cpp.

References CHECK_THROW, Sha1Transform::getHash(), m_chunkSize, m_completed, m_partHashes, m_transformer, and Sha1Transform::sumUp().

Here is the call graph for this function:


Member Data Documentation

const uint32_t BTHashMaker::m_chunkSize [private]
 

Size of one chunk.

Definition at line 146 of file hashsetmaker.h.

Referenced by getHashSet(), and sumUp().

bool BTHashMaker::m_completed [private]
 

If hashset generation has been completed.

Definition at line 138 of file hashsetmaker.h.

Referenced by getHashSet(), sumUp(), and ~BTHashMaker().

std::vector< Hash<SHA1Hash> > BTHashMaker::m_partHashes [private]
 

Receives part hashes.

Definition at line 142 of file hashsetmaker.h.

Referenced by getHashSet(), and sumUp().

Sha1Transform* BTHashMaker::m_transformer [private]
 

Transformer used for calculation.

Definition at line 140 of file hashsetmaker.h.

Referenced by getHashSet(), sumUp(), and ~BTHashMaker().


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