Repository: mesos Updated Branches: refs/heads/master 61fe4732d -> e670ce7a5
Fixed some consistency issues in the type utils. Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e670ce7a Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e670ce7a Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e670ce7a Branch: refs/heads/master Commit: e670ce7a5f249e52928a7959ef1e5c221a53413f Parents: 61fe473 Author: Jie Yu <[email protected]> Authored: Tue Apr 4 15:54:20 2017 -0700 Committer: Jie Yu <[email protected]> Committed: Tue Apr 4 15:54:20 2017 -0700 ---------------------------------------------------------------------- include/mesos/type_utils.hpp | 8 ++++++++ include/mesos/v1/mesos.hpp | 36 +++++++++++++++++++++--------------- src/v1/mesos.cpp | 28 ++++++++-------------------- 3 files changed, 37 insertions(+), 35 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/e670ce7a/include/mesos/type_utils.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp index 710c994..2cfbe10 100644 --- a/include/mesos/type_utils.hpp +++ b/include/mesos/type_utils.hpp @@ -99,6 +99,14 @@ inline bool operator==(const OfferID& left, const OfferID& right) } +inline bool operator==( + const ResourceProviderID& left, + const ResourceProviderID& right) +{ + return left.value() == right.value(); +} + + inline bool operator==(const SlaveID& left, const SlaveID& right) { return left.value() == right.value(); http://git-wip-us.apache.org/repos/asf/mesos/blob/e670ce7a/include/mesos/v1/mesos.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp index b309a27..e665ce7 100644 --- a/include/mesos/v1/mesos.hpp +++ b/include/mesos/v1/mesos.hpp @@ -97,6 +97,14 @@ inline bool operator==(const OfferID& left, const OfferID& right) } +inline bool operator==( + const ResourceProviderID& left, + const ResourceProviderID& right) +{ + return left.value() == right.value(); +} + + inline bool operator==(const AgentID& left, const AgentID& right) { return left.value() == right.value(); @@ -172,11 +180,6 @@ inline bool operator==(const MachineID& left, const MachineID& right) } -bool operator==( - const ResourceProviderID& left, - const ResourceProviderID& right); - - inline bool operator!=(const ContainerID& left, const ContainerID& right) { return left.value() != right.value(); @@ -195,6 +198,14 @@ inline bool operator!=(const FrameworkID& left, const FrameworkID& right) } +inline bool operator!=( + const ResourceProviderID& left, + const ResourceProviderID& right) +{ + return left.value() != right.value(); +} + + inline bool operator!=(const AgentID& left, const AgentID& right) { return left.value() != right.value(); @@ -213,11 +224,6 @@ inline bool operator!=(const DurationInfo& left, const DurationInfo& right) } -bool operator!=( - const ResourceProviderID& left, - const ResourceProviderID& right); - - inline bool operator<(const ContainerID& left, const ContainerID& right) { return left.value() < right.value(); @@ -293,6 +299,11 @@ std::ostream& operator<<(std::ostream& stream, const RateLimits& limits); std::ostream& operator<<(std::ostream& stream, const RLimitInfo& limits); +std::ostream& operator<<( + std::ostream& stream, + const ResourceProviderID& resourceProviderId); + + std::ostream& operator<<(std::ostream& stream, const AgentID& agentId); @@ -335,11 +346,6 @@ std::ostream& operator<<(std::ostream& stream, const Image::Type& imageType); std::ostream& operator<<(std::ostream& stream, const Secret::Type& secretType); -std::ostream& operator<<( - std::ostream& stream, - const ResourceProviderID& resourceProviderId); - - template <typename T> inline std::ostream& operator<<( std::ostream& stream, http://git-wip-us.apache.org/repos/asf/mesos/blob/e670ce7a/src/v1/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp index 5605ff2..9c7d641 100644 --- a/src/v1/mesos.cpp +++ b/src/v1/mesos.cpp @@ -288,24 +288,12 @@ bool operator==(const Labels& left, const Labels& right) } -bool operator==(const ResourceProviderID& left, const ResourceProviderID& right) -{ - return left.value() == right.value(); -} - - bool operator!=(const Labels& left, const Labels& right) { return !(left == right); } -bool operator!=(const ResourceProviderID& left, const ResourceProviderID& right) -{ - return !(left == right); -} - - bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right) { return left.visibility() == right.visibility() && @@ -478,6 +466,14 @@ ostream& operator<<(ostream& stream, const RateLimits& limits) } +ostream& operator<<( + ostream& stream, + const ResourceProviderID& resourceProviderId) +{ + return stream << resourceProviderId.value(); +} + + ostream& operator<<(ostream& stream, const RLimitInfo& limits) { return stream << JSON::protobuf(limits); @@ -575,14 +571,6 @@ ostream& operator<<(ostream& stream, const Secret::Type& secretType) } -ostream& operator<<( - ostream& stream, - const ResourceProviderID& resourceProviderId) -{ - return stream << resourceProviderId.value(); -} - - ostream& operator<<(ostream& stream, const hashmap<string, string>& map) { return stream << stringify(map);
