Skip to content

Commit cdd61d6

Browse files
committed
Refactor: implement operator!= using operator==
Signed-off-by: Christopher Beard <cbeard9@bloomberg.net>
1 parent e7d19e8 commit cdd61d6

10 files changed

Lines changed: 11 additions & 36 deletions

src/groups/bmq/bmqa/bmqa_queueid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ inline bool bmqa::operator==(const bmqa::QueueId& lhs,
192192
inline bool bmqa::operator!=(const bmqa::QueueId& lhs,
193193
const bmqa::QueueId& rhs)
194194
{
195-
return rhs.d_impl_sp.get() != lhs.d_impl_sp.get();
195+
return !(lhs == rhs);
196196
}
197197

198198
inline bool bmqa::operator<(const bmqa::QueueId& lhs, const bmqa::QueueId& rhs)

src/groups/bmq/bmqa/bmqa_sessionevent.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,7 @@ bool operator==(const SessionEvent& lhs, const SessionEvent& rhs)
160160

161161
bool operator!=(const SessionEvent& lhs, const SessionEvent& rhs)
162162
{
163-
// PRECONDITIONS
164-
BSLS_ASSERT_SAFE(lhs.d_impl_sp);
165-
BSLS_ASSERT_SAFE(rhs.d_impl_sp);
166-
167-
return *lhs.d_impl_sp != *rhs.d_impl_sp;
163+
return !(lhs == rhs);
168164
}
169165

170166
} // close package namespace

src/groups/bmq/bmqp/bmqp_queueinfo.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ QueueInfo<VALUE>::iterator::operator->()
232232
template <class VALUE>
233233
inline bool QueueInfo<VALUE>::iterator::operator!=(const iterator& other) const
234234
{
235-
return d_iterator != other.d_iterator;
235+
return !(*this == other);
236236
}
237237

238238
template <class VALUE>
@@ -305,7 +305,7 @@ template <class VALUE>
305305
inline bool
306306
QueueInfo<VALUE>::const_iterator::operator!=(const const_iterator& other) const
307307
{
308-
return d_iterator != other.d_iterator;
308+
return !(*this == other);
309309
}
310310

311311
template <class VALUE>

src/groups/bmq/bmqst/bmqst_value.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -274,11 +274,7 @@ inline bool bmqst::operator==(const bmqst::Value& lhs, const bmqst::Value& rhs)
274274

275275
inline bool bmqst::operator!=(const bmqst::Value& lhs, const bmqst::Value& rhs)
276276
{
277-
if (lhs.hash() != rhs.hash()) {
278-
return true;
279-
}
280-
281-
return lhs.d_value != rhs.d_value;
277+
return !(lhs == rhs);
282278
}
283279

284280
} // close enterprise namespace

src/groups/bmq/bmqt/bmqt_correlationid.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ inline bool bmqt::operator==(const bmqt::CorrelationId& lhs,
582582
inline bool bmqt::operator!=(const bmqt::CorrelationId& lhs,
583583
const bmqt::CorrelationId& rhs)
584584
{
585-
return lhs.d_variant != rhs.d_variant;
585+
return !(lhs == rhs);
586586
}
587587

588588
inline bool bmqt::operator<(const bmqt::CorrelationId& lhs,

src/groups/bmq/bmqt/bmqt_queueoptions.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,10 +354,7 @@ inline bool bmqt::operator==(const bmqt::QueueOptions& lhs,
354354
inline bool bmqt::operator!=(const bmqt::QueueOptions& lhs,
355355
const bmqt::QueueOptions& rhs)
356356
{
357-
return lhs.maxUnconfirmedMessages() != rhs.maxUnconfirmedMessages() ||
358-
lhs.maxUnconfirmedBytes() != rhs.maxUnconfirmedBytes() ||
359-
lhs.consumerPriority() != rhs.consumerPriority() ||
360-
lhs.suspendsOnBadHostHealth() != rhs.suspendsOnBadHostHealth();
357+
return !(lhs == rhs);
361358
}
362359

363360
inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,

src/groups/bmq/bmqt/bmqt_sessionoptions.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -751,21 +751,7 @@ inline bool bmqt::operator==(const bmqt::SessionOptions& lhs,
751751
inline bool bmqt::operator!=(const bmqt::SessionOptions& lhs,
752752
const bmqt::SessionOptions& rhs)
753753
{
754-
return lhs.brokerUri() != rhs.brokerUri() ||
755-
lhs.numProcessingThreads() != rhs.numProcessingThreads() ||
756-
lhs.blobBufferSize() != rhs.blobBufferSize() ||
757-
lhs.channelHighWatermark() != rhs.channelHighWatermark() ||
758-
lhs.statsDumpInterval() != rhs.statsDumpInterval() ||
759-
lhs.connectTimeout() != rhs.connectTimeout() ||
760-
lhs.openQueueTimeout() != rhs.openQueueTimeout() ||
761-
lhs.configureQueueTimeout() != rhs.configureQueueTimeout() ||
762-
lhs.closeQueueTimeout() != rhs.closeQueueTimeout() ||
763-
lhs.eventQueueLowWatermark() != rhs.eventQueueLowWatermark() ||
764-
lhs.eventQueueHighWatermark() != rhs.eventQueueHighWatermark() ||
765-
lhs.hostHealthMonitor() != rhs.hostHealthMonitor() ||
766-
lhs.traceContext() != rhs.traceContext() ||
767-
lhs.tracer() != rhs.tracer() ||
768-
lhs.userAgentPrefix() != rhs.userAgentPrefix();
754+
return !(lhs == rhs);
769755
}
770756

771757
inline bsl::ostream& bmqt::operator<<(bsl::ostream& stream,

src/groups/bmq/bmqt/bmqt_subscription.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ inline bool operator==(const SubscriptionHandle& lhs,
498498
inline bool operator!=(const SubscriptionHandle& lhs,
499499
const SubscriptionHandle& rhs)
500500
{
501-
return lhs.d_id != rhs.d_id;
501+
return !(lhs == rhs);
502502
}
503503

504504
inline bsl::ostream& operator<<(bsl::ostream& stream,

src/groups/bmq/bmqt/bmqt_uri.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ inline bool bmqt::operator==(const bmqt::Uri& lhs, const bmqt::Uri& rhs)
524524

525525
inline bool bmqt::operator!=(const bmqt::Uri& lhs, const bmqt::Uri& rhs)
526526
{
527-
return (lhs.asString() != rhs.asString());
527+
return !(lhs == rhs);
528528
}
529529

530530
inline bool bmqt::operator<(const bmqt::Uri& lhs, const bmqt::Uri& rhs)

src/groups/bmq/bmqt/bmqt_version.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ inline bool bmqt::operator==(const bmqt::Version& lhs,
188188
inline bool bmqt::operator!=(const bmqt::Version& lhs,
189189
const bmqt::Version& rhs)
190190
{
191-
return lhs.major() != rhs.major() || lhs.minor() != rhs.minor();
191+
return !(lhs == rhs);
192192
}
193193

194194
inline bool bmqt::operator<(const bmqt::Version& lhs, const bmqt::Version& rhs)

0 commit comments

Comments
 (0)