00001 //# RegSequence.h: Sequence for the Register template functions 00002 //# Copyright (C) 1993,1994,1995,1999 00003 //# Associated Universities, Inc. Washington DC, USA. 00004 //# 00005 //# This library is free software; you can redistribute it and/or modify it 00006 //# under the terms of the GNU Library General Public License as published by 00007 //# the Free Software Foundation; either version 2 of the License, or (at your 00008 //# option) any later version. 00009 //# 00010 //# This library is distributed in the hope that it will be useful, but WITHOUT 00011 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 00012 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 00013 //# License for more details. 00014 //# 00015 //# You should have received a copy of the GNU Library General Public License 00016 //# along with this library; if not, write to the Free Software Foundation, 00017 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 00018 //# 00019 //# Correspondence concerning AIPS++ should be addressed as follows: 00020 //# Internet email: aips2-request@nrao.edu. 00021 //# Postal address: AIPS++ Project Office 00022 //# National Radio Astronomy Observatory 00023 //# 520 Edgemont Road 00024 //# Charlottesville, VA 22903-2475 USA 00025 //# 00026 //# $Id$ 00027 00028 #ifndef CASA_REGSEQUENCE_H 00029 #define CASA_REGSEQUENCE_H 00030 00031 #include <casacore/casa/aips.h> 00032 #include <casacore/casa/Utilities/Sequence.h> 00033 #include <casacore/casa/OS/Mutex.h> 00034 00035 namespace casacore { //# NAMESPACE CASACORE - BEGIN 00036 00037 // <summary> Sequence for the Register() template functions </summary> 00038 // <use visibility=export> 00039 // <reviewed reviewer="Friso Olnon" date="1995/03/17" tests="" demos=""> 00040 // </reviewed> 00041 00042 // <prerequisite> 00043 // <li> class <linkto class=Sequence>Sequence</linkto> 00044 // <li> global function <linkto group="Register.h#register">Register</linkto> 00045 // </prerequisite> 00046 00047 // <synopsis> 00048 // This class provides a <linkto class=Sequence>Sequence</linkto> for the 00049 // <linkto group="Register.h#register">Register()</linkto> template 00050 // functions. Providing a separate sequence exclusively for 00051 // <src>Register()</src> makes it less likely that the <src>uInt</src> 00052 // counter will overflow. 00053 // </synopsis> 00054 00055 class RegSequence : public Sequence<uInt> { 00056 public: 00057 // Get the next <src>uInt</src> value in the sequence (thread-safe). 00058 // <group> 00059 uInt getNext(); 00060 static uInt SgetNext() {return ++num;} 00061 // </group> 00062 00063 private: 00064 static uInt num; 00065 static Mutex theirMutex; 00066 }; 00067 00068 00069 } //# NAMESPACE CASACORE - END 00070 00071 #endif 00072 00073