ED2KPacket::HashSet Class Reference

HashSet packet is answer to ReqHashSet packet, and contains the hashset corresponding to the requested filehash. More...

#include <packets.h>

Inheritance diagram for ED2KPacket::HashSet:

ED2KPacket::Packet List of all members.

Public Member Functions

 HashSet (ED2KHashSet *hashset)
 HashSet (std::istream &i)
 operator std::string ()
boost::shared_ptr< ED2KHashSet > getHashSet () const

Private Attributes

boost::shared_ptr< ED2KHashSet > m_hashSet
ED2KHashSet * m_tmpSet

Detailed Description

HashSet packet is answer to ReqHashSet packet, and contains the hashset corresponding to the requested filehash.

There are two semantics here. The tmpSet pointer is used for hashsets passed in the first constructor, which takes a pointer. This pointer is not deleted, since we cannot take ownership of it here. The m_hashSet pointer however is loaded from stream by second constructor, and is dynamically deallocated when no longer needed.

It's safe (altough similarly messy) to do it this way rather than not take ownership at all for the hashsets created in stream-loading constructor, because the latter would expose too large of a risc of memory leaks in case of exception-situations, which is unacceptable. Using this approach, the constructed HashSet is guaranteed to be destroyed in all cases.

Definition at line 699 of file packets.h.


Constructor & Destructor Documentation

ED2KPacket::HashSet::HashSet ED2KHashSet *  hashset  ) 
 

Definition at line 901 of file packets.cpp.

ED2KPacket::HashSet::HashSet std::istream &  i  ) 
 

Definition at line 902 of file packets.cpp.

References m_hashSet.


Member Function Documentation

ED2KPacket::HashSet::operator std::string  ) 
 

Definition at line 910 of file packets.cpp.

References m_tmpSet, ED2KPacket::Packet::makePacket(), and OP_HASHSET.

boost::shared_ptr<ED2KHashSet> ED2KPacket::HashSet::getHashSet  )  const [inline]
 

Definition at line 705 of file packets.h.

References m_hashSet.


Member Data Documentation

boost::shared_ptr<ED2KHashSet> ED2KPacket::HashSet::m_hashSet [private]
 

Definition at line 707 of file packets.h.

Referenced by getHashSet(), and HashSet().

ED2KHashSet* ED2KPacket::HashSet::m_tmpSet [private]
 

Definition at line 708 of file packets.h.

Referenced by operator std::string().


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