ome-xml 5.2.3

OrderedMultimap.h
1 /*
2 * #%L
3 * OME-XML C++ library for working with OME-XML metadata structures.
4 * %%
5 * Copyright © 2006 - 2016 Open Microscopy Environment:
6 * - Massachusetts Institute of Technology
7 * - National Institutes of Health
8 * - University of Dundee
9 * - Board of Regents of the University of Wisconsin-Madison
10 * - Glencoe Software, Inc.
11 * %%
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 * 1. Redistributions of source code must retain the above copyright notice,
16 * this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright notice,
18 * this list of conditions and the following disclaimer in the documentation
19 * and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
25 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 * POSSIBILITY OF SUCH DAMAGE.
32 *
33 * The views and conclusions contained in the software and documentation are
34 * those of the authors and should not be interpreted as representing official
35 * policies, either expressed or implied, of any organization.
36 * #L%
37 */
38
39 #ifndef OME_XML_MODEL_PRIMITIVES_ORDEREDMULTIMAP_H
40 #define OME_XML_MODEL_PRIMITIVES_ORDEREDMULTIMAP_H
41
42 #include <string>
43 #include <utility>
44
45 #include <boost/multi_index_container.hpp>
46 #include <boost/multi_index/identity.hpp>
47 #include <boost/multi_index/member.hpp>
48 #include <boost/multi_index/indexed_by.hpp>
49 #include <boost/multi_index/ordered_index.hpp>
50 #include <boost/multi_index/hashed_index.hpp>
51 #include <boost/multi_index/random_access_index.hpp>
52
53 namespace ome
54 {
55 namespace xml
56 {
57 namespace model
58 {
59 namespace primitives
60 {
61
63 typedef std::pair<std::string, std::string> ordered_map_value;
64
66 struct order_index{};
67
69 struct key_index{};
70
74 typedef boost::multi_index_container<
75 // value type
76 ordered_map_value,
77 // indexes
78 boost::multi_index::indexed_by<
79 // by insertion order
80 boost::multi_index::random_access<
81 boost::multi_index::tag<order_index>
82 >,
83 // by key
84 boost::multi_index::hashed_non_unique<
85 boost::multi_index::tag<key_index>,
86 boost::multi_index::member<ordered_map_value, std::string, &ordered_map_value::first>
87 >
88 >
89 > OrderedMultimap;
90
91 }
92 }
93 }
94 }
95
96 #endif // OME_XML_MODEL_PRIMITIVES_ORDEREDMULTIMAP_H
97
98 /*
99 * Local Variables:
100 * mode:C++
101 * End:
102 */
ome::xml::model::primitives::order_index
Type tag for ordered map insertion order index.
Definition: OrderedMultimap.h:66
ome::xml::model::primitives::key_index
Type tag for ordered map key index.
Definition: OrderedMultimap.h:69
ome
Open Microscopy Environment C++ implementation.
ome::xml::model::primitives::OrderedMultimap
boost::multi_index_container< ordered_map_value, boost::multi_index::indexed_by< boost::multi_index::random_access< boost::multi_index::tag< order_index > >, boost::multi_index::hashed_non_unique< boost::multi_index::tag< key_index >, boost::multi_index::member< ordered_map_value, std::string, &ordered_map_value::first > > > > OrderedMultimap
Map preserving insertion order.
Definition: OrderedMultimap.h:89
ome::xml::model::primitives::ordered_map_value
std::pair< std::string, std::string > ordered_map_value
Value type for ordered map (string key, string value).
Definition: OrderedMultimap.h:63