1 #ifndef __stir_IO_InputFileFormatRegistry_h__ 2 #define __stir_IO_InputFileFormatRegistry_h__ 41 template <
class DataT>
45 typedef DataT data_type;
49 typedef shared_ptr<Factory> FactorySPtr;
61 static shared_ptr<self_type>& default_sptr();
71 void add_to_registry(FactorySPtr
const& factory,
const unsigned ranking);
74 void remove_from_registry(
const Factory& factory);
84 Factory
const& find_factory(
const FileSignature& signature, std::istream& input)
const;
94 Factory
const& find_factory(
const FileSignature& signature,
const std::string& filename)
const;
97 Factory
const& find_factory(
const std::string& filename)
const;
100 Factory
const& find_factory(std::istream& input)
const;
104 void list_registered_names(std::ostream& stream)
const;
107 typedef typename std::multimap<unsigned, FactorySPtr> _registry_type;
108 typedef typename _registry_type::const_iterator const_iterator;
109 typedef typename _registry_type::iterator iterator;
111 _registry_type _registry;
113 bool _valid(const_iterator iter)
const {
return iter != this->_registry.end(); }
116 template <
class File>
117 inline const_iterator _actual_find_factory(
const FileSignature& signature, File& input)
const 119 const_iterator iter = this->_registry.begin();
120 const_iterator
const end = this->_registry.end();
123 if (iter->second->can_read(signature, input))
139 template <
class Format>
142 typedef typename Format::data_type data_type;
146 shared_ptr<InputFileFormat<data_type>> format_sptr(
new Format);
A class to read/store the file signature.
Definition: FileSignature.h:34
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...