libopenraw
rawfilefactory.h
1 /*
2  * libopenraw - rawfilefactory.h
3  *
4  * Copyright (C) 2006, 2008 Hubert Figuiere
5  *
6  * This library is free software: you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public License
8  * as published by the Free Software Foundation, either version 3 of
9  * the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef __RAWFILEFACTORY_H
24 #define __RAWFILEFACTORY_H
25 
26 
27 #include <string>
28 #include <map>
29 #include <boost/function.hpp>
30 
31 #include <libopenraw++/rawfile.h>
32 
33 namespace OpenRaw {
34 namespace Internals {
35 
37 {
38 public:
39  typedef boost::function<RawFile *(IO::Stream *)> raw_file_factory_t;
43  typedef
44  std::map<RawFile::Type, raw_file_factory_t> Table;
45  typedef
46  std::map<std::string, RawFile::Type> Extensions;
47 
55  RawFileFactory(RawFile::Type type,
56  const raw_file_factory_t & fn,
57  const char * ext);
58 
60  static Table & table();
62  static Extensions & extensions();
63 
65  static const char **fileExtensions();
66 
67  static void registerType(RawFile::Type type,
68  const raw_file_factory_t & fn,
69  const char * ext);
70  static void unRegisterType(RawFile::Type type);
71 };
72 
73 
74 
79 {
81  static Table rawFactoryTable;
82  return rawFactoryTable;
83 }
84 
85 inline RawFileFactory::Extensions & RawFileFactory::extensions()
86 {
88  static Extensions rawExtensionsTable;
89  return rawExtensionsTable;
90 }
91 
92 
93 }
94 }
95 
96 #endif
97 /*
98  Local Variables:
99  mode:c++
100  c-file-style:"stroustrup"
101  c-file-offsets:((innamespace . 0))
102  indent-tabs-mode:nil
103  fill-column:80
104  End:
105 */