casacore
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
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: 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_CONVERTSCALAR_H
29
#define CASA_CONVERTSCALAR_H
30
31
//# Includes
32
#include <
casacore/casa/aips.h
>
33
#include <
casacore/casa/BasicSL/Complex.h
>
34
35
namespace
casacore {
//# NAMESPACE CASACORE - BEGIN
36
37
// <summary>
38
// Templated functions to convert scalars from one type to another.
39
// </summary>
40
// <reviewed reviewer="UNKNOWN" date="before2004/08/25" tests="" demos="">
41
// </reviewed>
42
43
// <synopsis>
44
// Templated functions to convert scalars from one type to another.
45
// They are useful to be able to convert a DComplex to a Complex
46
// in templated classes.
47
// A Complex,DComplex specialisation is necessary because the complex
48
// class in the standard C++ library does not have such an automatic
49
// conversion.
50
// </synopsis>
51
52
// <group name="Scalar conversion">
53
template
<
class
T,
class
F>
inline
void
convertScalar
(T& out, F in)
54
{ out =
static_cast<
T
>
(in); }
55
inline
void
convertScalar
(
Complex
& out,
DComplex
in)
56
{ out =
Complex
(in.real(), in.imag()); }
57
// </group>
58
59
60
}
//# NAMESPACE CASACORE - END
61
62
#endif
Complexfwd_global_functions_Complexfwd::casacore::Complex
std::complex< Float > Complex
Definition:
Complexfwd.h:49
casacore::arrays_internal::convertScalar
void convertScalar(T &out, F in)
Definition:
ElementFunctions.h:292
aips.h
Complexfwd_global_functions_Complexfwd::casacore::DComplex
std::complex< Double > DComplex
Definition:
Complexfwd.h:50
Complex.h
Generated by
1.8.5