Manual Reference Pages  - M_uuid (3m_uuid)

NAME

M_uuid(3f) - [M_uuid::INTRO] a module of UUID (Universally Unique IDentifier) procedures (LICENSE:BSD-4-Clause)

CONTENTS

Synopsis
Description
Example

SYNOPSIS

public entities:

     use M_uuid, only : generate_uuid
     !
     function generate_uuid(version) result(uuid)
     integer, intent(in), optional :: version
     character(len=36) :: uuid

DESCRIPTION

Remember you are unique, just like everyone else.

A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems.

When generated according to the standard methods, UUIDs are for practical purposes unique, without depending for their uniqueness on a central registration authority or coordination between the parties generating them, unlike most other numbering schemes. While the probability that a UUID will be duplicated is not zero, it is close enough to zero to be negligible.

Thus, anyone can create a UUID and use it to identify something with near certainty that the identifier does not duplicate one that has already been or will be created to identify something else. Information labeled with UUIDs by independent parties can therefore be later combined into a single database, or transmitted on the same channel, without needing to resolve conflicts between identifiers.

Adoption of UUIDs and GUIDs is widespread. Many computing platforms provide support for generating them, and for parsing their textual representation.

RFC 4122 defines a Uniform Resource Name (URN) namespace for UUIDs. A UUID presented as a URN appears as follows:

      urn:uuid:123e4567-e89b-12d3-a456-426655440000

-- Wikipedia

EXAMPLE

Sample program:

    program demo_M_uuid
    ! generate 36-character UUID string
    use M_uuid, only : generate_uuid
    implicit none
    character(len=36)   :: uuid
    character(len=4096) :: filename
       ! version 1 (time-based UUID)
       write(*,’(a36)’) generate_uuid(version=1)
       ! version 4 (pseudo-RNG-based), default
       write(*,’(a36)’) generate_uuid(version=4)
       ! RFC 4122 defines a UUID Uniform Resource Name (URN) namespace
       write(*,’("urn:uuid:",a36)’) generate_uuid(version=4)
       ! a good scratch file name
       open(file=’/tmp/scratch_’//generate_uuid(),unit=10)
       inquire(unit=10,name=filename)
       write(*,’(*(g0))’) trim(filename)
       close(unit=10,status=’delete’)
    end program demo_M_uuid

Results:

    > 7bc99c22-65ae-11ef-5143-11d1be3150ff
    > dcdb2c0f-918f-4267-79f6-1612b35ef28b
    > urn:uuid:fe86c986-31ae-4b34-4e2e-beaed6f7391b
    > /tmp/scratch_fee7cac1-5756-4195-4102-2d34fd966af9


Nemo Release 3.1 M_uuid (3m_uuid) August 29, 2024
Generated by manServer 1.08 from 7cb77c52-8668-4786-804f-830fc1cdfdf9 using man macros.