OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Unique.h
Go to the documentation of this file.
1// -*- C++ -*-
2/***************************************************************************
3 *
4 * The IPPL Framework
5 *
6 *
7 * Visit http://people.web.psi.ch/adelmann/ for more details
8 *
9 ***************************************************************************/
10
11#ifndef UNIQUE_H
12#define UNIQUE_H
13
14/*
15
16 This class is used to generate a series of unique id numbers.
17
18 Each time you call Unique::get() you get a unique object of type
19 Unique::type.
20
21 Typically Unique::type will be an integer.
22
23 A proper parallel implementation of this object will ensure that
24 the returned id's are unique across the whole machine.
25
26 */
27
28class Unique
29{
30public:
31 typedef unsigned int type; // An int is simple and quick for sorting.
32
33 static type get() // Get the next one.
34 { //
35 return Last++; // return it.
36 }
37
38private:
39 Unique(); // Don't actually build any of these.
40
41 static type Last; // The last one returned.
42};
43
44#endif // UNIQUE_H
45
46/***************************************************************************
47 * $RCSfile: Unique.h,v $ $Author: adelmann $
48 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $
49 * IPPL_VERSION_ID: $Id: Unique.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $
50 ***************************************************************************/
Definition: Unique.h:29
unsigned int type
Definition: Unique.h:31
static type Last
Definition: Unique.h:41
static type get()
Definition: Unique.h:33