graph_analysis
SubGraphImpl.hpp
Go to the documentation of this file.
1 #ifndef GRAPH_ANALYSIS_SUB_GRAPH_IMPL_HPP
2 #define GRAPH_ANALYSIS_SUB_GRAPH_IMPL_HPP
3 
4 #include <assert.h>
5 #include "SubGraph.hpp"
6 #include "BaseGraph.hpp"
7 
8 namespace graph_analysis {
9 
14 template<typename SubGraphType>
15 class SubGraphImpl : public SubGraph
16 {
17 public:
18  typedef SubGraphType graph_t;
19 
32  SubGraphImpl(shared_ptr<BaseGraph> graph)
33  : SubGraph(graph)
34  {}
35 
36  virtual ~SubGraphImpl() {}
37 
43  {
44  assert(mpSubgraph);
45  return (*mpSubgraph);
46  }
47 
48  const graph_t& raw() const
49  {
50  assert(mpSubgraph);
51  return (*mpSubgraph);
52  }
53 
54 protected:
60  void setSubgraph(graph_t* subgraph)
61  {
62  assert(subgraph);
63  mpSubgraph = shared_ptr<graph_t>(subgraph);
64  }
65 
66  shared_ptr<graph_t> mpSubgraph;
67 };
68 
69 } // end namespace graph_analysis
70 #endif // GRAPH_ANALYSIS_SUB_GRAPH_IMPL_HPP
71 
graph_analysis::SubGraphImpl
SubGraphImpl represents the subgraph implemention.
Definition: SubGraphImpl.hpp:15
graph_analysis::SubGraphImpl::SubGraphImpl
SubGraphImpl(shared_ptr< BaseGraph > graph)
Definition: SubGraphImpl.hpp:32
graph_analysis::SubGraphImpl::mpSubgraph
shared_ptr< graph_t > mpSubgraph
Definition: SubGraphImpl.hpp:66
BaseGraph.hpp
graph_analysis::SubGraphImpl::~SubGraphImpl
virtual ~SubGraphImpl()
Definition: SubGraphImpl.hpp:36
graph_analysis
Main namespace of the graph analysis library.
Definition: BFS.cpp:3
graph_analysis::SubGraphImpl::graph_t
SubGraphType graph_t
Definition: SubGraphImpl.hpp:18
graph_analysis::SubGraphImpl::setSubgraph
void setSubgraph(graph_t *subgraph)
Definition: SubGraphImpl.hpp:60
graph_analysis::SubGraph
A subgraph represent a particular filtered 'view' on a BaseGraph.
Definition: SubGraph.hpp:32
SubGraph.hpp
graph_analysis::SubGraphImpl::raw
const graph_t & raw() const
Definition: SubGraphImpl.hpp:48
graph_analysis::SubGraphImpl::raw
graph_t & raw()
Definition: SubGraphImpl.hpp:42