File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -11448,4 +11448,30 @@ cass_alloc_set_functions(CassMallocFunction malloc_func,
11448
11448
} /* extern "C" */
11449
11449
#endif
11450
11450
11451
+ #ifdef __cplusplus
11452
+ /**
11453
+ * Compare two UUIDs for ordering
11454
+ *
11455
+ * This operator is useful to use CassUuid variables as std::map keys, for
11456
+ * instance.
11457
+ *
11458
+ * @param uuid1 A UUID
11459
+ * @param uuid2 Another UUID
11460
+ * @return true if, and only if, uuid1 is numerically less or equal than uuid2
11461
+ */
11462
+ bool operator < (const CassUuid & uuid1 , const CassUuid & uuid2 );
11463
+
11464
+ /**
11465
+ * Compare two UUIDs for equality
11466
+ *
11467
+ * This operator is useful to use CassUuid variables as std::map keys, for
11468
+ * instance.
11469
+ *
11470
+ * @param uuid1 A UUID
11471
+ * @param uuid2 Another UUID
11472
+ * @return true if, and only if, uuid1 is numerically less or equal than uuid2
11473
+ */
11474
+ bool operator == (const CassUuid & uuid1 , const CassUuid & uuid2 );
11475
+ #endif
11476
+
11451
11477
#endif /* __CASS_H_INCLUDED__ */
Original file line number Diff line number Diff line change @@ -44,6 +44,18 @@ static uint64_t set_version(uint64_t timestamp, uint8_t version) {
44
44
return (timestamp & 0x0FFFFFFFFFFFFFFFLL ) | (static_cast <uint64_t >(version) << 60 );
45
45
}
46
46
47
+ bool operator <(const CassUuid& uuid1, const CassUuid& uuid2) {
48
+ if (uuid1.time_and_version == uuid2.time_and_version )
49
+ return uuid1.clock_seq_and_node < uuid2.clock_seq_and_node ;
50
+ else
51
+ return uuid1.time_and_version < uuid2.time_and_version ;
52
+ }
53
+
54
+ bool operator ==(const CassUuid& uuid1, const CassUuid& uuid2) {
55
+ return uuid1.time_and_version == uuid2.time_and_version
56
+ && uuid1.clock_seq_and_node == uuid2.clock_seq_and_node ;
57
+ }
58
+
47
59
extern " C" {
48
60
49
61
CassUuidGen* cass_uuid_gen_new () { return CassUuidGen::to (new UuidGen ()); }
You can’t perform that action at this time.
0 commit comments