![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
C++ utility functions for UUID manipulation. More...


Go to the source code of this file.
Functions | |
| std::string | UUIDDatum2string (Datum token) |
Convert a PostgreSQL Datum holding a UUID to a std::string. | |
| std::string | uuid2string (pg_uuid_t uuid) |
Format a pg_uuid_t as a std::string. | |
| pg_uuid_t | string2uuid (const std::string &source) |
Parse a UUID string into a pg_uuid_t. | |
| std::size_t | hash_value (const pg_uuid_t &u) |
Compute a hash value for a pg_uuid_t. | |
| bool | operator== (const pg_uuid_t &u, const pg_uuid_t &v) |
Test two pg_uuid_t values for equality. | |
C++ utility functions for UUID manipulation.
This header declares C++ helper functions that convert between PostgreSQL's pg_uuid_t / Datum representations and std::string, compute hash values for UUIDs (enabling use in std::unordered_map and Boost containers), and define equality comparison for pg_uuid_t values.
These utilities are used throughout the C++ circuit and evaluation code wherever UUID tokens need to be stored in STL containers or compared by value.
Definition in file provsql_utils_cpp.h.
| std::size_t hash_value | ( | const pg_uuid_t & | u | ) |
Compute a hash value for a pg_uuid_t.
Reinterprets the 16-byte UUID as two 64-bit integers and XOR-combines their standard hashes. Used by Boost's hash infrastructure so that pg_uuid_t can be used as a key in Boost multi-index containers.
| u | The UUID to hash. |
std::size_t hash value. Definition at line 110 of file provsql_utils_cpp.cpp.
Test two pg_uuid_t values for equality.
Compares all 16 bytes of the UUID data.
| u | First UUID. |
| v | Second UUID. |
true if u and v represent the same UUID. Definition at line 115 of file provsql_utils_cpp.cpp.
| pg_uuid_t string2uuid | ( | const std::string & | source | ) |
| std::string uuid2string | ( | pg_uuid_t | uuid | ) |
Format a pg_uuid_t as a std::string.
| uuid | The UUID to format. |
std::string. Definition at line 28 of file provsql_utils_cpp.cpp.

| std::string UUIDDatum2string | ( | Datum | token | ) |
Convert a PostgreSQL Datum holding a UUID to a std::string.
Detoasts and formats the UUID value as the standard 36-character hyphenated hex string (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
| token | A Datum containing a pg_uuid_t value. |
std::string. Definition at line 104 of file provsql_utils_cpp.cpp.

