Poco

class ULIDGenerator

Library: Foundation
Package: ULID
Header: Poco/ULIDGenerator.h

Description

This class implements a generator for [Universally Unique Lexicographically Sortable Identifier](https://github.com/ulid/spec) (ULID)s.

Member Summary

Member Functions: create, defaultGenerator

Constructors

ULIDGenerator

ULIDGenerator();

Creates the ULIDGenerator.

Destructor

~ULIDGenerator

~ULIDGenerator();

Destroys the ULIDGenerator.

Member Functions

create

ULID create();

Creates a new ULID based on the current time.

NOTE: In the very rare case that the random part of the ULID overflows due to too many subsequent calls to create() in the same millisecond, create() will wait for the current millisecond to elapse before generating a new ULID.

create

ULID create(
    UInt64 time
);

Creates a new ULID based on the given time (milliseconds since UNIX epoch).

NOTE: In the very rare case of an overflow of the random part due to too many subsequent calls to create() with the same time, throws a RuntimeException.

defaultGenerator static

static ULIDGenerator & defaultGenerator();

Returns a reference to the default ULIDGenerator.