aimsdata  5.0.5
Neuroimaging data handling
finder.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 /*
35  * Finder class
36  */
37 #ifndef AIMS_IO_FINDER_H
38 #define AIMS_IO_FINDER_H
39 
42 #include <memory>
43 
44 
45 namespace aims
46 {
47  class Finder;
48  struct Finder_Private;
49  class Header;
50  class FinderFormat;
51 
52 
118  {
119  public:
120  enum State
121  {
123  Ok,
125  };
126 
127  Finder();
128  ~Finder();
129 
130  static void registerFormat( const std::string & fmtid,
131  FinderFormat* format,
132  const std::vector<std::string> & extensions,
133  const std::string & before = "" );
135  static FinderFormat* finderFormat( const std::string & format );
136  static void unregisterFormat( const std::string & format );
140  bool check( const std::string & filename );
141  std::string objectType() const { return( _objectType ); }
142  void setObjectType( const std::string & obj ) { _objectType = obj; }
143  std::string dataType() const { return( _dataType ); }
144  void setDataType( const std::string & dat ) { _dataType = dat; }
149  std::vector<std::string> possibleDataTypes() const
150  { return( _dataTypes ); }
151  void setPossibleDataTypes( const std::vector<std::string> & dt )
152  { _dataTypes = dt; }
153  std::string format() const { return( _format ); }
154  void setFormat( const std::string & fmt ) { _format = fmt; }
155  const Header* header() const;
156  void setHeader( Header* hdr );
157  carto::Object headerObject() const { return _header; }
158  void setHeader( carto::Object hdr );
159  State state() const { return _state; }
160  std::string errorMessage() const { return _errormsg; }
162  void launchException();
163 
164  static void postProcessHeader( carto::Object hdr );
166  static std::set<std::string> extensions( const std::string & format );
167 
168  private:
169  static void initPrivate();
170 
171  std::string _objectType;
172  std::string _dataType;
173  std::vector<std::string> _dataTypes;
174  std::string _format;
175  carto::Object _header;
176  State _state;
177  std::string _errormsg;
178  int _errorcode;
179  static std::unique_ptr<Finder_Private> pd;
180  };
181 
182 }
183 
184 
185 #endif
186 
187 
void setObjectType(const std::string &obj)
Definition: finder.h:142
void setDataType(const std::string &dat)
Definition: finder.h:144
std::string format() const
Definition: finder.h:153
#define AIMSDATA_API
std::string dataType() const
Definition: finder.h:143
The class for EcatSino data write operation.
Definition: border.h:44
void setPossibleDataTypes(const std::vector< std::string > &dt)
Definition: finder.h:151
std::string objectType() const
Definition: finder.h:141
carto::Object headerObject() const
Definition: finder.h:157
State state() const
Definition: finder.h:159
Generic finder / checker for all data objects and file formats This will replace the old AimsFinder...
Definition: finder.h:117
std::string errorMessage() const
Definition: finder.h:160
void setFormat(const std::string &fmt)
Definition: finder.h:154
std::vector< std::string > possibleDataTypes() const
Definition: finder.h:149
Finder format checker.
Definition: fileFormat.h:88