38 #ifndef OME_FILES_METADATAMAP_H
39 #define OME_FILES_METADATAMAP_H
99 typedef boost::mpl::vector<std::string,
103 typedef boost::mpl::vector<uint8_t,
113 typedef boost::mpl::vector<float,
134 typedef boost::mpl::transform_view<basic_types_view, make_vector<boost::mpl::_1>>::type
list_types_view;
137 typedef boost::mpl::joint_view<basic_types_view, list_types_view>
all_types_view;
147 typedef boost::make_variant_over<discriminated_types>::type
value_type;
196 map_type::value_type newvalue(key, value);
209 template <
typename T>
228 template <
typename T>
233 typedef typename std::vector<T> list_type;
237 list_type& list(get<list_type>(key));
238 list.push_back(value);
240 catch (
const boost::bad_get&)
243 new_list.push_back(value);
280 template <
typename T>
290 catch (
const boost::bad_get&)
307 template <
typename T>
311 return boost::get<T>(get<value_type>(key));
325 template <
typename T>
329 return boost::get<T>(get<value_type>(key));
369 std::pair<iterator, bool>
407 template <
typename T>
424 std::vector<key_type>
427 std::vector<key_type> ret;
428 std::transform(
begin(),
end(), std::back_inserter(ret),
getkey());
429 std::sort(ret.begin(), ret.end());
443 const std::string& prefix)
445 for (
const auto& m : map)
447 map_type::value_type v(prefix + m.first, m.second);
728 template <
typename T>
732 for (
typename std::vector<T>::const_iterator i = c.begin();
737 if (i + 1 != c.end())
747 template <
typename T>
787 template <
typename T>
791 typename std::vector<T>::size_type idx = 1;
793 int sf =
static_cast<int>(std::log10(static_cast<float>(c.size()))) + 1;
794 for (
typename std::vector<T>::const_iterator i = c.begin();
798 os <<
key <<
" #" << std::setw(sf) << std::setfill(
'0') << std::right << idx <<
" = " << *i <<
'\n';
810 template <
typename T>
814 os <<
key <<
" = " << v <<
'\n';
850 template <
typename T>
854 typename std::vector<T>::size_type idx = 1;
856 int sf =
static_cast<int>(std::log10(static_cast<float>(c.size()))) + 1;
857 for (
typename std::vector<T>::const_iterator i = c.begin();
861 std::ostringstream os;
862 os <<
key <<
" #" << std::setw(sf) << std::setfill(
'0') << std::right << idx;
875 template <
typename T>
898 MetadataMap::get<MetadataMap::value_type>(
const key_type& key)
900 map_type::iterator i = discriminating_map.find(key);
901 if (i == discriminating_map.end())
902 throw boost::bad_get();
920 MetadataMap::get<MetadataMap::value_type>(
const key_type& key)
const
922 map_type::const_iterator i = discriminating_map.find(key);
923 if (i == discriminating_map.end())
924 throw boost::bad_get();
954 template<
class charT,
class traits>
955 inline basic_ostream<charT,traits>&
956 operator<< (basic_ostream<charT,traits>& os,
957 const ::ome::files::MetadataMap::value_type& vt)
970 template<
class charT,
class traits>
971 inline basic_ostream<charT,traits>&
972 operator<< (basic_ostream<charT,traits>& os,
973 const ::ome::files::MetadataMap& map)
975 for (
const auto& m : map)
984 #endif // OME_FILES_METADATAMAP_H
Visitor template for output of MetadataMap values to an ostream.
Definition: MetadataMap.h:758
MetadataMapOStreamVisitor(std::ostream &os, const MetadataMap::key_type &key)
Constructor.
Definition: MetadataMap.h:771
const MetadataMap::key_type & key
The key of the value being output.
Definition: MetadataMap.h:763
std::ostream & os
The stream to output to.
Definition: MetadataMap.h:761
void operator()(const std::vector< T > &c) const
Output a vector value of arbitrary type.
Definition: MetadataMap.h:789