Milena (Olena)  User documentation 2.0a Id
 All Classes Namespaces Functions Variables Typedefs Enumerator Groups Pages
graph_window_base.hh
1 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #ifndef MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
27 # define MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH
28 
29 # include <mln/core/concept/window.hh>
30 
34 
35 namespace mln
36 {
37 
39  template <typename P, typename E>
40  class graph_window_base : public Window<E>
41  {
43 
44  public:
48  typedef P site;
49 
50  // FIXME: This is a dummy value.
51  typedef void dpsite;
53 
57  bool is_empty() const;
59  bool is_centered() const;
61  // FIXME: We should define this more precisely.
62  bool is_symmetric() const;
65  /* FIXME: This method returns a dummy value (0), since the delta
66  of a window on a graph/line_graph
67 
68  1. is not constant (line graph edges/graph vertices are not necessarily
69  aligned on a regular grid);
70 
71  2. depends on the underlying line_graph/graph, too.
72 
73  It raises another question: should delta() be part of the
74  concept ``Window''? */
75  unsigned delta() const;
77  self_& sym();
78 
80  bool is_neighbable_() const;
82 
84  bool is_valid() const;
85 
86  protected:
88  };
89 
90 
91 # ifndef MLN_INCLUDE_ONLY
92 
93 
94 
95  template <typename P, typename E>
96  inline
98  {
99  }
100 
101  template <typename P, typename E>
102  inline
103  bool
105  {
106  return false;
107  }
108 
109  template <typename P, typename E>
110  inline
111  bool
113  {
114  return false;
115  }
116 
117  template <typename P, typename E>
118  inline
119  bool
121  {
122  return true;
123  }
124 
125  template <typename P, typename E>
126  inline
127  unsigned
129  {
130  // Dummy value (see the interface of the method above).
131  return 0;
132  }
133 
134  template <typename P, typename E>
135  inline
138  {
139  return *this;
140  }
141 
142  template <typename P, typename E>
143  inline
144  bool
146  {
147  return true;
148  }
149 
150  template <typename P, typename E>
151  inline
152  bool
154  {
155  return true;
156  }
157 
158 
159 
160 # endif // !MLN_INCLUDE_ONLY
161 
162 } // end of namespace mln
163 
164 #endif // ! MLN_CORE_INTERNAL_GRAPH_WINDOW_BASE_HH