Removed whitespace padding in overloaded operators in HTTP API v1.
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/04301c29 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/04301c29 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/04301c29 Branch: refs/heads/master Commit: 04301c29b3511cf26fce90a1ab9e53d062e74dee Parents: dffa167 Author: Michael Park <[email protected]> Authored: Sun Aug 9 19:00:09 2015 -0400 Committer: Michael Park <[email protected]> Committed: Sun Aug 9 19:21:57 2015 -0400 ---------------------------------------------------------------------- include/mesos/v1/attributes.hpp | 10 +-- include/mesos/v1/mesos.hpp | 124 +++++++++++--------------- include/mesos/v1/resources.hpp | 40 ++++----- include/mesos/v1/scheduler/scheduler.hpp | 8 +- include/mesos/v1/values.hpp | 50 +++++------ src/v1/attributes.cpp | 4 +- src/v1/mesos.cpp | 46 +++++----- src/v1/resources.cpp | 56 ++++++------ src/v1/values.cpp | 46 +++++----- 9 files changed, 177 insertions(+), 207 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/include/mesos/v1/attributes.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/attributes.hpp b/include/mesos/v1/attributes.hpp index 8f33aa7..d8b3507 100644 --- a/include/mesos/v1/attributes.hpp +++ b/include/mesos/v1/attributes.hpp @@ -29,7 +29,7 @@ namespace mesos { namespace v1 { -std::ostream& operator << (std::ostream& stream, const Attribute& attribute); +std::ostream& operator<<(std::ostream& stream, const Attribute& attribute); class Attributes @@ -49,7 +49,7 @@ public: attributes.MergeFrom(that.attributes); } - Attributes& operator = (const Attributes& that) + Attributes& operator=(const Attributes& that) { if (this != &that) { attributes.Clear(); @@ -59,10 +59,10 @@ public: return *this; } - bool operator == (const Attributes& that) const; + bool operator==(const Attributes& that) const; - bool operator != (const Attributes& that) const + bool operator!=(const Attributes& that) const { return !(*this == that); } @@ -74,7 +74,7 @@ public: // Using this operator makes it easy to copy a attributes object into // a protocol buffer field. - operator const google::protobuf::RepeatedPtrField<Attribute>& () const + operator const google::protobuf::RepeatedPtrField<Attribute>&() const { return attributes; } http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/include/mesos/v1/mesos.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp index f74bed8..d06875e 100644 --- a/include/mesos/v1/mesos.hpp +++ b/include/mesos/v1/mesos.hpp @@ -28,158 +28,158 @@ namespace mesos { namespace v1 { -bool operator == (const CommandInfo& left, const CommandInfo& right); -bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right); -bool operator == (const Credential& left, const Credential& right); -bool operator == (const Environment& left, const Environment& right); -bool operator == (const ExecutorInfo& left, const ExecutorInfo& right); -bool operator == (const MasterInfo& left, const MasterInfo& right); - -bool operator == ( +bool operator==(const CommandInfo& left, const CommandInfo& right); +bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right); +bool operator==(const Credential& left, const Credential& right); +bool operator==(const Environment& left, const Environment& right); +bool operator==(const ExecutorInfo& left, const ExecutorInfo& right); +bool operator==(const MasterInfo& left, const MasterInfo& right); + +bool operator==( const ResourceStatistics& left, const ResourceStatistics& right); -bool operator == (const AgentInfo& left, const AgentInfo& right); -bool operator == (const Volume& left, const Volume& right); +bool operator==(const AgentInfo& left, const AgentInfo& right); +bool operator==(const Volume& left, const Volume& right); -bool operator == (const URL& left, const URL& right); +bool operator==(const URL& left, const URL& right); -bool operator == (const TaskStatus& left, const TaskStatus& right); -bool operator != (const TaskStatus& left, const TaskStatus& right); +bool operator==(const TaskStatus& left, const TaskStatus& right); +bool operator!=(const TaskStatus& left, const TaskStatus& right); -inline bool operator == (const ContainerID& left, const ContainerID& right) +inline bool operator==(const ContainerID& left, const ContainerID& right) { return left.value() == right.value(); } -inline bool operator == (const ExecutorID& left, const ExecutorID& right) +inline bool operator==(const ExecutorID& left, const ExecutorID& right) { return left.value() == right.value(); } -inline bool operator == (const FrameworkID& left, const FrameworkID& right) +inline bool operator==(const FrameworkID& left, const FrameworkID& right) { return left.value() == right.value(); } -inline bool operator == (const FrameworkInfo& left, const FrameworkInfo& right) +inline bool operator==(const FrameworkInfo& left, const FrameworkInfo& right) { return (left.name() == right.name()) && (left.user() == right.user()); } -inline bool operator == (const OfferID& left, const OfferID& right) +inline bool operator==(const OfferID& left, const OfferID& right) { return left.value() == right.value(); } -inline bool operator == (const AgentID& left, const AgentID& right) +inline bool operator==(const AgentID& left, const AgentID& right) { return left.value() == right.value(); } -inline bool operator == (const TaskID& left, const TaskID& right) +inline bool operator==(const TaskID& left, const TaskID& right) { return left.value() == right.value(); } -inline bool operator == (const ContainerID& left, const std::string& right) +inline bool operator==(const ContainerID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const ExecutorID& left, const std::string& right) +inline bool operator==(const ExecutorID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const FrameworkID& left, const std::string& right) +inline bool operator==(const FrameworkID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const OfferID& left, const std::string& right) +inline bool operator==(const OfferID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const AgentID& left, const std::string& right) +inline bool operator==(const AgentID& left, const std::string& right) { return left.value() == right; } -inline bool operator == (const TaskID& left, const std::string& right) +inline bool operator==(const TaskID& left, const std::string& right) { return left.value() == right; } -inline bool operator != (const ContainerID& left, const ContainerID& right) +inline bool operator!=(const ContainerID& left, const ContainerID& right) { return left.value() != right.value(); } -inline bool operator != (const ExecutorID& left, const ExecutorID& right) +inline bool operator!=(const ExecutorID& left, const ExecutorID& right) { return left.value() != right.value(); } -inline bool operator != (const FrameworkID& left, const FrameworkID& right) +inline bool operator!=(const FrameworkID& left, const FrameworkID& right) { return left.value() != right.value(); } -inline bool operator != (const AgentID& left, const AgentID& right) +inline bool operator!=(const AgentID& left, const AgentID& right) { return left.value() != right.value(); } -inline bool operator < (const ContainerID& left, const ContainerID& right) +inline bool operator<(const ContainerID& left, const ContainerID& right) { return left.value() < right.value(); } -inline bool operator < (const ExecutorID& left, const ExecutorID& right) +inline bool operator<(const ExecutorID& left, const ExecutorID& right) { return left.value() < right.value(); } -inline bool operator < (const FrameworkID& left, const FrameworkID& right) +inline bool operator<(const FrameworkID& left, const FrameworkID& right) { return left.value() < right.value(); } -inline bool operator < (const OfferID& left, const OfferID& right) +inline bool operator<(const OfferID& left, const OfferID& right) { return left.value() < right.value(); } -inline bool operator < (const AgentID& left, const AgentID& right) +inline bool operator<(const AgentID& left, const AgentID& right) { return left.value() < right.value(); } -inline bool operator < (const TaskID& left, const TaskID& right) +inline bool operator<(const TaskID& left, const TaskID& right) { return left.value() < right.value(); } @@ -250,15 +250,13 @@ inline std::size_t hash_value(const TaskID& taskId) } -inline std::ostream& operator << ( - std::ostream& stream, - const ACLs& acls) +inline std::ostream& operator<<(std::ostream& stream, const ACLs& acls) { return stream << acls.DebugString(); } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ContainerID& containerId) { @@ -266,7 +264,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ContainerInfo& containerInfo) { @@ -274,7 +272,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ExecutorID& executorId) { @@ -282,7 +280,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const ExecutorInfo& executor) { @@ -290,7 +288,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const FrameworkID& frameworkId) { @@ -298,71 +296,55 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( - std::ostream& stream, - const MasterInfo& master) +inline std::ostream& operator<<(std::ostream& stream, const MasterInfo& master) { return stream << master.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const OfferID& offerId) +inline std::ostream& operator<<(std::ostream& stream, const OfferID& offerId) { return stream << offerId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const RateLimits& limits) +inline std::ostream& operator<<(std::ostream& stream, const RateLimits& limits) { return stream << limits.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const AgentID& agentId) +inline std::ostream& operator<<(std::ostream& stream, const AgentID& agentId) { return stream << agentId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const AgentInfo& agent) +inline std::ostream& operator<<(std::ostream& stream, const AgentInfo& agent) { return stream << agent.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskID& taskId) +inline std::ostream& operator<<(std::ostream& stream, const TaskID& taskId) { return stream << taskId.value(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskInfo& task) +inline std::ostream& operator<<(std::ostream& stream, const TaskInfo& task) { return stream << task.DebugString(); } -inline std::ostream& operator << ( - std::ostream& stream, - const TaskState& state) +inline std::ostream& operator<<(std::ostream& stream, const TaskState& state) { return stream << TaskState_Name(state); } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const std::vector<TaskID>& taskIds) { @@ -378,7 +360,7 @@ inline std::ostream& operator << ( } -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const FrameworkInfo::Capability& capability) { @@ -387,7 +369,7 @@ inline std::ostream& operator << ( template <typename T> -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const google::protobuf::RepeatedPtrField<T>& messages) { http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/include/mesos/v1/resources.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/resources.hpp b/include/mesos/v1/resources.hpp index bb9bede..fe8925a 100644 --- a/include/mesos/v1/resources.hpp +++ b/include/mesos/v1/resources.hpp @@ -158,7 +158,7 @@ public: Resources(const Resources& that) : resources(that.resources) {} - Resources& operator = (const Resources& that) + Resources& operator=(const Resources& that) { if (this != &that) { resources = that.resources; @@ -287,25 +287,25 @@ public: // Using this operator makes it easy to copy a resources object into // a protocol buffer field. - operator const google::protobuf::RepeatedPtrField<Resource>& () const; + operator const google::protobuf::RepeatedPtrField<Resource>&() const; - bool operator == (const Resources& that) const; - bool operator != (const Resources& that) const; + bool operator==(const Resources& that) const; + bool operator!=(const Resources& that) const; // NOTE: If any error occurs (e.g., input Resource is not valid or // the first operand is not a superset of the second oprand while // doing subtraction), the semantics is as though the second operand // was actually just an empty resource (as though you didn't do the // operation at all). - Resources operator + (const Resource& that) const; - Resources operator + (const Resources& that) const; - Resources& operator += (const Resource& that); - Resources& operator += (const Resources& that); + Resources operator+(const Resource& that) const; + Resources operator+(const Resources& that) const; + Resources& operator+=(const Resource& that); + Resources& operator+=(const Resources& that); - Resources operator - (const Resource& that) const; - Resources operator - (const Resources& that) const; - Resources& operator -= (const Resource& that); - Resources& operator -= (const Resources& that); + Resources operator-(const Resource& that) const; + Resources operator-(const Resources& that) const; + Resources& operator-=(const Resource& that); + Resources& operator-=(const Resources& that); private: // Similar to 'contains(const Resource&)' but skips the validity @@ -326,11 +326,11 @@ private: }; -std::ostream& operator << (std::ostream& stream, const Resource& resource); -std::ostream& operator << (std::ostream& stream, const Resources& resources); +std::ostream& operator<<(std::ostream& stream, const Resource& resource); +std::ostream& operator<<(std::ostream& stream, const Resources& resources); -inline std::ostream& operator << ( +inline std::ostream& operator<<( std::ostream& stream, const google::protobuf::RepeatedPtrField<Resource>& resources) { @@ -338,7 +338,7 @@ inline std::ostream& operator << ( } -inline Resources operator + ( +inline Resources operator+( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -346,7 +346,7 @@ inline Resources operator + ( } -inline Resources operator - ( +inline Resources operator-( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -354,7 +354,7 @@ inline Resources operator - ( } -inline bool operator == ( +inline bool operator==( const google::protobuf::RepeatedPtrField<Resource>& left, const Resources& right) { @@ -363,7 +363,7 @@ inline bool operator == ( template <typename Key> -hashmap<Key, Resources>& operator += ( +hashmap<Key, Resources>& operator+=( hashmap<Key, Resources>& left, const hashmap<Key, Resources>& right) { @@ -375,7 +375,7 @@ hashmap<Key, Resources>& operator += ( template <typename Key> -hashmap<Key, Resources> operator + ( +hashmap<Key, Resources> operator+( const hashmap<Key, Resources>& left, const hashmap<Key, Resources>& right) { http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/include/mesos/v1/scheduler/scheduler.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/scheduler/scheduler.hpp b/include/mesos/v1/scheduler/scheduler.hpp index 692a799..eaf9f90 100644 --- a/include/mesos/v1/scheduler/scheduler.hpp +++ b/include/mesos/v1/scheduler/scheduler.hpp @@ -28,17 +28,13 @@ namespace mesos { namespace v1 { namespace scheduler { -inline std::ostream& operator << ( - std::ostream& stream, - const Call::Type& type) +inline std::ostream& operator<<(std::ostream& stream, const Call::Type& type) { return stream << Call::Type_Name(type); } -inline std::ostream& operator << ( - std::ostream& stream, - const Event::Type& type) +inline std::ostream& operator<<(std::ostream& stream, const Event::Type& type) { return stream << Event::Type_Name(type); } http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/include/mesos/v1/values.hpp ---------------------------------------------------------------------- diff --git a/include/mesos/v1/values.hpp b/include/mesos/v1/values.hpp index 40fc167..4e53297 100644 --- a/include/mesos/v1/values.hpp +++ b/include/mesos/v1/values.hpp @@ -26,36 +26,32 @@ namespace mesos { namespace v1 { -std::ostream& operator << (std::ostream& stream, const Value::Scalar& scalar); -bool operator == (const Value::Scalar& left, const Value::Scalar& right); -bool operator <= (const Value::Scalar& left, const Value::Scalar& right); -Value::Scalar operator + (const Value::Scalar& left, - const Value::Scalar& right); -Value::Scalar operator - (const Value::Scalar& left, - const Value::Scalar& right); -Value::Scalar& operator += (Value::Scalar& left, const Value::Scalar& right); -Value::Scalar& operator -= (Value::Scalar& left, const Value::Scalar& right); +std::ostream& operator<<(std::ostream& stream, const Value::Scalar& scalar); +bool operator==(const Value::Scalar& left, const Value::Scalar& right); +bool operator<=(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar operator+(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar operator-(const Value::Scalar& left, const Value::Scalar& right); +Value::Scalar& operator+=(Value::Scalar& left, const Value::Scalar& right); +Value::Scalar& operator-=(Value::Scalar& left, const Value::Scalar& right); -std::ostream& operator << (std::ostream& stream, const Value::Ranges& ranges); -bool operator == (const Value::Ranges& left, const Value::Ranges& right); -bool operator <= (const Value::Ranges& left, const Value::Ranges& right); -Value::Ranges operator + (const Value::Ranges& left, - const Value::Ranges& right); -Value::Ranges operator - (const Value::Ranges& left, - const Value::Ranges& right); -Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right); -Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right); +std::ostream& operator<<(std::ostream& stream, const Value::Ranges& ranges); +bool operator==(const Value::Ranges& left, const Value::Ranges& right); +bool operator<=(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges operator+(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges operator-(const Value::Ranges& left, const Value::Ranges& right); +Value::Ranges& operator+=(Value::Ranges& left, const Value::Ranges& right); +Value::Ranges& operator-=(Value::Ranges& left, const Value::Ranges& right); -std::ostream& operator << (std::ostream& stream, const Value::Set& set); -bool operator == (const Value::Set& left, const Value::Set& right); -bool operator <= (const Value::Set& left, const Value::Set& right); -Value::Set operator + (const Value::Set& left, const Value::Set& right); -Value::Set operator - (const Value::Set& left, const Value::Set& right); -Value::Set& operator += (Value::Set& left, const Value::Set& right); -Value::Set& operator -= (Value::Set& left, const Value::Set& right); +std::ostream& operator<<(std::ostream& stream, const Value::Set& set); +bool operator==(const Value::Set& left, const Value::Set& right); +bool operator<=(const Value::Set& left, const Value::Set& right); +Value::Set operator+(const Value::Set& left, const Value::Set& right); +Value::Set operator-(const Value::Set& left, const Value::Set& right); +Value::Set& operator+=(Value::Set& left, const Value::Set& right); +Value::Set& operator-=(Value::Set& left, const Value::Set& right); -std::ostream& operator << (std::ostream& stream, const Value::Text& value); -bool operator == (const Value::Text& left, const Value::Text& right); +std::ostream& operator<<(std::ostream& stream, const Value::Text& value); +bool operator==(const Value::Text& left, const Value::Text& right); namespace internal { namespace values { http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/src/v1/attributes.cpp ---------------------------------------------------------------------- diff --git a/src/v1/attributes.cpp b/src/v1/attributes.cpp index 37085be..a6ccb3d 100644 --- a/src/v1/attributes.cpp +++ b/src/v1/attributes.cpp @@ -34,7 +34,7 @@ using std::vector; namespace mesos { namespace v1 { -std::ostream& operator << (std::ostream& stream, const Attribute& attribute) +std::ostream& operator<<(std::ostream& stream, const Attribute& attribute) { stream << attribute.name() << "="; switch (attribute.type()) { @@ -51,7 +51,7 @@ std::ostream& operator << (std::ostream& stream, const Attribute& attribute) } -bool Attributes::operator == (const Attributes& that) const +bool Attributes::operator==(const Attributes& that) const { if (size() != that.size()) { return false; http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/src/v1/mesos.cpp ---------------------------------------------------------------------- diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp index e42d04c..631d6e5 100644 --- a/src/v1/mesos.cpp +++ b/src/v1/mesos.cpp @@ -26,7 +26,7 @@ namespace v1 { // TODO(vinod): Ensure that these operators do not go out of sync // when new fields are added to the protobufs (MESOS-2487). -bool operator == (const CommandInfo& left, const CommandInfo& right) +bool operator==(const CommandInfo& left, const CommandInfo& right) { if (left.uris().size() != right.uris().size()) { return false; @@ -68,7 +68,7 @@ bool operator == (const CommandInfo& left, const CommandInfo& right) } -bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right) +bool operator==(const CommandInfo::URI& left, const CommandInfo::URI& right) { return left.value() == right.value() && left.executable() == right.executable() && @@ -76,14 +76,14 @@ bool operator == (const CommandInfo::URI& left, const CommandInfo::URI& right) } -bool operator == (const Credential& left, const Credential& right) +bool operator==(const Credential& left, const Credential& right) { return left.principal() == right.principal() && left.secret() == right.secret(); } -bool operator == ( +bool operator==( const Environment::Variable& left, const Environment::Variable& right) { @@ -91,7 +91,7 @@ bool operator == ( } -bool operator == (const Environment& left, const Environment& right) +bool operator==(const Environment& left, const Environment& right) { // Order of variables is not important. if (left.variables().size() != right.variables().size()) { @@ -115,7 +115,7 @@ bool operator == (const Environment& left, const Environment& right) } -bool operator == (const Volume& left, const Volume& right) +bool operator==(const Volume& left, const Volume& right) { return left.container_path() == right.container_path() && left.host_path() == right.host_path() && @@ -124,13 +124,13 @@ bool operator == (const Volume& left, const Volume& right) // TODO(bmahler): Leverage process::http::URL for equality. -bool operator == (const URL& left, const URL& right) +bool operator==(const URL& left, const URL& right) { return left.SerializeAsString() == right.SerializeAsString(); } -bool operator == ( +bool operator==( const ContainerInfo::DockerInfo::PortMapping& left, const ContainerInfo::DockerInfo::PortMapping& right) { @@ -140,13 +140,13 @@ bool operator == ( } -bool operator == (const Parameter& left, const Parameter& right) +bool operator==(const Parameter& left, const Parameter& right) { return left.key() == right.key() && left.value() == right.value(); } -bool operator == ( +bool operator==( const ContainerInfo::DockerInfo& left, const ContainerInfo::DockerInfo& right) { @@ -193,7 +193,7 @@ bool operator == ( } -bool operator == (const ContainerInfo& left, const ContainerInfo& right) +bool operator==(const ContainerInfo& left, const ContainerInfo& right) { // Order of volumes is not important. if (left.volumes().size() != right.volumes().size()) { @@ -219,7 +219,7 @@ bool operator == (const ContainerInfo& left, const ContainerInfo& right) } -bool operator == (const Port& left, const Port& right) +bool operator==(const Port& left, const Port& right) { return left.number() == right.number() && left.name() == right.name() && @@ -227,7 +227,7 @@ bool operator == (const Port& left, const Port& right) } -bool operator == (const Ports& left, const Ports& right) +bool operator==(const Ports& left, const Ports& right) { // Order of ports is not important. if (left.ports().size() != right.ports().size()) { @@ -251,13 +251,13 @@ bool operator == (const Ports& left, const Ports& right) } -bool operator == (const Label& left, const Label& right) +bool operator==(const Label& left, const Label& right) { return left.key() == right.key() && left.value() == right.value(); } -bool operator == (const Labels& left, const Labels& right) +bool operator==(const Labels& left, const Labels& right) { // Order of labels is not important. if (left.labels().size() != right.labels().size()) { @@ -281,7 +281,7 @@ bool operator == (const Labels& left, const Labels& right) } -bool operator == (const DiscoveryInfo& left, const DiscoveryInfo& right) +bool operator==(const DiscoveryInfo& left, const DiscoveryInfo& right) { return left.visibility() == right.visibility() && left.name() == right.name() && @@ -293,7 +293,7 @@ bool operator == (const DiscoveryInfo& left, const DiscoveryInfo& right) } -bool operator == (const ExecutorInfo& left, const ExecutorInfo& right) +bool operator==(const ExecutorInfo& left, const ExecutorInfo& right) { return left.executor_id() == right.executor_id() && left.data() == right.data() && @@ -307,7 +307,7 @@ bool operator == (const ExecutorInfo& left, const ExecutorInfo& right) } -bool operator == (const MasterInfo& left, const MasterInfo& right) +bool operator==(const MasterInfo& left, const MasterInfo& right) { return left.id() == right.id() && left.ip() == right.ip() && @@ -318,15 +318,13 @@ bool operator == (const MasterInfo& left, const MasterInfo& right) } -bool operator == ( - const ResourceStatistics& left, - const ResourceStatistics& right) +bool operator==(const ResourceStatistics& left, const ResourceStatistics& right) { return left.SerializeAsString() == right.SerializeAsString(); } -bool operator == (const AgentInfo& left, const AgentInfo& right) +bool operator==(const AgentInfo& left, const AgentInfo& right) { return left.hostname() == right.hostname() && Resources(left.resources()) == Resources(right.resources()) && @@ -337,7 +335,7 @@ bool operator == (const AgentInfo& left, const AgentInfo& right) // TODO(bmahler): Use SerializeToString here? -bool operator == (const TaskStatus& left, const TaskStatus& right) +bool operator==(const TaskStatus& left, const TaskStatus& right) { return left.task_id() == right.task_id() && left.state() == right.state() && @@ -353,7 +351,7 @@ bool operator == (const TaskStatus& left, const TaskStatus& right) } -bool operator != (const TaskStatus& left, const TaskStatus& right) +bool operator!=(const TaskStatus& left, const TaskStatus& right) { return !(left == right); } http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/src/v1/resources.cpp ---------------------------------------------------------------------- diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp index fd8df51..c830cac 100644 --- a/src/v1/resources.cpp +++ b/src/v1/resources.cpp @@ -47,7 +47,7 @@ namespace v1 { // Helper functions. ///////////////////////////////////////////////// -bool operator == ( +bool operator==( const Resource::ReservationInfo& left, const Resource::ReservationInfo& right) { @@ -55,7 +55,7 @@ bool operator == ( } -bool operator != ( +bool operator!=( const Resource::ReservationInfo& left, const Resource::ReservationInfo& right) { @@ -63,9 +63,7 @@ bool operator != ( } -bool operator == ( - const Resource::DiskInfo& left, - const Resource::DiskInfo& right) +bool operator==(const Resource::DiskInfo& left, const Resource::DiskInfo& right) { // NOTE: We ignore 'volume' inside DiskInfo when doing comparison // because it describes how this resource will be used which has @@ -84,15 +82,13 @@ bool operator == ( } -bool operator != ( - const Resource::DiskInfo& left, - const Resource::DiskInfo& right) +bool operator!=(const Resource::DiskInfo& left, const Resource::DiskInfo& right) { return !(left == right); } -bool operator == (const Resource& left, const Resource& right) +bool operator==(const Resource& left, const Resource& right) { if (left.name() != right.name() || left.type() != right.type() || @@ -135,7 +131,7 @@ bool operator == (const Resource& left, const Resource& right) } -bool operator != (const Resource& left, const Resource& right) +bool operator!=(const Resource& left, const Resource& right) { return !(left == right); } @@ -262,7 +258,7 @@ static bool contains(const Resource& left, const Resource& right) } // namespace internal { -Resource& operator += (Resource& left, const Resource& right) +Resource& operator+=(Resource& left, const Resource& right) { if (left.type() == Value::SCALAR) { *left.mutable_scalar() += right.scalar(); @@ -276,7 +272,7 @@ Resource& operator += (Resource& left, const Resource& right) } -Resource operator + (const Resource& left, const Resource& right) +Resource operator+(const Resource& left, const Resource& right) { Resource result = left; result += right; @@ -284,7 +280,7 @@ Resource operator + (const Resource& left, const Resource& right) } -Resource& operator -= (Resource& left, const Resource& right) +Resource& operator-=(Resource& left, const Resource& right) { if (left.type() == Value::SCALAR) { *left.mutable_scalar() -= right.scalar(); @@ -298,7 +294,7 @@ Resource& operator -= (Resource& left, const Resource& right) } -Resource operator - (const Resource& left, const Resource& right) +Resource operator-(const Resource& left, const Resource& right) { Resource result = left; result -= right; @@ -1056,25 +1052,25 @@ bool Resources::_contains(const Resource& that) const ///////////////////////////////////////////////// -Resources::operator const google::protobuf::RepeatedPtrField<Resource>& () const +Resources::operator const google::protobuf::RepeatedPtrField<Resource>&() const { return resources; } -bool Resources::operator == (const Resources& that) const +bool Resources::operator==(const Resources& that) const { return this->contains(that) && that.contains(*this); } -bool Resources::operator != (const Resources& that) const +bool Resources::operator!=(const Resources& that) const { return !(*this == that); } -Resources Resources::operator + (const Resource& that) const +Resources Resources::operator+(const Resource& that) const { Resources result = *this; result += that; @@ -1082,7 +1078,7 @@ Resources Resources::operator + (const Resource& that) const } -Resources Resources::operator + (const Resources& that) const +Resources Resources::operator+(const Resources& that) const { Resources result = *this; result += that; @@ -1090,7 +1086,7 @@ Resources Resources::operator + (const Resources& that) const } -Resources& Resources::operator += (const Resource& that) +Resources& Resources::operator+=(const Resource& that) { if (validate(that).isNone() && !isEmpty(that)) { bool found = false; @@ -1112,7 +1108,7 @@ Resources& Resources::operator += (const Resource& that) } -Resources& Resources::operator += (const Resources& that) +Resources& Resources::operator+=(const Resources& that) { foreach (const Resource& resource, that.resources) { *this += resource; @@ -1122,7 +1118,7 @@ Resources& Resources::operator += (const Resources& that) } -Resources Resources::operator - (const Resource& that) const +Resources Resources::operator-(const Resource& that) const { Resources result = *this; result -= that; @@ -1130,7 +1126,7 @@ Resources Resources::operator - (const Resource& that) const } -Resources Resources::operator - (const Resources& that) const +Resources Resources::operator-(const Resources& that) const { Resources result = *this; result -= that; @@ -1138,7 +1134,7 @@ Resources Resources::operator - (const Resources& that) const } -Resources& Resources::operator -= (const Resource& that) +Resources& Resources::operator-=(const Resource& that) { if (validate(that).isNone() && !isEmpty(that)) { for (int i = 0; i < resources.size(); i++) { @@ -1163,7 +1159,7 @@ Resources& Resources::operator -= (const Resource& that) } -Resources& Resources::operator -= (const Resources& that) +Resources& Resources::operator-=(const Resources& that) { foreach (const Resource& resource, that.resources) { *this -= resource; @@ -1173,7 +1169,8 @@ Resources& Resources::operator -= (const Resources& that) } -ostream& operator << (ostream& stream, const Volume& volume) { +ostream& operator<<(ostream& stream, const Volume& volume) +{ string volumeConfig = volume.container_path(); if (volume.has_host_path()) { @@ -1196,7 +1193,8 @@ ostream& operator << (ostream& stream, const Volume& volume) { } -ostream& operator << (ostream& stream, const Resource::DiskInfo& disk) { +ostream& operator<<(ostream& stream, const Resource::DiskInfo& disk) +{ if (disk.has_persistence()) { stream << disk.persistence().id(); } @@ -1209,7 +1207,7 @@ ostream& operator << (ostream& stream, const Resource::DiskInfo& disk) { } -ostream& operator << (ostream& stream, const Resource& resource) +ostream& operator<<(ostream& stream, const Resource& resource) { stream << resource.name(); @@ -1246,7 +1244,7 @@ ostream& operator << (ostream& stream, const Resource& resource) } -ostream& operator << (ostream& stream, const Resources& resources) +ostream& operator<<(ostream& stream, const Resources& resources) { Resources::const_iterator it = resources.begin(); http://git-wip-us.apache.org/repos/asf/mesos/blob/04301c29/src/v1/values.cpp ---------------------------------------------------------------------- diff --git a/src/v1/values.cpp b/src/v1/values.cpp index daa98b8..aaa9a7e 100644 --- a/src/v1/values.cpp +++ b/src/v1/values.cpp @@ -133,25 +133,25 @@ Try<Value> parse(const std::string& text) } // namespace internal { -ostream& operator << (ostream& stream, const Value::Scalar& scalar) +ostream& operator<<(ostream& stream, const Value::Scalar& scalar) { return stream << scalar.value(); } -bool operator == (const Value::Scalar& left, const Value::Scalar& right) +bool operator==(const Value::Scalar& left, const Value::Scalar& right) { return left.value() == right.value(); } -bool operator <= (const Value::Scalar& left, const Value::Scalar& right) +bool operator<=(const Value::Scalar& left, const Value::Scalar& right) { return left.value() <= right.value(); } -Value::Scalar operator + (const Value::Scalar& left, const Value::Scalar& right) +Value::Scalar operator+(const Value::Scalar& left, const Value::Scalar& right) { Value::Scalar result; result.set_value(left.value() + right.value()); @@ -159,7 +159,7 @@ Value::Scalar operator + (const Value::Scalar& left, const Value::Scalar& right) } -Value::Scalar operator - (const Value::Scalar& left, const Value::Scalar& right) +Value::Scalar operator-(const Value::Scalar& left, const Value::Scalar& right) { Value::Scalar result; result.set_value(left.value() - right.value()); @@ -167,14 +167,14 @@ Value::Scalar operator - (const Value::Scalar& left, const Value::Scalar& right) } -Value::Scalar& operator += (Value::Scalar& left, const Value::Scalar& right) +Value::Scalar& operator+=(Value::Scalar& left, const Value::Scalar& right) { left.set_value(left.value() + right.value()); return left; } -Value::Scalar& operator -= (Value::Scalar& left, const Value::Scalar& right) +Value::Scalar& operator-=(Value::Scalar& left, const Value::Scalar& right) { left.set_value(left.value() - right.value()); return left; @@ -292,7 +292,7 @@ static void remove(Value::Ranges* ranges, const Value::Range& range) } -ostream& operator << (ostream& stream, const Value::Ranges& ranges) +ostream& operator<<(ostream& stream, const Value::Ranges& ranges) { stream << "["; for (int i = 0; i < ranges.range_size(); i++) { @@ -306,7 +306,7 @@ ostream& operator << (ostream& stream, const Value::Ranges& ranges) } -bool operator == (const Value::Ranges& _left, const Value::Ranges& _right) +bool operator==(const Value::Ranges& _left, const Value::Ranges& _right) { Value::Ranges left; coalesce(&left, _left); @@ -338,7 +338,7 @@ bool operator == (const Value::Ranges& _left, const Value::Ranges& _right) } -bool operator <= (const Value::Ranges& _left, const Value::Ranges& _right) +bool operator<=(const Value::Ranges& _left, const Value::Ranges& _right) { Value::Ranges left; coalesce(&left, _left); @@ -365,7 +365,7 @@ bool operator <= (const Value::Ranges& _left, const Value::Ranges& _right) } -Value::Ranges operator + (const Value::Ranges& left, const Value::Ranges& right) +Value::Ranges operator+(const Value::Ranges& left, const Value::Ranges& right) { Value::Ranges result; @@ -376,7 +376,7 @@ Value::Ranges operator + (const Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges operator - (const Value::Ranges& left, const Value::Ranges& right) +Value::Ranges operator-(const Value::Ranges& left, const Value::Ranges& right) { Value::Ranges result; @@ -391,7 +391,7 @@ Value::Ranges operator - (const Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right) +Value::Ranges& operator+=(Value::Ranges& left, const Value::Ranges& right) { Value::Ranges temp; @@ -405,7 +405,7 @@ Value::Ranges& operator += (Value::Ranges& left, const Value::Ranges& right) } -Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right) +Value::Ranges& operator-=(Value::Ranges& left, const Value::Ranges& right) { Value::Ranges temp; @@ -422,7 +422,7 @@ Value::Ranges& operator -= (Value::Ranges& left, const Value::Ranges& right) } -ostream& operator << (ostream& stream, const Value::Set& set) +ostream& operator<<(ostream& stream, const Value::Set& set) { stream << "{"; for (int i = 0; i < set.item_size(); i++) { @@ -436,7 +436,7 @@ ostream& operator << (ostream& stream, const Value::Set& set) } -bool operator == (const Value::Set& left, const Value::Set& right) +bool operator==(const Value::Set& left, const Value::Set& right) { if (left.item_size() == right.item_size()) { for (int i = 0; i < left.item_size(); i++) { @@ -461,7 +461,7 @@ bool operator == (const Value::Set& left, const Value::Set& right) } -bool operator <= (const Value::Set& left, const Value::Set& right) +bool operator<=(const Value::Set& left, const Value::Set& right) { if (left.item_size() <= right.item_size()) { for (int i = 0; i < left.item_size(); i++) { @@ -486,7 +486,7 @@ bool operator <= (const Value::Set& left, const Value::Set& right) } -Value::Set operator + (const Value::Set& left, const Value::Set& right) +Value::Set operator+(const Value::Set& left, const Value::Set& right) { Value::Set result; @@ -513,7 +513,7 @@ Value::Set operator + (const Value::Set& left, const Value::Set& right) } -Value::Set operator - (const Value::Set& left, const Value::Set& right) +Value::Set operator-(const Value::Set& left, const Value::Set& right) { Value::Set result; @@ -536,7 +536,7 @@ Value::Set operator - (const Value::Set& left, const Value::Set& right) } -Value::Set& operator += (Value::Set& left, const Value::Set& right) +Value::Set& operator+=(Value::Set& left, const Value::Set& right) { // A little bit of extra logic to avoid adding duplicates from right. for (int i = 0; i < right.item_size(); i++) { @@ -557,7 +557,7 @@ Value::Set& operator += (Value::Set& left, const Value::Set& right) } -Value::Set& operator -= (Value::Set& left, const Value::Set& right) +Value::Set& operator-=(Value::Set& left, const Value::Set& right) { // For each item in right, remove it if it's in left. for (int i = 0; i < right.item_size(); i++) { @@ -573,13 +573,13 @@ Value::Set& operator -= (Value::Set& left, const Value::Set& right) } -ostream& operator << (ostream& stream, const Value::Text& value) +ostream& operator<<(ostream& stream, const Value::Text& value) { return stream << value.value(); } -bool operator == (const Value::Text& left, const Value::Text& right) +bool operator==(const Value::Text& left, const Value::Text& right) { return left.value() == right.value(); }
