Skip to content

Commit

Permalink
polish
Browse files Browse the repository at this point in the history
  • Loading branch information
henryzhx8 committed Sep 14, 2024
1 parent 028cc81 commit 3d010df
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions core/monitor/LogtailMetric.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ class MetricsRecord {

class MetricsRecordRef {
friend class WriteMetrics;
friend bool operator==(const MetricsRecordRef& lhs, std::nullptr_t rhs);
friend bool operator==(std::nullptr_t rhs, const MetricsRecordRef& lhs);

private:
MetricsRecord* mMetrics = nullptr;
Expand All @@ -83,6 +85,22 @@ class MetricsRecordRef {
#endif
};

inline bool operator==(const MetricsRecordRef& lhs, std::nullptr_t rhs) {
return lhs.mMetrics == rhs;
}

inline bool operator==(std::nullptr_t lhs, const MetricsRecordRef& rhs) {
return lhs == rhs.mMetrics;
}

inline bool operator!=(const MetricsRecordRef& lhs, std::nullptr_t rhs) {
return !(lhs == rhs);
}

inline bool operator!=(std::nullptr_t lhs, const MetricsRecordRef& rhs) {
return !(lhs == rhs);
}

class ReentrantMetricsRecord {
private:
MetricsRecordRef mMetricsRecordRef;
Expand Down

0 comments on commit 3d010df

Please sign in to comment.