00001 // -*- C++ -*- 00002 /*************************************************************************** 00003 * 00004 * The IPPL Framework 00005 * 00006 * 00007 * Visit http://people.web.psi.ch/adelmann/ for more details 00008 * 00009 ***************************************************************************/ 00010 00011 #ifndef UNIQUE_H 00012 #define UNIQUE_H 00013 00014 /* 00015 00016 This class is used to generate a series of unique id numbers. 00017 00018 Each time you call Unique::get() you get a unique object of type 00019 Unique::type. 00020 00021 Typically Unique::type will be an integer. 00022 00023 A proper parallel implementation of this object will ensure that 00024 the returned id's are unique across the whole machine. 00025 00026 */ 00027 00028 class Unique 00029 { 00030 public: 00031 typedef int type; // An int is simple and quick for sorting. 00032 00033 static type get() // Get the next one. 00034 { // 00035 return Last++; // return it. 00036 } 00037 00038 private: 00039 Unique(); // Don't actually build any of these. 00040 00041 static type Last; // The last one returned. 00042 }; 00043 00044 #endif // UNIQUE_H 00045 00046 /*************************************************************************** 00047 * $RCSfile: Unique.h,v $ $Author: adelmann $ 00048 * $Revision: 1.1.1.1 $ $Date: 2003/01/23 07:40:33 $ 00049 * IPPL_VERSION_ID: $Id: Unique.h,v 1.1.1.1 2003/01/23 07:40:33 adelmann Exp $ 00050 ***************************************************************************/