File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Expand file tree Collapse file tree 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,
1144811448} /* extern "C" */
1144911449#endif
1145011450
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+
1145111477#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) {
4444 return (timestamp & 0x0FFFFFFFFFFFFFFFLL ) | (static_cast <uint64_t >(version) << 60 );
4545}
4646
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+
4759extern " C" {
4860
4961CassUuidGen* cass_uuid_gen_new () { return CassUuidGen::to (new UuidGen ()); }
You can’t perform that action at this time.
0 commit comments