Credits Class Reference

Credits object represent one single client's credits entry. More...

#include <creditsdb.h>

List of all members.


Public Member Functions

 Credits (PublicKey key, const Hash< MD4Hash > &h)
 Construct by publickey and hash.
float getScore () const
uint64_t getUploaded () const
uint64_t getDownloaded () const
uint32_t getLastSeen () const
Hash< MD4Hash > getHash () const
PublicKey getPubKey () const
void addUploaded (uint32_t amount)
void addDownloaded (uint32_t amount)
void setLastSeen (uint32_t time)

Private Member Functions

 Credits (std::istream &i, uint8_t ver)
 Construct and load from stream.
 Credits ()
 Forbidden.
 ~Credits ()
 Allowed by CreditsDb.
 Credits (const Credits &)
 Forbidden.
const Creditsoperator= (const Credits &)

Private Attributes

Data
Hash< MD4Hash > m_hash
 Userhash.
uint64_t m_uploaded
 Sent to him/her.
uint64_t m_downloaded
 Received from him/her.
uint32_t m_lastSeen
 Time last seen.
PublicKey m_pubKey
 public key

Friends

class CreditsDb
std::ostream & operator<< (std::ostream &o, const Credits &c)
 Output operator to streams, used for writing clients.met.

Detailed Description

Credits object represent one single client's credits entry.

Definition at line 33 of file creditsdb.h.


Constructor & Destructor Documentation

Credits::Credits PublicKey  key,
const Hash< MD4Hash > &  h
 

Construct by publickey and hash.

Definition at line 44 of file creditsdb.cpp.

Credits::Credits std::istream &  i,
uint8_t  ver
[private]
 

Construct and load from stream.

This is used only by CreditsDb, and is thus private.

Parameters:
i Input stream to read data from
ver Version of stream (pubkey or not)

Definition at line 51 of file creditsdb.cpp.

References CM_VER29, ED2K_MaxKeySize, m_downloaded, m_hash, m_lastSeen, m_pubKey, and m_uploaded.

Credits::Credits  )  [private]
 

Forbidden.

Credits::~Credits  )  [private]
 

Allowed by CreditsDb.

Definition at line 48 of file creditsdb.cpp.

Credits::Credits const Credits  )  [private]
 

Forbidden.


Member Function Documentation

float Credits::getScore  )  const [inline]
 

Definition at line 38 of file creditsdb.h.

References m_downloaded, and m_uploaded.

Referenced by Client::getScore().

uint64_t Credits::getUploaded  )  const [inline]
 

Definition at line 47 of file creditsdb.h.

References m_uploaded.

Referenced by Client::onPacket().

uint64_t Credits::getDownloaded  )  const [inline]
 

Definition at line 48 of file creditsdb.h.

References m_downloaded.

Referenced by Client::onPacket().

uint32_t Credits::getLastSeen  )  const [inline]
 

Definition at line 49 of file creditsdb.h.

References m_lastSeen.

Hash<MD4Hash> Credits::getHash  )  const [inline]
 

Definition at line 50 of file creditsdb.h.

References m_hash.

Referenced by Client::storeInfo().

PublicKey Credits::getPubKey  )  const [inline]
 

Definition at line 51 of file creditsdb.h.

References m_pubKey.

Referenced by Client::onPacket().

void Credits::addUploaded uint32_t  amount  )  [inline]
 

Definition at line 53 of file creditsdb.h.

References m_uploaded.

Referenced by Client::sendNextChunk().

void Credits::addDownloaded uint32_t  amount  )  [inline]
 

Definition at line 54 of file creditsdb.h.

References m_downloaded.

Referenced by Client::onPacket().

void Credits::setLastSeen uint32_t  time  )  [inline]
 

Definition at line 55 of file creditsdb.h.

References m_lastSeen.

const Credits& Credits::operator= const Credits  )  [private]
 


Friends And Related Function Documentation

friend class CreditsDb [friend]
 

Definition at line 57 of file creditsdb.h.

std::ostream& operator<< std::ostream &  o,
const Credits c
[friend]
 

Output operator to streams, used for writing clients.met.

Definition at line 80 of file creditsdb.cpp.


Member Data Documentation

Hash<MD4Hash> Credits::m_hash [private]
 

Userhash.

Definition at line 75 of file creditsdb.h.

Referenced by Credits(), getHash(), and Client::merge().

uint64_t Credits::m_uploaded [private]
 

Sent to him/her.

Definition at line 76 of file creditsdb.h.

Referenced by addUploaded(), Credits(), getScore(), and getUploaded().

uint64_t Credits::m_downloaded [private]
 

Received from him/her.

Definition at line 77 of file creditsdb.h.

Referenced by addDownloaded(), Credits(), getDownloaded(), and getScore().

uint32_t Credits::m_lastSeen [private]
 

Time last seen.

Definition at line 78 of file creditsdb.h.

Referenced by Credits(), getLastSeen(), and setLastSeen().

PublicKey Credits::m_pubKey [private]
 

public key

Definition at line 79 of file creditsdb.h.

Referenced by Credits(), and getPubKey().


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