This file is indexed.

/usr/include/odindata/fileio.h is in libodin-dev 1.8.8-2ubuntu1.

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
/***************************************************************************
                          fileio.h  -  description
                             -------------------
    begin                : Fri Apr 6 2001
    copyright            : (C) 2000-2014 by Thies Jochimsen
    email                : thies@jochimsen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef FILEIO_H
#define FILEIO_H

//shortcut to check for type from string (templated function doesn work well with mingw - so we use macro)
#define IS_TYPE(type, name) (name==TypeTraits::type2label((type)0))

#include <odindata/data.h>
#include <odindata/fileio_opts.h>


#define AUTODETECTSTR "autodetect"
#define AUTOTDATAYPESTR "automatic"


/**
  * @addtogroup odindata
  * @{
  */


/**
  * The 4 dimensions of data arrays used in FileIO and Filter components, these dimensions are
  * - timeDim: Time direction
  * - sliceDim: Slice direction
  * - phaseDim: Phase direction
  * - readDim: Read direction
  */
enum                      dataDim { timeDim=0, sliceDim, phaseDim, readDim, n_dataDim };
static const char* dataDimLabel[]={"time",    "slice",  "phase",  "read"};


/**
  * Structure to accomodate autoread/autwrite functionality. Please refer to (\ref fileio_doc ) for a detailed description of this module.
  */
class FileIO {

 public:

  /**
    * Type to associate protocols with tempo-spatial raw data via std::map
    */
  typedef STD_map<Protocol, Data<float,4> > ProtocolDataMap;

  /**
    * Reads in file 'filename' and appends all data sets found to protocol-data map 'pdmap', autodetects file format according to file extension.
    * Read options are given by 'opts' and 'protocol_template' contains defaults used by the decoder/encoder of the particular file format.
    * The progress meter 'progmeter' can be optionally specified to monitor the progress of the operation.
    * Returns number of slices, or -1 if it fails.
    */
  static int autoread(ProtocolDataMap& pdmap, const STD_string& filename, const FileReadOpts& opts, const Protocol& protocol_template,ProgressMeter* progmeter=0);

  /**
    * Writes out protocol-data map 'pdmap' to file(s) filename, autodetects file format according to file extension.
    * Write options are given by 'opts'.
    * Returns number of slices sucessfully written, or -1 if it fails.
    */
  static int autowrite(const ProtocolDataMap& pdmap, const STD_string& filename, const FileWriteOpts& opts);

  /**
    * Returns possible file formats/extensions to autoread autowrite
    */
  static svector autoformats();

  /**
    * Returns possible file formats as string with comment
    */
  static STD_string autoformats_str(const STD_string& indent="");


  /**
    * Returns whether tracing via stdout is enabled/disabled
    */
  static bool get_trace_status() {return do_trace;}

  /**
    * Enables/disables tracing via stdout
    */
  static void set_trace_status(bool stat) {do_trace=stat;}


  static const char* get_compName(); // For debugging FilieIO component

 private:
  static logPriority loglevel() {if(do_trace) return infoLog; else return normalDebug;}
  static bool do_trace;

  static int read_dir(ProtocolDataMap& pdmap, const STD_string& dirname, const FileReadOpts& opts, const Protocol& protocol_template,ProgressMeter* progmeter=0);

};

//////////////////////////////////////////////////////////////////////////


/**
  * Base class for file formats
  */
class FileFormat {

 public:

/**
  * Use this function on a static instance to register the corresponding file format
  */
  void register_format();

/**
  *  creates unique filenames based on 'filename' for the protocol-data pairs in 'pdmap' using comma-separated list of additional parameters in 'par'
  */
  static svector create_unique_filenames(const STD_string& filename, const FileIO::ProtocolDataMap& pdmap, const STD_string& par);

/**
  *  returns the voxel extent of the 'geometry' in the given 'direction' using a matrix size 'size'.
  */
  static float voxel_extent(const Geometry& geometry, direction direction, int size);



protected:
  virtual ~FileFormat() {} // avoid compiler warnings

/**
  *  Select the appropriate data type when writing binary data
  */
  static STD_string select_write_datatype(const Protocol &prot,const FileWriteOpts& opts);

 private:

  // limit access
  friend class FileIO;

  virtual STD_string description() const = 0;

  virtual svector suffix() const = 0;

  virtual svector dialects() const = 0;

  virtual int read(Data<float,4>& data, const STD_string& filename, const FileReadOpts& opts, Protocol& prot);
  virtual int read(FileIO::ProtocolDataMap& pdmap, const STD_string& filename, const FileReadOpts& opts, const Protocol& protocol_template);

  virtual int write(const Data<float,4>& data, const STD_string& filename, const FileWriteOpts& opts, const Protocol& prot);
  virtual int write(const FileIO::ProtocolDataMap& pdmap, const STD_string& filename, const FileWriteOpts& opts);

  typedef STD_list<FileFormat*> FormatList;
  typedef STD_map<STD_string, FormatList> FormatMap;
  static FormatMap formats;

  static STD_string analyze_suffix(const STD_string& filename);

  static FileFormat* get_format(const STD_string& filename, const STD_string& override_suffix);

  static svector possible_formats();

  static STD_string formats_str(const STD_string& indent);

  static void format_error(const STD_string& filename);

};



/** @}
  */




#endif