This file is indexed.

/usr/include/casacore/images/Regions/RFReaderWriter.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
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
//# RegionFileReaderWriter.h: Interfaces for classes that read/write image regions.
//# Copyright (C) 2009
//# 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 IMAGES_RFREADERWRITER_H
#define IMAGES_RFREADERWRITER_H

//# Includes
#include <casacore/casa/aips.h>
#include <casacore/casa/Logging/LogIO.h>
#include <casacore/casa/Containers/Record.h>
#include <casacore/coordinates/Coordinates/CoordinateSystem.h>

namespace casacore {//# NAMESPACE CASACORE - BEGIN 

//# Forward declarations
class RFReader;
class RFWriter;
 
// <summary>
// Convenience class for a String/bool pair.
// </summary>
//
// <use visibility=export>
//
// <reviewed reviewer="" date="" tests="">
// </reviewed>
//
// <prerequisite>
// </prerequisite>
//
// <synopsis>
// </synopsis>
//
// <example>
// <srcblock>
// </srcblock>
// </example>
//
//# <todo asof="2009/03/10">
//# <li>
//# </todo> 

class RFError
{
public:
    // Constructor, blank error.
    RFError();

    // Constructor, error with the given text and isFatal flag.
    RFError(const String& error, bool isFatal = false);

    // Destructor.
    ~RFError();

    // Returns whether this error was fatal or not.
    bool isFatal() const;

    // Returns this error's text.
    const String& error() const;

    // Sets the error.
    void set(const String& error, bool isFatal = false);
    
private:
    String   error_p;
    bool     fatal_p;
};


// <summary>
// Superclass for readers and writers containing common definitions and
// operations.
// </summary>
//
// <use visibility=export>
//
// <reviewed reviewer="" date="" tests="">
// </reviewed>
//
// <prerequisite>
// </prerequisite>
//
// <synopsis>
// </synopsis>
//
// <example>
// <srcblock>
// </srcblock>
// </example>
//
//# <todo asof="2009/03/10">
//# <li>
//# </todo> 

class RFReaderWriter
{
public:
    // An enum of all known subclasses/formats supported.
    enum SupportedType {
        AIPS_BOX, DS9, CASA_XML, AIPS_IO
    };
    
    // Converts between enum and String for SupportedType.
    // <group>
    static SupportedType supportedTypes(String type);
    static String supportedTypes(SupportedType type);
    // </group>

    // Returns the file extension for the given SupportedType.
    static String extensionForType(SupportedType type);

    // Returns all known SupportedTypes.
    // <group>
    static Vector<SupportedType> supportedTypes();
    static Vector<String> supportedTypeStrings();
    // </group>

    // Returns an appropriate child RFReader class for the given
    // SupportedType, or NULL for an error (shouldn't happen).
    static RFReader* readerForType(SupportedType type);
    
    // Returns an new appropriate child RfWriter class for the given
    // SupportedType, or NULL for an error (shouldn't happen).
    static RFWriter* writerForType(SupportedType type);
    
    // Returns an new appropriate options widget for the given SupportedType,
    // or NULL for an error (shouldn't happen).
    static Record* optionsWidgetForType(SupportedType type);
    
    
    // Constructor.
    RFReaderWriter() { }
    
    // Destructor.
    virtual ~RFReaderWriter() { }
    
    // Sets the file to be read/written to the given.
    virtual void setFile(const String& filename);

    // Sets the region name associated withe the file to be read or written.
    virtual void setName(const String& regionName);
    
    // Returns the last error set during read/write.
    virtual const RFError& lastError() const;
    
protected:
    // Filename to be read/written.
    String *pFilename_p;

    // Name to be assigned to the region
    String *pRegionName_p;
    
    // Last error seen during read/write.
    RFError lastError_p;

    // Record containg plotting options for the regions
    Record   options_p;

    // Convenience method for setting last error during read/write.
    virtual void setError(const String& error, bool fatal = false) const;
};


// <summary>
// Abstract superclass for any class that reads a format that produces
// Regions from a file.
// </summary>
//
// <use visibility=export>
//
// <reviewed reviewer="" date="" tests="">
// </reviewed>
//
// <prerequisite>
// </prerequisite>
//
// <synopsis>
// Provide a well defined set of operations for reading
// region files, regardless of the data format.
//
// Note that some file formats allow for plotting options
// to be defined as well as the regions. These options are
// read and stored in a record of ... , the contents
// of this record is ill-defined (ie. there is no standard).
// 
// There may come a time where a standard is necessary.
// </synopsis>
//
// <example>
// <srcblock>
// </srcblock>
// </example>
//
//# <todo asof="2009/03/10">
//# <li>
//# </todo> 

class RFReader : public virtual RFReaderWriter
{
public:
    // Constructor.
    RFReader() { }

    // Destructor.
    virtual ~RFReader() { }

    // Provides access to the plotting options that
    // were found in the region file.
    virtual Record* options() {
	return &options_p;
    };
    
    // reported, false otherwise.  If false is returned, the details can be
    // found using lastError().  Any valid Regions that were read from the
    // file are placed in the given vector (which is cleared first).
    virtual bool read(Record& region) = 0;
    

    // Calls setFile() then read().
    virtual bool readFile(const String& file, Record& region) {
        setFile(file);
        return read(region);
    }
};


// <summary>
// Abstract superclass for any class that writes Regions to a region
// file format.
// </summary>
//
// <use visibility=export>
//
// <reviewed reviewer="" date="" tests="">
// </reviewed>
//
// <prerequisite>
// </prerequisite>
//
// <synopsis>
// Provide a well defined set of operations that all
// region file writers must contain regardless of the
// file format of the file being saved. .
//
// Note that some file formats allow for plotting options
// to be stored with the region information. The setOptions
// method allows the user to supply this information. 
// </synopsis>
//
// <example>
// <srcblock>
// </srcblock>
// </example>
//
//# <todo asof="2009/03/10">
//# <li>
//# </todo> 

class RFWriter : public virtual RFReaderWriter
{
public:
    // Constructor.
    RFWriter() { }
    
    // Destructor.
    virtual ~RFWriter() { }    
    
    // Sets the optional to the values. These values are related to
    // the drawing of regions and not defining the regions themselves.
    // For example, the colour to draw the region as.
    virtual void setOptions(const Record* options) {
	options_p.defineRecord( "regionoptions", *options );
    };
    

    // Write the given regions to the filename set with setFile and returns
    // true if no errors were reported, false otherwise.  If false is returned,
    // the details can be found using lastError().
    virtual bool write(const Record& region) const = 0;    
    
    // Calls setFile then write.
    virtual bool writeFile(const String& filename,
                           const Record& regions) {
        setFile(filename);
        return write(regions);
    }
};

} //# end namespace

#endif