This file is indexed.

/usr/include/casacore/casa/Containers/ValueHolder.h is in casacore-dev 2.2.0-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
//# ValueHolder.h: A holder object for the standard Casacore data types
//# Copyright (C) 2005
//# Associated Universities, Inc. Washington DC, USA.
//#
//# This library is free software; you can redistribute it and/or modify it
//# under the terms of the GNU Library General Public License as published by
//# the Free Software Foundation; either version 2 of the License, or (at your
//# option) any later version.
//#
//# This library is distributed in the hope that it will be useful, but WITHOUT
//# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
//# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
//# License for more details.
//#
//# You should have received a copy of the GNU Library General Public License
//# along with this library; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//#        Internet email: aips2-request@nrao.edu.
//#        Postal address: AIPS++ Project Office
//#                        National Radio Astronomy Observatory
//#                        520 Edgemont Road
//#                        Charlottesville, VA 22903-2475 USA
//#
//#
//# $Id$


#ifndef CASA_VALUEHOLDER_H
#define CASA_VALUEHOLDER_H

//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Containers/ValueHolderRep.h>
#include <casacore/casa/Arrays/Array.h>

namespace casacore { //# NAMESPACE CASACORE - BEGIN


// <summary>
// A holder for a value of any basic Casacore data type.
// </summary>

// <use visibility=export>
// <reviewed reviewer="" date="" tests="tValueHolder">
// </reviewed>

// <synopsis>
// Class ValueHolder is meant to be used for holding a single Casacore value.
// The value can be  scalar or an array of any basic type (including complex
// and string). Also a Record value is possible.
// In this way varying typed data (e.g. the result of getCell in the table DO)
// can be packed in a strongly typed variable.
// <br>All unsigned integer type values are kept as signed 32-bit integers
// because scripting languages usually only support those types.
//
// ValueHolder is an envelope class that holds a counted-referenced letter
// object <linkto class=ValueHolderRep>ValueHolderRep</linkto>.
// </synopsis>

// <motivation>
// This class comes handy in passing arbitrary values from a DO to
// its environment.
// </motivation>

class ValueHolder
{
public:
  // Construct a null object.
  ValueHolder()
    {}

  // Create the object for the given value.
  // <group>
  explicit ValueHolder (Bool value);
  explicit ValueHolder (uChar value);
  explicit ValueHolder (Short value);
  explicit ValueHolder (uShort value);
  explicit ValueHolder (Int value);
  explicit ValueHolder (uInt value);
  explicit ValueHolder (Int64 value);
  explicit ValueHolder (Float value);
  explicit ValueHolder (Double value);
  explicit ValueHolder (const Complex& value);
  explicit ValueHolder (const DComplex& value);
  explicit ValueHolder (const Char* value);
  explicit ValueHolder (const String& value);
  explicit ValueHolder (const Array<Bool>& value);
  explicit ValueHolder (const Array<uChar>& value);
  explicit ValueHolder (const Array<Short>& value);
  explicit ValueHolder (const Array<uShort>& value);
  explicit ValueHolder (const Array<Int>& value);
  explicit ValueHolder (const Array<uInt>& value);
  explicit ValueHolder (const Array<Int64>& value);
  explicit ValueHolder (const Array<Float>& value);
  explicit ValueHolder (const Array<Double>& value);
  explicit ValueHolder (const Array<Complex>& value);
  explicit ValueHolder (const Array<DComplex>& value);
  explicit ValueHolder (const Array<String>& value);
  explicit ValueHolder (const Record& value);
  // </group>

  // Create an empty N-dim array (gets type TpOther).
  ValueHolder (uInt ndim, Bool dummy);

  // Create a ValueHolder from a ValueHolderRep.
  // It takes over the pointer and deletes it in the destructor.
  explicit ValueHolder (ValueHolderRep* rep)
    : itsRep (rep)
    {}

  // Copy constructor (reference semantics).
  ValueHolder (const ValueHolder&);

  // Destructor.
  ~ValueHolder()
  {}

  // Assignment (reference semantics).
  ValueHolder& operator= (const ValueHolder&);

  // Is this a null object?
  Bool isNull() const
    { return itsRep.null(); }

  // Get the data type (as defined in DataType.h).
  DataType dataType() const;
    
  // Get the value.
  // If possible, it converts the data as needed.
  // <group>
  Bool                  asBool    () const;
  uChar                 asuChar   () const;
  Short                 asShort   () const;
  uShort                asuShort  () const;
  Int                   asInt     () const;
  uInt                  asuInt    () const;
  Int64                 asInt64   () const;
  Float                 asFloat   () const;
  Double                asDouble  () const;
  Complex               asComplex () const;
  DComplex              asDComplex() const;
  const String&         asString  () const;
  const Array<Bool>     asArrayBool    () const;
  const Array<uChar>    asArrayuChar   () const;
  const Array<Short>    asArrayShort   () const;
  const Array<uShort>   asArrayuShort  () const;
  const Array<Int>      asArrayInt     () const;
  const Array<uInt>     asArrayuInt    () const;
  const Array<Int64>    asArrayInt64   () const;
  const Array<Float>    asArrayFloat   () const;
  const Array<Double>   asArrayDouble  () const;
  const Array<Complex>  asArrayComplex () const; 
  const Array<DComplex> asArrayDComplex() const;
  const Array<String>   asArrayString  () const;
  const Record&         asRecord       () const;
  // </group>

