Public Member Functions

__gnu_cxx::hash< TransportAddress > Struct Template Reference

defines a hash function for TransportAddress More...

#include <HashFunc.h>

List of all members.

Public Member Functions

std::size_t operator() (const TransportAddress &addr) const
 hash function for TransportAddress

Detailed Description

template<>
struct __gnu_cxx::hash< TransportAddress >

defines a hash function for TransportAddress

Definition at line 67 of file HashFunc.h.


Member Function Documentation

std::size_t __gnu_cxx::hash< TransportAddress >::operator() ( const TransportAddress addr  )  const [inline]

hash function for TransportAddress

Parameters:
addr the TransportAddress to hash
Returns:
the hashed TransportAddress

Definition at line 75 of file HashFunc.h.

    {
        if (addr.getIp().isIPv6()) {
            return ((bswap_32(addr.getIp().get6().words()[0]) ^
                     bswap_32(addr.getIp().get6().words()[1]) ^
                     bswap_32(addr.getIp().get6().words()[2]) ^
                     bswap_32(addr.getIp().get6().words()[3])) ^
                      addr.getPort());
        } else {
            return (bswap_32(addr.getIp().get4().getInt()) ^
                    addr.getPort());
        }
    }


The documentation for this struct was generated from the following file: