casa
5.7.0-16
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
casa
casacore
casa
Utilities
RegSequence.h
Go to the documentation of this file.
1
//# RegSequence.h: Sequence for the Register template functions
2
//# Copyright (C) 1993,1994,1995,1999
3
//# Associated Universities, Inc. Washington DC, USA.
4
//#
5
//# This library is free software; you can redistribute it and/or modify it
6
//# under the terms of the GNU Library General Public License as published by
7
//# the Free Software Foundation; either version 2 of the License, or (at your
8
//# option) any later version.
9
//#
10
//# This library is distributed in the hope that it will be useful, but WITHOUT
11
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
//# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13
//# License for more details.
14
//#
15
//# You should have received a copy of the GNU Library General Public License
16
//# along with this library; if not, write to the Free Software Foundation,
17
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18
//#
19
//# Correspondence concerning AIPS++ should be addressed as follows:
20
//# Internet email: aips2-request@nrao.edu.
21
//# Postal address: AIPS++ Project Office
22
//# National Radio Astronomy Observatory
23
//# 520 Edgemont Road
24
//# Charlottesville, VA 22903-2475 USA
25
//#
26
//# $Id$
27
28
#ifndef CASA_REGSEQUENCE_H
29
#define CASA_REGSEQUENCE_H
30
31
#include <
casacore/casa/aips.h
>
32
#include <
casacore/casa/Utilities/Sequence.h
>
33
34
namespace
casacore
{
//# NAMESPACE CASACORE - BEGIN
35
36
// <summary> Sequence for the Register() template functions </summary>
37
// <use visibility=export>
38
// <reviewed reviewer="Friso Olnon" date="1995/03/17" tests="" demos="">
39
// </reviewed>
40
41
// <prerequisite>
42
// <li> class <linkto class=Sequence>Sequence</linkto>
43
// <li> global function <linkto group="Register.h#register">Register</linkto>
44
// </prerequisite>
45
46
// <synopsis>
47
// This class provides a <linkto class=Sequence>Sequence</linkto> for the
48
// <linkto group="Register.h#register">Register()</linkto> template
49
// functions. Providing a separate sequence exclusively for
50
// <src>Register()</src> makes it less likely that the <src>uInt</src>
51
// counter will overflow.
52
// </synopsis>
53
54
class
RegSequence
:
public
Sequence
<uInt> {
55
public
:
56
// Get the next <src>uInt</src> value in the sequence (thread-safe).
57
// <group>
58
uInt
getNext
();
59
static
uInt
SgetNext
() {
60
#if defined(USE_THREADS)
61
return
next
.fetch_add(1);
62
#else
63
return
next
++;
64
#endif
65
}
66
// </group>
67
68
private
:
69
#if defined(USE_THREADS)
70
static
std::atomic<uInt>
next
;
71
#else
72
static
uInt
next
;
73
#endif
74
};
75
76
77
}
//# NAMESPACE CASACORE - END
78
79
#endif
80
81
Sequence.h
casacore::RegSequence::getNext
uInt getNext()
Get the next uInt value in the sequence (thread-safe).
aips.h
casacore::Sequence
virtual templated base class for sequences
Definition:
Sequence.h:47
casacore::RegSequence::SgetNext
static uInt SgetNext()
Definition:
RegSequence.h:59
casacore::RegSequence::next
static uInt next
Definition:
RegSequence.h:72
casacore::uInt
unsigned int uInt
Definition:
aipstype.h:51
casacore::RegSequence
Sequence for the Register() template functions.
Definition:
RegSequence.h:54
casacore
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.
Definition:
X11Intrinsic.h:42
Generated on Sun Sep 1 2019 23:32:13 for casa by
1.8.5