Note: this is documentation for an old release. View the latest documentation at docs.fenicsproject.org/v0.1.0/v0.9.0/cpp
DOLFINx  0.1.0
DOLFINx C++ interface
UniqueIdGenerator.h
1 // Copyright (C) 2010 Garth N. Wells
2 //
3 // This file is part of DOLFINx (https://www.fenicsproject.org)
4 //
5 // SPDX-License-Identifier: LGPL-3.0-or-later
6 
7 #pragma once
8 
9 #include <cstddef>
10 
11 namespace dolfinx::common
12 {
13 
16 
18 {
19 public:
21 
23  static std::size_t id();
24 
25 private:
26  // Singleton instance
27  static UniqueIdGenerator unique_id_generator;
28 
29  // Next ID to be returned
30  std::size_t _next_id;
31 };
32 } // namespace dolfinx::common
dolfinx::common
Miscellaneous classes, functions and types.
dolfinx::common::UniqueIdGenerator
This is a singleton class that return IDs that are unique in the lifetime of a program.
Definition: UniqueIdGenerator.h:17
dolfinx::common::UniqueIdGenerator::id
static std::size_t id()
Generate a unique ID.
Definition: UniqueIdGenerator.cpp:22