[Click] hashcode confusion

Alastair McKinley amckinley03 at googlemail.com
Thu Nov 5 06:19:38 EST 2009


Hi Everyone,

I am writing an element for analysing wifi traffic and realised in the
process that I was implementing the same class as EtherPair in
roofnet/analysis/wificounter.hh.

class EtherPair {

 public:
    EtherAddress _src;
    EtherAddress _dst;
    EtherPair() { }
    EtherPair(EtherAddress src, EtherAddress dst) {
	_src = src;
	_dst = dst;
    }
    inline bool operator==(EtherPair other) {

	return _src == other._src && _dst == other._dst;
    }
    inline size_t hashcode() const;
};


inline size_t EtherPair::hashcode() const {
    return CLICK_NAME(hashcode)(_src) + CLICK_NAME(hashcode)(_dst);

}

Can someone explain how the hashcode member function works in the this example?

Best regards,

Alastair


More information about the click mailing list