X-Git-Url: http://plrg.eecs.uci.edu/git/?p=folly.git;a=blobdiff_plain;f=folly%2FMacAddress.h;h=739bb226461c4f5114c745908ecd0639b913c3f9;hp=fbc9bd2881e30f62bf3b4a79805ce9078658a299;hb=37af03980d1e36c1417998d7df2edbf6f182f07a;hpb=dced19f55cf70ce7c0b881af5125d95b76321373 diff --git a/folly/MacAddress.h b/folly/MacAddress.h index fbc9bd28..739bb226 100644 --- a/folly/MacAddress.h +++ b/folly/MacAddress.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,12 +16,10 @@ #pragma once -#include +#include -#include - -#include "folly/Bits.h" -#include "folly/Conv.h" +#include +#include namespace folly { @@ -30,7 +28,7 @@ class IPAddressV6; /* * MacAddress represents an IEEE 802 MAC address. */ -class MacAddress : private boost::totally_ordered { +class MacAddress { public: static constexpr size_t SIZE = 6; static const MacAddress BROADCAST; @@ -167,8 +165,7 @@ class MacAddress : private boost::totally_ordered { return getByte(0) & 0x2; } - // Equality and less-than operators. - // boost::totally_ordered provides the other comparison operators. + // Comparison operators. bool operator==(const MacAddress& other) const { // All constructors and modifying methods make sure padding is 0, @@ -180,6 +177,22 @@ class MacAddress : private boost::totally_ordered { return u64HBO() < other.u64HBO(); } + bool operator!=(const MacAddress& other) const { + return !(*this == other); + } + + bool operator>(const MacAddress& other) const { + return other < *this; + } + + bool operator>=(const MacAddress& other) const { + return !(*this < other); + } + + bool operator<=(const MacAddress& other) const { + return !(*this > other); + } + private: explicit MacAddress(uint64_t valueNBO) { memcpy(&bytes_, &valueNBO, 8);