casacore
scimath
Fitting
LSQTraits.h
Go to the documentation of this file.
1
//# LSQTraits.h: Typing support classes for LSQ classes
2
//# Copyright (C) 2004
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
#ifndef SCIMATH_LSQTRAITS_H
28
#define SCIMATH_LSQTRAITS_H
29
30
//# Includes
31
#include <casacore/casa/aips.h>
32
#include <complex>
33
34
namespace
casacore
{
//# NAMESPACE CASACORE - BEGIN
35
36
//# Forward Declarations
37
38
// <summary> Typing support classes for LSQ classes </summary>
39
// <reviewed reviewer="Wim Brouw" date="2004/04/01" tests="tLSQFit, tLSQaips"
40
// demos="">
41
// </reviewed>
42
43
// <synopsis>
44
// The following classes are used in detremining the type of iterator
45
// presented to the LSQFit class. They are for a large part based on ideas by
46
// Alexandrescu(2001), 'Modern C++ design'.
47
// </synopsis>
48
49
// <example>
50
// See <linkto class="LSQFit">LSQFit</linkto> class, especially the
51
// <src>LSQFit2.cc</src>
52
// defintion file.
53
// </example>
54
55
// <motivation>
56
// To ease the interface to Fitting (and probably other) classes, by producing
57
// a framework that can be used with Casacore containers.
58
// </motivation>
59
60
// <todo asof="2004/04/01">
61
// <li> Add more type info if and when needed
62
// </todo>
63
64
// Type of real numeric class indicator
65
class
LSQReal
{
66
typedef
LSQReal
value_type
;
67
};
68
69
// <summary> Type of complex numeric class indicator </summary>
70
class
LSQComplex
{
71
typedef
LSQComplex
value_type
;
72
};
73
74
// <summary> Non relevant class indicator </summary>
75
class
LSQNull
{};
76
77
// <summary> Determine if pointer type </summary>
78
template
<
class
T>
79
class
LSQType
{
80
private
:
81
template
<
class
U>
struct
PointerTraits
{
82
enum
{
result
=
False
};
83
typedef
LSQNull
Pointee
;
84
};
85
template
<
class
U>
struct
PointerTraits
<U*> {
86
enum
{ result =
True
};
87
typedef
U
Pointee
;
88
};
89
public
:
90
enum
{
isPointer
=
PointerTraits<T>::result
};
91
typedef
typename
PointerTraits<T>::Pointee
Pointee
;
92
};
93
94
// <summary> Traits for numeric classes used </summary>
95
template
<
class
T>
96
class
LSQTraits
{
97
public
:
98
// Defining type
99
typedef
T
value_type
;
100
// Numeric base type
101
typedef
Char
base
;
102
// Numeric type
103
typedef
Char
num_type
;
104
// Number of basic numeric type elements
105
enum
{
size
= 0 };
106
};
107
108
#if defined LSQTraits_F
109
#undef LSQTraits_F
110
#endif
111
#define LSQTraits_F LSQTraits
112
// <summary>LSQTraits specialization for Float</summary>
113
template
<>
class
LSQTraits_F
<
Float
> {
114
public
:
115
typedef
Float
value_type
;
116
typedef
Float
base
;
117
typedef
LSQReal
num_type
;
118
enum
{ size = 1 };
119
};
120
#undef LSQTraits_F
121
122
#if defined LSQTraits_D
123
#undef LSQTraits_D
124
#endif
125
#define LSQTraits_D LSQTraits
126
// <summary>LSQTraits specialization for Double</summary>
127
template
<>
class
LSQTraits_D
<
Double
> {
128
public
:
129
typedef
Double
value_type
;
130
typedef
Double
base
;
131
typedef
LSQReal
num_type
;
132
enum
{ size = 1 };
133
};
134
#undef LSQTraits_D
135
136
#if defined LSQTraits_CD
137
#undef LSQTraits_CD
138
#endif
139
#define LSQTraits_CD LSQTraits
140
// <summary>LSQTraits specialization for DComplex </summary>
141
template
<>
class
LSQTraits_CD
<
std
::complex<Double> > {
142
public
:
143
typedef
std::complex<Double>
value_type
;
144
typedef
Double
base
;
145
typedef
LSQComplex
num_type
;
146
enum
{ size = 2 };
147
};
148
#undef LSQTraits_CD
149
150
#if defined LSQTraits_CF
151
#undef LSQTraits_CF
152
#endif
153
#define LSQTraits_CF LSQTraits
154
// <summary>LSQTraits specialization for Complex </summary>
155
template
<>
class
LSQTraits_CF
<
std
::complex<Float> > {
156
public
:
157
typedef
std::complex<Float>
value_type
;
158
typedef
Float
base
;
159
typedef
LSQComplex
num_type
;
160
enum
{ size = 2 };
161
};
162
#undef LSQTraits_CF
163
164
165
}
//# NAMESPACE CASACORE - END
166
167
#endif
casacore::LSQType::Pointee
PointerTraits< T >::Pointee Pointee
Definition:
LSQTraits.h:92
casacore::LSQTraits_D< Double >::num_type
LSQReal num_type
Definition:
LSQTraits.h:132
casacore::LSQComplex
Type of complex numeric class indicator
Definition:
LSQTraits.h:71
casacore::LSQType::PointerTraits
Definition:
LSQTraits.h:82
casacore::LSQTraits::base
Char base
Numeric base type.
Definition:
LSQTraits.h:102
LSQTraits_F
#define LSQTraits_F
Definition:
LSQTraits.h:111
casacore::LSQTraits_F< Float >::num_type
LSQReal num_type
Definition:
LSQTraits.h:118
casacore::LSQTraits::num_type
Char num_type
Numeric type.
Definition:
LSQTraits.h:104
casacore::LSQTraits_CF< std::complex< Float > >::value_type
std::complex< Float > value_type
Definition:
LSQTraits.h:158
casacore::LSQTraits::value_type
T value_type
Defining type.
Definition:
LSQTraits.h:100
casacore::LSQTraits_D< Double >::base
Double base
Definition:
LSQTraits.h:131
casacore::LSQTraits_CD< std::complex< Double > >::base
Double base
Definition:
LSQTraits.h:145
casacore::LSQTraits_CD< std::complex< Double > >::num_type
LSQComplex num_type
Definition:
LSQTraits.h:146
casacore::LSQType::PointerTraits::result
@ result
Definition:
LSQTraits.h:83
casacore::LSQTraits_D< Double >::value_type
Double value_type
Definition:
LSQTraits.h:130
casacore::Float
float Float
Definition:
aipstype.h:54
casacore::LSQTraits
Traits for numeric classes used
Definition:
LSQTraits.h:97
casacore::LSQType
Determine if pointer type
Definition:
LSQTraits.h:80
casacore::Double
double Double
Definition:
aipstype.h:55
LSQTraits_CF
#define LSQTraits_CF
Definition:
LSQTraits.h:153
casacore::False
const Bool False
Definition:
aipstype.h:44
casacore::LSQTraits_F< Float >::base
Float base
Definition:
LSQTraits.h:117
casacore::LSQTraits::size
@ size
Definition:
LSQTraits.h:106
casacore::LSQTraits_F< Float >::value_type
Float value_type
Definition:
LSQTraits.h:116
casacore
this file contains all the compiler specific defines
Definition:
mainpage.dox:28
casacore::True
const Bool True
Definition:
aipstype.h:43
casacore::LSQReal::value_type
LSQReal value_type
Definition:
LSQTraits.h:66
casacore::LSQNull
Non relevant class indicator
Definition:
LSQTraits.h:76
casacore::LSQTraits_CF< std::complex< Float > >::num_type
LSQComplex num_type
Definition:
LSQTraits.h:160
casacore::LSQType::PointerTraits::Pointee
LSQNull Pointee
Definition:
LSQTraits.h:84
std
Define real & complex conjugation for non-complex types and put comparisons into std namespace.
Definition:
Complex.h:352
casacore::LSQType::PointerTraits< U * >::Pointee
U Pointee
Definition:
LSQTraits.h:88
casacore::LSQType::isPointer
@ isPointer
Definition:
LSQTraits.h:91
LSQTraits_CD
#define LSQTraits_CD
Definition:
LSQTraits.h:139
casacore::Char
char Char
Definition:
aipstype.h:46
casacore::LSQTraits_CD< std::complex< Double > >::value_type
std::complex< Double > value_type
Definition:
LSQTraits.h:144
casacore::LSQComplex::value_type
LSQComplex value_type
Definition:
LSQTraits.h:72
casacore::LSQReal
Definition:
LSQTraits.h:65
LSQTraits_D
#define LSQTraits_D
Definition:
LSQTraits.h:125
casacore::LSQTraits_CF< std::complex< Float > >::base
Float base
Definition:
LSQTraits.h:159
Generated by
1.8.20