A.I.M.S


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 );
139  bool check( const std::string & filename );
140  std::string objectType() const { return( _objectType ); }
141  void setObjectType( const std::string & obj ) { _objectType = obj; }
142  std::string dataType() const { return( _dataType ); }
143  void setDataType( const std::string & dat ) { _dataType = dat; }
148  std::vector<std::string> possibleDataTypes() const
149  { return( _dataTypes ); }
150  void setPossibleDataTypes( const std::vector<std::string> & dt )
151  { _dataTypes = dt; }
152  std::string format() const { return( _format ); }
153  void setFormat( const std::string & fmt ) { _format = fmt; }
154  const Header* header() const;
155  void setHeader( Header* hdr );
156  carto::Object headerObject() const { return _header; }
157  void setHeader( carto::Object hdr );
158  State state() const { return _state; }
159  std::string errorMessage() const { return _errormsg; }
161  void launchException();
162 
163  static void postProcessHeader( carto::Object hdr );
165  static std::set<std::string> extensions( const std::string & format );
166 
167  private:
168  static void initPrivate();
169 
170  std::string _objectType;
171  std::string _dataType;
172  std::vector<std::string> _dataTypes;
173  std::string _format;
174  carto::Object _header;
175  State _state;
176  std::string _errormsg;
177  int _errorcode;
178  static std::auto_ptr<Finder_Private> pd;
179  };
180 
181 }
182 
183 
184 #endif
185 
186 
void setObjectType(const std::string &obj)
Definition: finder.h:141
void setDataType(const std::string &dat)
Definition: finder.h:143
std::vector< std::string > possibleDataTypes() const
Definition: finder.h:148
#define AIMSDATA_API
std::string dataType() const
Definition: finder.h:142
void setPossibleDataTypes(const std::vector< std::string > &dt)
Definition: finder.h:150
State state() const
Definition: finder.h:158
Generic finder / checker for all data objects and file formats This will replace the old AimsFinder...
Definition: finder.h:117
void setFormat(const std::string &fmt)
Definition: finder.h:153
std::string errorMessage() const
Definition: finder.h:159
std::string format() const
Definition: finder.h:152
carto::Object headerObject() const
Definition: finder.h:156
Finder format checker.
Definition: fileFormat.h:88
std::string objectType() const
Definition: finder.h:140