owlcpp  v0.3.3~
C++ library for working with OWL ontologies
 All Classes Namespaces Files Functions Macros Pages
node_blank.hpp
Go to the documentation of this file.
1 
6 #ifndef NODE_BLANK_HPP_
7 #define NODE_BLANK_HPP_
8 #include "boost/functional/hash.hpp"
9 #include "owlcpp/rdf/node.hpp"
10 #include "owlcpp/rdf/exception.hpp"
11 #include "owlcpp/doc_id.hpp"
14 
15 namespace owlcpp{
16 
19 class Node_blank : public Node {
20 public:
21  Node_blank(const unsigned n, const Doc_id doc)
22  : n_(n), doc_(doc) {}
23 
24  unsigned index() const {return n_;}
25  Doc_id document() const {return doc_;}
26 
27 private:
28  unsigned n_;
29  Doc_id doc_;
30 
31  OWLCPP_VISITABLE
32 
33  Ns_id ns_id_impl() const { return terms::blank::id(); }
34 
35  bool equal_impl(const Node& n) const {
36  //todo: use typeid()?
37  if( Node_blank const*const p = dynamic_cast<Node_blank const*>(&n) ) {
38  return n_ == p->n_ && doc_ == p->doc_;
39  }
40  return false;
41  }
42 
43  std::size_t hash_impl() const {
44  std::size_t h = 0;
45  boost::hash_combine(h, n_);
46  boost::hash_combine(h, doc_);
47  return h;
48  }
49 
50  Node* clone_impl() const {return new Node_blank(*this);}
51 
52 };
53 
54 }//namespace owlcpp
55 #endif /* NODE_BLANK_HPP_ */