38 #ifndef OME_BIOFORMATS_METADATAMAP_H
39 #define OME_BIOFORMATS_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;
150 typedef boost::make_variant_over<discriminated_types>::type
value_type;
199 map_type::value_type newvalue(key, value);
212 template <
typename T>
231 template <
typename T>
236 typedef typename std::vector<T> list_type;
240 list_type& list(get<list_type>(key));
241 list.push_back(value);
243 catch (boost::bad_get& e)
246 new_list.push_back(value);
283 template <
typename T>
293 catch (boost::bad_get& e)
310 template <
typename T>
314 return boost::get<T>(get<value_type>(key));
328 template <
typename T>
332 return boost::get<T>(get<value_type>(key));
372 std::pair<iterator, bool>
410 template <
typename T>
427 std::vector<key_type>
430 std::vector<key_type> ret;
431 std::transform(
begin(),
end(), std::back_inserter(ret),
getkey());
432 std::sort(ret.begin(), ret.end());
446 const std::string& prefix)
452 map_type::value_type v(prefix + i->first, i->second);
733 template <
typename T>
737 for (
typename std::vector<T>::const_iterator i = c.begin();
742 if (i + 1 != c.end())
752 template <
typename T>
792 template <
typename T>
796 typename std::vector<T>::size_type idx = 1;
798 int sf =
static_cast<int>(std::log10(static_cast<float>(c.size()))) + 1;
799 for (
typename std::vector<T>::const_iterator i = c.begin();
803 os <<
key <<
" #" << std::setw(sf) << std::setfill(
'0') << std::right << idx <<
" = " << *i <<
'\n';
815 template <
typename T>
819 os <<
key <<
" = " << v <<
'\n';
855 template <
typename T>
859 typename std::vector<T>::size_type idx = 1;
861 int sf =
static_cast<int>(std::log10(static_cast<float>(c.size()))) + 1;
862 for (
typename std::vector<T>::const_iterator i = c.begin();
866 std::ostringstream os;
867 os <<
key <<
" #" << std::setw(sf) << std::setfill(
'0') << std::right << idx;
880 template <
typename T>
903 MetadataMap::get<MetadataMap::value_type>(
const key_type& key)
905 map_type::iterator i = discriminating_map.find(key);
906 if (i == discriminating_map.end())
907 throw boost::bad_get();
925 MetadataMap::get<MetadataMap::value_type>(
const key_type& key)
const
927 map_type::const_iterator i = discriminating_map.find(key);
928 if (i == discriminating_map.end())
929 throw boost::bad_get();
961 template<
class charT,
class traits>
962 inline basic_ostream<charT,traits>&
963 operator<< (basic_ostream<charT,traits>& os,
964 const ::ome::bioformats::MetadataMap::value_type& vt)
977 template<
class charT,
class traits>
978 inline basic_ostream<charT,traits>&
979 operator<< (basic_ostream<charT,traits>& os,
980 const ::ome::bioformats::MetadataMap& map)
993 #endif // OME_BIOFORMATS_METADATAMAP_H
Visitor template for output of MetadataMap values to an ostream.
Definition: MetadataMap.h:763
MetadataMapOStreamVisitor(std::ostream &os, const MetadataMap::key_type &key)
Constructor.
Definition: MetadataMap.h:776
Variant type limit workaround.
void operator()(const std::vector< T > &c) const
Output a vector value of arbitrary type.
Definition: MetadataMap.h:794
const MetadataMap::key_type & key
The key of the value being output.
Definition: MetadataMap.h:768
std::ostream & os
The stream to output to.
Definition: MetadataMap.h:766