TPIE

11a2c2d
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::pipelining {
27 
28 class node;
29 
30 namespace bits {
31 
33  size_t m_refCnt;
34  node_map::ptr m_map;
35  std::vector<node_map::id_t> m_nodes;
36  std::vector<std::pair<node_map::id_t, node_relation> > m_relations;
37 
38  friend void intrusive_ptr_add_ref(node_set_content * s) {
39  s->m_refCnt++;
40  }
41 
42  friend void intrusive_ptr_release(node_set_content * s) {
43  s->m_refCnt--;
44  if (s->m_refCnt == 0) delete s;
45  }
46 };
47 
48 } // namespace bits
49 
50 typedef boost::intrusive_ptr<bits::node_set_content> node_set;
51 
52 inline node_set make_node_set() {
53  return new bits::node_set_content();
54 }
55 
56 } // namespace tpie::pipelining
57 
58 #endif // __TPIE_PIPELINING_NODE_SET_H__
tpie::pipelining
pipelining/factory_base.h Base class of pipelining factories
Definition: ami_glue.h:23
tpie::pipelining::bits::node_set_content
Definition: node_set.h:32
tokens.h