7 #ifndef NAMED_VALUE_MAP_HPP_ 8 #define NAMED_VALUE_MAP_HPP_ 10 #include "boost/foreach.hpp" 11 #include "boost/assert.hpp" 18 namespace vdj_pipe{
namespace detail{
41 if( name.empty() )
return id_type(0);
42 const std::pair<id_type, bool> p =
nm_.
insert(name);
43 if( ! p.second ) BOOST_THROW_EXCEPTION(
53 if( name.empty() )
return id_type(0);
54 const std::pair<id_type, bool> p =
nm_.
insert(name);
59 std::string
const&
name(
const id_type
id)
const {
60 BOOST_ASSERT(
id &&
"invalid ID");
69 if( name.empty() )
return id_type(0);
70 if( id_type
const* vid =
nm_.
find(name) ) {
73 BOOST_THROW_EXCEPTION(
81 BOOST_ASSERT(vid &&
"invalid ID");
86 BOOST_ASSERT(vid &&
"invalid ID");
91 BOOST_FOREACH(
const id_type vid, *
this) {
Named_value_map()
Definition: named_value_map.hpp:31
detail::Id_bimap< Id, std::string > name_map
Definition: named_value_map.hpp:24
std::pair< id_type, bool > insert(obj_type const &obj)
Definition: id_bimap.hpp:160
iterator end() const
Definition: named_value_map.hpp:37
val_map vm_
Definition: named_value_map.hpp:97
name_map nm_
Definition: named_value_map.hpp:98
Id_iterator< id_type > iterator
Definition: named_value_map.hpp:28
Store values mapped against name strings and value IDs.
Definition: named_value_map.hpp:22
detail::Id_map< Id, Val > val_map
Definition: named_value_map.hpp:23
id_type const * find(ObjCompat const &obj) const
Definition: id_bimap.hpp:151
Main namespace of vdj_pipe library.
Definition: keywords_variable.hpp:11
id_type min_id() const
Definition: id_map.hpp:41
id_type const * find_id(std::string const &name) const
Definition: named_value_map.hpp:64
Id id_type
Definition: named_value_map.hpp:26
boost::error_info< struct errinfo_str1_, std::string > str1_t
Definition: exception.hpp:25
id_type insert_new_name(std::string const &name)
Definition: named_value_map.hpp:40
iterator const_iterator
Definition: named_value_map.hpp:29
id_type insert_name(std::string const &name)
Definition: named_value_map.hpp:52
Definition: exception.hpp:23
Definition: id_iterator.hpp:16
boost::error_info< struct errinfo_message_, std::string > msg_t
Definition: exception.hpp:24
value_type & operator[](const id_type vid)
Definition: named_value_map.hpp:85
id_type value_id(std::string const &name) const
Definition: named_value_map.hpp:68
std::string sanitize(const char c)
Definition: sanitize_string.cpp:53
std::size_t size() const
Definition: named_value_map.hpp:38
id_type max_id() const
Definition: id_map.hpp:42
std::size_t size() const
Definition: id_bimap.hpp:115
iterator begin() const
Definition: named_value_map.hpp:36
id_type insert(value_type const &obj)
Definition: id_map.hpp:83
void clear_values()
Definition: named_value_map.hpp:90
Val value_type
Definition: named_value_map.hpp:27
value_type const & operator[](const id_type vid) const
Definition: named_value_map.hpp:80
std::string const & name(const id_type id) const
Definition: named_value_map.hpp:59