![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
C++ UUID utility function implementations. More...
#include "postgres.h"#include "utils/uuid.h"#include "provsql_utils.h"#include "provsql_utils_cpp.h"#include <cassert>#include "Circuit.h"
Go to the source code of this file.
Functions | |
| string | uuid2string (pg_uuid_t uuid) |
Format a pg_uuid_t as a std::string. | |
| pg_uuid_t | string2uuid (const string &source) |
Parse a UUID string into a pg_uuid_t. | |
| string | UUIDDatum2string (Datum token) |
Convert a PostgreSQL Datum holding a UUID to a std::string. | |
| 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++ UUID utility function implementations.
Implements the C++ helper functions declared in provsql_utils_cpp.h:
uuid2string(): format a pg_uuid_t as a 36-char hyphenated hex string.string2uuid(): parse a UUID string into a pg_uuid_t.UUIDDatum2string(): extract and format a UUID from a PostgreSQL Datum.hash_value(): Boost-compatible hash for pg_uuid_t.operator==(): byte-level equality for pg_uuid_t.The uuid2string and string2uuid functions are adapted from PostgreSQL's own uuid.c, which is not exposed as a public API.
Definition in file provsql_utils_cpp.cpp.
| 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 string & | source | ) |
Parse a UUID string into a pg_uuid_t.
| source | UUID string in standard hyphenated hex format. |
pg_uuid_t value. Definition at line 53 of file provsql_utils_cpp.cpp.

| 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.

| 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.

