Source
xxxxxxxxxx
27
27
//----------------------------------------------------------------------------
28
28
29
29
#include <synthesis/CalTables/CTEnums.h>
30
30
31
31
using namespace casacore;
32
32
namespace casa { //# NAMESPACE CASA - BEGIN
33
33
34
34
//----------------------------------------------------------------------------
35
35
36
36
// Static data initialization
37
-
SimpleOrderedMap <Int, String> CTEnums::theirFieldMap ("");
38
-
SimpleOrderedMap <Int, DataType> CTEnums::theirTypeMap (TpOther);
37
+
std::map <Int, String> CTEnums::theirFieldMap;
38
+
std::map <Int, DataType> CTEnums::theirTypeMap;
39
39
40
40
//----------------------------------------------------------------------------
41
41
42
42
void CTEnums::initMaps ()
43
43
{
44
44
// Initialize the static map containing the field names.
45
45
// Skip this step if already initialized.
46
46
//
47
-
if (!theirFieldMap.ndefined()) {
48
-
theirFieldMap.define (ANTENNA1, "ANTENNA1");
49
-
theirFieldMap.define (ANTENNA2, "ANTENNA2");
50
-
theirFieldMap.define (SCAN_NUMBER, "SCAN_NUMBER");
51
-
theirFieldMap.define (TIME, "TIME");
52
-
theirFieldMap.define (TIME_EXTRA_PREC, "TIME_EXTRA_PREC");
53
-
theirFieldMap.define (INTERVAL, "INTERVAL");
54
-
theirFieldMap.define (ARRAY_ID, "ARRAY_ID");
55
-
theirFieldMap.define (FIELD_ID, "FIELD_ID");
56
-
theirFieldMap.define (OBSERVATION_ID, "OBSERVATION_ID");
57
-
theirFieldMap.define (SPECTRAL_WINDOW_ID, "SPECTRAL_WINDOW_ID");
58
-
59
-
theirFieldMap.define (CPARAM, "CPARAM");
60
-
theirFieldMap.define (FPARAM, "FPARAM");
61
-
theirFieldMap.define (PARAMERR, "PARAMERR");
62
-
theirFieldMap.define (FLAG, "FLAG");
63
-
theirFieldMap.define (SNR, "SNR");
64
-
theirFieldMap.define (WEIGHT, "WEIGHT");
65
-
47
+
if ( theirFieldMap.size( ) == 0 ) {
48
+
theirFieldMap = {
49
+
{ANTENNA1, "ANTENNA1"},
50
+
{ANTENNA2, "ANTENNA2"},
51
+
{SCAN_NUMBER, "SCAN_NUMBER"},
52
+
{TIME, "TIME"},
53
+
{TIME_EXTRA_PREC, "TIME_EXTRA_PREC"},
54
+
{INTERVAL, "INTERVAL"},
55
+
{ARRAY_ID, "ARRAY_ID"},
56
+
{FIELD_ID, "FIELD_ID"},
57
+
{OBSERVATION_ID, "OBSERVATION_ID"},
58
+
{SPECTRAL_WINDOW_ID, "SPECTRAL_WINDOW_ID"},
59
+
60
+
{CPARAM, "CPARAM"},
61
+
{FPARAM, "FPARAM"},
62
+
{PARAMERR, "PARAMERR"},
63
+
{FLAG, "FLAG"},
64
+
{SNR, "SNR"},
65
+
{WEIGHT, "WEIGHT"}
66
+
};
67
+
66
68
};
67
69
68
70
// Initialize the static map containing the basic field data types
69
71
// Skip this step if already initialized.
70
72
//
71
-
if (!theirTypeMap.ndefined()) {
72
-
theirTypeMap.define (ANTENNA1, TpInt);
73
-
theirTypeMap.define (ANTENNA2, TpInt);
74
-
theirTypeMap.define (SCAN_NUMBER, TpInt);
75
-
theirTypeMap.define (TIME, TpDouble);
76
-
theirTypeMap.define (TIME_EXTRA_PREC, TpDouble);
77
-
theirTypeMap.define (INTERVAL, TpDouble);
78
-
theirTypeMap.define (ARRAY_ID, TpInt);
79
-
theirTypeMap.define (FIELD_ID, TpInt);
80
-
theirTypeMap.define (OBSERVATION_ID, TpInt);
81
-
theirTypeMap.define (SPECTRAL_WINDOW_ID, TpInt);
82
-
83
-
theirTypeMap.define (CPARAM, TpComplex);
84
-
theirTypeMap.define (FPARAM, TpFloat);
85
-
theirTypeMap.define (PARAMERR, TpFloat);
86
-
theirTypeMap.define (FLAG, TpBool);
87
-
theirTypeMap.define (SNR, TpFloat);
88
-
theirTypeMap.define (WEIGHT, TpFloat);
89
-
90
-
};
73
+
if ( theirTypeMap.size( ) == 0 ) {
74
+
theirTypeMap = {
75
+
{ANTENNA1, TpInt},
76
+
{ANTENNA2, TpInt},
77
+
{SCAN_NUMBER, TpInt},
78
+
{TIME, TpDouble},
79
+
{TIME_EXTRA_PREC, TpDouble},
80
+
{INTERVAL, TpDouble},
81
+
{ARRAY_ID, TpInt},
82
+
{FIELD_ID, TpInt},
83
+
{OBSERVATION_ID, TpInt},
84
+
{SPECTRAL_WINDOW_ID, TpInt},
85
+
86
+
{CPARAM, TpComplex},
87
+
{FPARAM, TpFloat},
88
+
{PARAMERR, TpFloat},
89
+
{FLAG, TpBool},
90
+
{SNR, TpFloat},
91
+
{WEIGHT, TpFloat}
92
+
};
93
+
94
+
}
91
95
92
96
};
93
97
94
98
//----------------------------------------------------------------------------
95
99
96
100
String CTEnums::fieldName (Int enumField)
97
101
{
98
102
// Static function to look up the field name:
99
103
// Inputs:
100
104
// enumField Int Field enumeration.
101
105
// Outputs:
102
106
// fieldName String Field name.
103
107
// Exceptions:
104
108
// Exception if invalid field enumeration.
105
109
//
106
110
// Initialize map if empty
107
-
if (!theirFieldMap.ndefined()) initMaps();
111
+
if ( theirFieldMap.size( ) == 0 ) initMaps();
108
112
109
113
// Return the column name
110
-
return theirFieldMap (enumField);
114
+
return theirFieldMap[enumField];
111
115
};
112
116
113
117
//----------------------------------------------------------------------------
114
118
115
119
Block<String> CTEnums::fieldNames (const Vector<Int>& enumFields)
116
120
{
117
121
// Static function to look up a set of field names:
118
122
// Inputs:
119
123
// enumFields const Vector<Int>& Field enumerations.
120
124
// Outputs:
137
141
{
138
142
// Static function to look up the basic field data type:
139
143
// Inputs:
140
144
// enumField Int Field enumeration.
141
145
// Outputs:
142
146
// basicType DataType Basic data type
143
147
// Exceptions:
144
148
// Exception if invalid field enumeration.
145
149
//
146
150
// Initialize map if empty
147
-
if (!theirTypeMap.ndefined()) initMaps();
151
+
if ( theirTypeMap.size( ) == 0 ) initMaps();
148
152
149
153
// Return the column name
150
-
return theirTypeMap (enumField);
154
+
return theirTypeMap[enumField];
151
155
};
152
156
153
157
//----------------------------------------------------------------------------
154
158
155
159
156
160
157
161
158
162
159
163
160
164