|
NAMEzuuid - Class for UUID support class SYNOPSIS// This is a stable class, and may not change except for emergencies. It // is provided in stable builds. // Create a new UUID object. CZMQ_EXPORT zuuid_t * DESCRIPTIONThe zuuid class generates UUIDs and provides methods for working with them. If you build CZMQ with libuuid, on Unix/Linux, it will use that library. On Windows it will use UuidCreate(). Otherwise it will use a random number generator to produce convincing imitations of UUIDs. Please add @discuss section in ./../src/zuuid.c. EXAMPLEFrom zuuid_test method. // Simple create/destroy test
assert (ZUUID_LEN == 16);
assert (ZUUID_STR_LEN == 32);
zuuid_t *uuid = zuuid_new ();
assert (uuid);
assert (zuuid_size (uuid) == ZUUID_LEN);
assert (strlen (zuuid_str (uuid)) == ZUUID_STR_LEN);
zuuid_t *copy = zuuid_dup (uuid);
assert (streq (zuuid_str (uuid), zuuid_str (copy)));
// Check set/set_str/export methods
const char *myuuid = "8CB3E9A9649B4BEF8DE225E9C2CEBB38";
const char *myuuid2 = "8CB3E9A9-649B-4BEF-8DE2-25E9C2CEBB38";
const char *myuuid3 = "{8CB3E9A9-649B-4BEF-8DE2-25E9C2CEBB38}";
const char *myuuid4 = "8CB3E9A9649B4BEF8DE225E9C2CEBB3838";
int rc = zuuid_set_str (uuid, myuuid);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid2);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid3);
assert (rc == 0);
assert (streq (zuuid_str (uuid), myuuid));
rc = zuuid_set_str (uuid, myuuid4);
assert (rc == -1);
byte copy_uuid [ZUUID_LEN];
zuuid_export (uuid, copy_uuid);
zuuid_set (uuid, copy_uuid);
assert (streq (zuuid_str (uuid), myuuid));
// Check the canonical string format
assert (streq (zuuid_str_canonical (uuid),
AUTHORSThe czmq manual was written by the authors in the AUTHORS file. RESOURCESMain web site: Report bugs to the email <zeromq-dev@lists.zeromq.org[1]> COPYRIGHTCopyright (c) the Contributors as noted in the AUTHORS file. This file is part of CZMQ, the high-level C binding for 0MQ: http://czmq.zeromq.org. This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. LICENSE included with the czmq distribution. NOTES
mailto:zeromq-dev@lists.zeromq.org
|