X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FMacAddress.h;h=739bb226461c4f5114c745908ecd0639b913c3f9;hb=3cdd3857fbfacd9312a23214f54a47f156726927;hp=49852edba60b6bbcb4be9934b7c5881d93d2f722;hpb=321542683a01c3f334047531e9b487f047129775;p=folly.git diff --git a/folly/MacAddress.h b/folly/MacAddress.h index 49852edb..739bb226 100644 --- a/folly/MacAddress.h +++ b/folly/MacAddress.h @@ -1,5 +1,5 @@ /* - * Copyright 2016 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 -#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);