owlcpp  v0.3.3~
C++ library for working with OWL ontologies
 All Classes Namespaces Files Functions Macros Pages
map_node_iri.hpp
Go to the documentation of this file.
1 
6 #ifndef MAP_NODE_IRI_HPP_
7 #define MAP_NODE_IRI_HPP_
8 #include <string>
9 #include <vector>
10 #include "boost/assert.hpp"
11 #include "boost/foreach.hpp"
12 #include "boost/unordered_map.hpp"
13 #include "boost/concept_check.hpp"
14 
15 #include "owlcpp/rdf/node_iri.hpp"
16 #include "owlcpp/node_id.hpp"
17 #include "owlcpp/rdf/detail/map_id_object.hpp"
18 
19 #include "owlcpp/detail/iterator_member_pair.hpp"
20 #include "owlcpp/terms/detail/max_standard_id.hpp"
21 
22 namespace owlcpp{
23 
29 class Map_node_iri {
30 public:
31  typedef Node_iri node_type;
32  typedef Node_id id_type;
33 private:
34  typedef detail::Map_id_object<node_type, id_type> map_t;
35 
36 public:
37  typedef Iterator_member_pair<map_t::const_iterator, Node_id const, 2> iterator;
38  typedef iterator const_iterator;
39 
40  struct Err : public Rdf_err {};
41 
42  Map_node_iri(const Node_id id0 = detail::min_node_id())
43  : map_(id0)
44  {}
45 
46  std::size_t size() const { return map_.size(); }
47  const_iterator begin() const {return map_.begin();}
48  const_iterator end() const {return map_.end();}
49  bool empty() const {return map_.empty();}
50 
51  Node_iri const& operator[](const Node_id id) const {return map_[id];}
52  Node_iri const& at(const Node_id id) const {return map_.at(id);}
53  Node_iri const* find(const Node_id id) const {return map_.find(id);}
54  Node_id const* find(Node_iri const& node) const {return map_.find(node);}
55 
56  Node_id const* find_iri(const Ns_id ns, std::string const& val) const {
57  return map_.find(Node_iri(ns,val));
58  }
59 
60  Node_id insert_iri(const Ns_id ns, std::string const& val) {
61  return map_.insert(Node_iri(ns, val));
62  }
63 
64  Node_id insert(Node_iri const& node) {return map_.insert(node);}
65  void remove(const Node_id id) {map_.remove(id);}
66  void clear() {map_.clear();}
67 
68 private:
69  map_t map_;
70 };
71 
72 }//namespace owlcpp
73 #endif /* MAP_NODE_IRI_HPP_ */