  // Get the data in a way useful for templates.
  // If possible, it converts the the data as needed.
  // <group>
  void getValue (Bool& value) const            { value = asBool(); }
  void getValue (uChar& value) const           { value = asuChar(); }
  void getValue (Short& value) const           { value = asShort(); }
  void getValue (uShort& value) const          { value = asuShort(); }
  void getValue (Int& value) const             { value = asInt(); }
  void getValue (uInt& value) const            { value = asuInt(); }
  void getValue (Int64& value) const           { value = asInt64(); }
  void getValue (Float& value) const           { value = asFloat(); }
  void getValue (Double& value) const          { value = asDouble(); }
  void getValue (Complex& value) const         { value = asComplex(); }
  void getValue (DComplex& value) const        { value = asDComplex(); }
  void getValue (String& value) const          { value = asString(); }
  void getValue (Array<Bool>& value) const
    { value.reference(asArrayBool()); }
  void getValue (Array<uChar>& value) const
    { value.reference(asArrayuChar()); }
  void getValue (Array<Short>& value) const
    { value.reference(asArrayShort()); }
  void getValue (Array<uShort>& value) const
    { value.reference(asArrayuShort()); }
  void getValue (Array<Int>& value) const
    { value.reference(asArrayInt()); }
  void getValue (Array<uInt>& value) const
    { value.reference(asArrayuInt()); }
  void getValue (Array<Int64>& value) const
    { value.reference(asArrayInt64()); }
  void getValue (Array<Float>& value) const
    { value.reference(asArrayFloat()); }
  void getValue (Array<Double>& value) const
    { value.reference(asArrayDouble()); }
  void getValue (Array<Complex>& value) const
    { value.reference(asArrayComplex()); }
  void getValue (Array<DComplex>& value) const
    { value.reference(asArrayDComplex()); }
  void getValue (Array<String>& value) const
    { value.reference(asArrayString()); }
  // </group>

  // Put the value as a field in a record.
  void toRecord (Record&, const RecordFieldId&) const;

  // Construct the object from the value in a record.
  static ValueHolder fromRecord (const Record&, const RecordFieldId&);

  // Compare two ValueHolder objects.
  // They must have the same data type.
  bool operator< (const ValueHolder& right) const
    { return itsRep->operator< (*right.itsRep); }

  // Write the ValueHolder to an output stream.
  // Arrays are written as normal arrays using ArrayIO.h. 
  friend std::ostream& operator<< (std::ostream& os, const ValueHolder& vh)
    { return vh.itsRep->write (os); }

private:

  CountedPtr<ValueHolderRep> itsRep;
};


inline DataType ValueHolder::dataType() const
  { return itsRep->dataType(); }
inline void ValueHolder::toRecord (Record& rec, const RecordFieldId& id) const
  { return itsRep->toRecord (rec, id); }
inline ValueHolder ValueHolder::fromRecord (const Record& rec,
					    const RecordFieldId& id)
  { return ValueHolder (ValueHolderRep::fromRecord (rec, id)); }
inline Bool ValueHolder::asBool() const
  { return itsRep->asBool(); }
inline uChar ValueHolder::asuChar() const
  { return itsRep->asuChar(); }
inline Short ValueHolder::asShort() const
  { return itsRep->asShort(); }
inline uShort ValueHolder::asuShort() const
  { return itsRep->asuShort(); }
inline Int ValueHolder::asInt() const
  { return itsRep->asInt(); }
inline uInt ValueHolder::asuInt() const
  { return itsRep->asuInt(); }
inline Int64 ValueHolder::asInt64() const
  { return itsRep->asInt64(); }
inline Float ValueHolder::asFloat() const
  { return itsRep->asFloat(); }
inline Double ValueHolder::asDouble() const
  { return itsRep->asDouble(); }
inline Complex ValueHolder::asComplex() const
  { return itsRep->asComplex(); }
inline DComplex ValueHolder::asDComplex() const
  { return itsRep->asDComplex(); }
inline const String& ValueHolder::asString() const
  { return itsRep->asString(); }
inline const Array<Bool> ValueHolder::asArrayBool() const
  { return itsRep->asArrayBool(); }
inline const Array<uChar> ValueHolder::asArrayuChar() const
  { return itsRep->asArrayuChar(); }
inline const Array<Short> ValueHolder::asArrayShort() const
  { return itsRep->asArrayShort(); }
inline const Array<uShort> ValueHolder::asArrayuShort() const
  { return itsRep->asArrayuShort(); }
inline const Array<Int> ValueHolder::asArrayInt() const
  { return itsRep->asArrayInt(); }
inline const Array<uInt> ValueHolder::asArrayuInt() const
  { return itsRep->asArrayuInt(); }
inline const Array<Int64> ValueHolder::asArrayInt64() const
  { return itsRep->asArrayInt64(); }
inline const Array<Float> ValueHolder::asArrayFloat() const
  { return itsRep->asArrayFloat(); }
inline const Array<Double> ValueHolder::asArrayDouble() const
  { return itsRep->asArrayDouble(); }
inline const Array<Complex> ValueHolder::asArrayComplex() const
  { return itsRep->asArrayComplex(); }
inline const Array<DComplex> ValueHolder::asArrayDComplex() const
  { return itsRep->asArrayDComplex(); }
inline const Array<String> ValueHolder::asArrayString() const
  { return itsRep->asArrayString(); }
inline const Record& ValueHolder::asRecord() const
  { return itsRep->asRecord(); }


} //# NAMESPACE CASACORE - END

#endif