$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
core/concept/graph.hh
1 // Copyright (C) 2008, 2009, 2011, 2013 EPITA Research and Development
2 // Laboratory (LRDE)
3 //
4 // This file is part of Olena.
5 //
6 // Olena is free software: you can redistribute it and/or modify it under
7 // the terms of the GNU General Public License as published by the Free
8 // Software Foundation, version 2 of the License.
9 //
10 // Olena is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
17 //
18 // As a special exception, you may use this file as part of a free
19 // software project without restriction. Specifically, if other files
20 // instantiate templates or use macros or inline functions from this
21 // file, or you compile this file and link it with other files to produce
22 // an executable, this file does not by itself cause the resulting
23 // executable to be covered by the GNU General Public License. This
24 // exception does not however invalidate any other reasons why the
25 // executable file might be covered by the GNU General Public License.
26 
27 #ifndef MLN_CORE_CONCEPT_GRAPH_HH
28 # define MLN_CORE_CONCEPT_GRAPH_HH
29 
33 
34 # include <mln/core/concept/object.hh>
35 # include <mln/util/graph_ids.hh>
36 
37 namespace mln
38 {
39 
40 
41  // Forward declaration.
42  template <typename E> struct Graph;
43 
46  template <>
47  struct Graph<void>
48  {
50  };
52 
53 
59  template <typename E>
60  struct Graph : public Object<E>
61  {
63 
64  /*
65  // provided by internal::image_base:
66 
67  typedef pset;
68  typedef site;
69  typedef psite;
70 
71  typedef fwd_piter;
72  typedef bkd_piter;
73 
74  // Misc.
75  const E& id() const;
76  template<typename G2>
77  bool is_subgraph_of(const G2& gr) const;
78  */
79  /*
80  // Vertex and edges oriented.
81  util::vertex_id_t v_other(const util::edge_id_t& id_e, const util::vertex_id_t& id_v) const;
82 
83  // Vertex oriented.
84  size_t v_nmax() const;
85  bool has(unsigned id_v) const;
86  size_t v_nmax_nbh_edges(const util::vertex_id_t& id_v) const;
87  util::edge_id_t v_ith_nbh_edge(const util::vertex_id_t& id_v, unsigned i) const;
88 
89  // Edge oriented.
90  size_t e_nmax() const;
91  bool has_e(const util::edge_id_t& id_e) const;
92  util::vertex_id_t v1(const util::edge_id_t& id_e) const;
93  util::vertex_id_t v2(const util::edge_id_t& id_e) const;
94  size_t e_nmax_nbh_edges(const util::edge_id_t& id_e) const;
95  util::edge_id_t e_ith_nbh_edge(const util::edge_id_t& id_e, unsigned i) const;
96 
97  */
98 
99  protected:
100  Graph();
101  };
102 
103 
104 # ifndef MLN_INCLUDE_ONLY
105 
106  template <typename E>
107  inline
109  {
110  // provided by internal::graph_base:
111 
112  //typedef mln_psite(E) psite;
113 
114  //typedef mln_fwd_piter(E) fwd_piter;
115  //typedef mln_bkd_piter(E) bkd_piter;
116 
117  // Check methods
118  const void* (E::*m1)() const = & E::id;
119  (void) m1;
120  util::vertex_id_t (E::*m2)(const util::edge_id_t& id_e, const util::vertex_id_t& id_v) const = & E::v_other;
121  (void) m2;
122  size_t (E::*m4)() const = & E::v_nmax;
123  (void) m4;
124  bool (E::*m5)(const util::vertex_id_t& id_v) const = & E::has_v;
125  (void) m5;
126  size_t (E::*m6)(const util::vertex_id_t& id_v) const = & E::v_nmax_nbh_edges;
127  (void) m6;
128  util::edge_id_t (E::*m7)(const util::vertex_id_t& id_v, unsigned i) const = & E::v_ith_nbh_edge;
129  (void) m7;
130  size_t (E::*m8)() const = & E::e_nmax;
131  (void) m8;
132  bool (E::*m9)(const util::edge_id_t& id_e) const = & E::has_e;
133  (void) m9;
134  util::vertex_id_t (E::*m10)(const util::edge_id_t& id_e) const = & E::v1;
135  (void) m10;
136  util::vertex_id_t (E::*m11)(const util::edge_id_t& id_e) const = & E::v2;
137  (void) m11;
138  size_t (E::*m12)(const util::edge_id_t& id_e) const = & E::e_nmax_nbh_edges;
139  (void) m12;
140  util::edge_id_t (E::*m13)(const util::edge_id_t& id_e, unsigned i) const = & E::e_ith_nbh_edge;
141  (void) m13;
142 
143  bool (E::*m14)() const = & E::is_valid;
144  (void) m14;
145  void (E::*m15)() = & E::invalidate;
146  (void) m15;
147  //FIXME: enable this test. Currently does not work because this is
148  // a templated method.
149  //bool (E::*m14)(...) = & E::is_subgraph_of;
150  //(void) m14;
151  }
152 
153 
154 # endif // ! MLN_INCLUDE_ONLY
155 
156 } // end of namespace mln
157 
158 #endif // ! MLN_CORE_CONCEPT_GRAPH_HH