TPIE

2362a60
node_set.h
1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
2 // vi:set ts=4 sts=4 sw=4 noet :
3 // Copyright 2015, The TPIE development team
4 //
5 // This file is part of TPIE.
6 //
7 // TPIE is free software: you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the
9 // Free Software Foundation, either version 3 of the License, or (at your
10 // option) any later version.
11 //
12 // TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with TPIE. If not, see <http://www.gnu.org/licenses/>
19 
20 #ifndef __TPIE_PIPELINING_NODE_SET_H__
21 #define __TPIE_PIPELINING_NODE_SET_H__
22 #include <vector>
23 #include <boost/intrusive_ptr.hpp>
24 #include <tpie/pipelining/tokens.h>
25 
26 namespace tpie {
27 namespace pipelining {
28 
29 class node;
30 
31 namespace bits {
32 
34  size_t m_refCnt;
35  node_map::ptr m_map;
36  std::vector<node_map::id_t> m_nodes;
37  std::vector<std::pair<node_map::id_t, node_relation> > m_relations;
38 
39  friend void intrusive_ptr_add_ref(node_set_content * s) {
40  s->m_refCnt++;
41  }
42 
43  friend void intrusive_ptr_release(node_set_content * s) {
44  s->m_refCnt--;
45  if (s->m_refCnt == 0) delete s;
46  }
47 };
48 
49 } // namespace bits
50 
51 typedef boost::intrusive_ptr<bits::node_set_content> node_set;
52 
53 inline node_set make_node_set() {
54  return new bits::node_set_content();
55 }
56 
57 } // namespace pipelining
58 
59 } // namespace tpie
60 
61 #endif // __TPIE_PIPELINING_NODE_SET_H__
Pipeline tokens.