34 #ifndef AIMS_IO_FILEFORMAT_D_H
35 #define AIMS_IO_FILEFORMAT_D_H
51 template<
typename T> T*
53 const carto::AllocatorContext & context,
59 if( read( filename, *
object, context, options ) )
62 catch( std::exception & )
79 template<
class T> std::map<std::string, FileFormat<T>*>
82 static std::map<std::string, FileFormat<T>*> form;
86 template<
class T> std::map<std::string, std::list<std::string> >
89 static std::map<std::string, std::list<std::string> > ext;
104 const std::map<std::string, std::list<std::string> > &
108 return _extensions();
114 static bool initialized =
false;
121 registerBaseFormats();
125 template<
class T> std::string
131 template<
class T>
void
134 const std::vector<std::string>
136 const std::string & before )
142 _formats()[ format ] = formatObj;
144 std::vector<std::string>::const_iterator ie, ee = extensions.end();
145 std::list<std::string>::iterator ie2, ee2;
146 for( ie=extensions.begin(); ie!=ee; ++ie )
148 std::list<std::string> & ext = _extensions()[ *ie ];
150 ext.push_back( format );
153 for( ie2=ext.begin(), ee2=ext.end(); ie2!=ee2; ++ie2 )
156 ext.insert( ie2, format );
162 template<
class T>
void
165 typename std::map<std::string, FileFormat<T>*>::iterator
166 ir = _formats().find( format);
168 if( ir != _formats().end() )
169 _formats().erase( ir );
171 std::map<std::string, std::list<std::string> >::iterator
172 ie = _extensions().begin(), je, ee = _extensions().end();
173 std::list<std::string>::iterator il, jl, el;
179 il = je->second.begin();
180 el = je->second.end();
186 if( (il != el) && (*il == format ) )
188 je->second.erase( il );
189 el = je->second.end();
190 if( je->second.empty() )
191 _extensions().erase( je );
203 typename std::map<std::string, FileFormat<T>*>::const_iterator i
204 = _formats().find( format );
205 if( i == _formats().end() )
207 return( (*i).second );
213 std::set<std::string> f;
214 typename std::map<std::string, FileFormat<T>*>::const_iterator
215 i, e = _formats().end();
216 for( i=_formats().begin(); i!=e; ++i )
217 f.insert( i->first );
static void registerType(const std::string &objtype, const std::string &datatype, FormatInfo info)
static std::string extension(const std::string &)
The class for EcatSino data write operation.