casacore
Loading...
Searching...
No Matches
casa
BasicMath
ConvertScalar.h
Go to the documentation of this file.
1
//# ConvertScalar.h: Templated functions to convert scalars
2
//# Copyright (C) 2000,2002
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: casa-feedback@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
#ifndef CASA_CONVERTSCALAR_H
27
#define CASA_CONVERTSCALAR_H
28
29
//# Includes
30
#include <casacore/casa/aips.h>
31
#include <casacore/casa/BasicSL/Complex.h>
32
33
namespace
casacore
{
//# NAMESPACE CASACORE - BEGIN
34
35
// <summary>
36
// Templated functions to convert scalars from one type to another.
37
// </summary>
38
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
39
// </reviewed>
40
41
// <synopsis>
42
// Templated functions to convert scalars from one type to another.
43
// They are useful to be able to convert a DComplex to a Complex
44
// in templated classes.
45
// A Complex,DComplex specialisation is necessary because the complex
46
// class in the standard C++ library does not have such an automatic
47
// conversion.
48
// </synopsis>
49
50
// <group name="Scalar conversion">
51
template
<
class
T,
class
F>
inline
void
convertScalar (T& out, F in)
52
{ out =
static_cast<
T
>
(in); }
53
inline
void
convertScalar (Complex& out, DComplex in)
54
{ out = Complex(in.real(), in.imag()); }
55
// </group>
56
57
58
}
//# NAMESPACE CASACORE - END
59
60
#endif
casacore
this file contains all the compiler specific defines
Definition
mainpage.dox:28
casacore::ConvertScalar_global_functions_Scalar_conversion
Definition
ConvertScalar.h:51
casacore::ConvertScalar_global_functions_Scalar_conversion::convertScalar
void convertScalar(Complex &out, DComplex in)
Definition
ConvertScalar.h:54
casacore::ConvertScalar_global_functions_Scalar_conversion::convertScalar
void convertScalar(T &out, F in)
Definition
ConvertScalar.h:52
Generated by
1.9.8