casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
RegSequence.h
Go to the documentation of this file.
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: RegSequence.h 21051 2011-04-20 11:46:29Z gervandiepen $
00027 
00028 #ifndef CASA_REGSEQUENCE_H
00029 #define CASA_REGSEQUENCE_H
00030 
00031 #include <casa/Utilities/Sequence.h>
00032 #include <casa/OS/Mutex.h>
00033 
00034 namespace casa { //# NAMESPACE CASA - BEGIN
00035 
00036 // <summary> Sequence for the Register() template functions </summary>
00037 // <use visibility=export>
00038 // <reviewed reviewer="Friso Olnon" date="1995/03/17" tests="" demos="">
00039 // </reviewed>
00040 
00041 // <prerequisite>
00042 // <li> class <linkto class=Sequence>Sequence</linkto>
00043 // <li> global function <linkto group="Register.h#register">Register</linkto>
00044 // </prerequisite>
00045 
00046 // <synopsis> 
00047 // This class provides a <linkto class=Sequence>Sequence</linkto> for the
00048 // <linkto group="Register.h#register">Register()</linkto> template
00049 // functions. Providing a separate sequence exclusively for 
00050 // <src>Register()</src> makes it less likely that the <src>uInt</src>
00051 // counter will overflow.
00052 // </synopsis> 
00053 
00054 class RegSequence : public Sequence<uInt> {
00055 public:
00056     // Get the next <src>uInt</src> value in the sequence (thread-safe).
00057     // <group>
00058     uInt getNext();
00059     static uInt SgetNext() {return ++num;}
00060     // </group>
00061 
00062 private:
00063     static uInt num;
00064     static Mutex theirMutex;
00065 };
00066 
00067 
00068 } //# NAMESPACE CASA - END
00069 
00070 #endif
00071 
00072