27 #ifndef MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH
28 # define MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH
37 # include <mln/core/internal/pseudo_site_base.hh>
47 template <
typename S,
typename E>
58 const mln_site(S)&
subj_();
60 typedef typename S::graph_element::id_t
id_t;
80 const typename S::graph_t&
graph()
const;
99 operator const typename S::graph_element&()
const;
102 const typename S::graph_element&
element()
const;
106 const typename S::graph_element&
p_hook_()
const;
126 typename S::graph_element
elt_;
139 template <typename S, typename E>
147 template <typename S, typename E>
157 template <typename S, typename E>
167 template <typename S, typename P, typename E>
172 const typename S::graph_t&
graph()
const;
177 const typename S::graph_element&
element()
const;
178 const typename S::graph_element&
p_hook_()
const;
181 const E& exact_()
const;
184 template <
typename S,
typename P,
typename E>
199 # ifndef MLN_INCLUDE_ONLY
202 template <
typename S,
typename E>
209 template <
typename S,
typename E>
211 graph_psite_base<S,E>::graph_psite_base(
const S& s)
216 template <
typename S,
typename E>
218 graph_psite_base<S,E>::graph_psite_base(
const S& s,
unsigned id)
225 template <
typename E,
typename S,
typename G>
227 void local_change_graph(E& elt_, S& site_,
const G& g)
230 elt_.change_graph(g);
232 template <
typename E,
typename G>
234 void local_change_graph(E& elt_, E& site_,
const G& g)
236 elt_.change_graph(g);
237 site_.change_graph(g);
241 template <
typename S,
typename E>
244 graph_psite_base<S,E>::change_target(
const S& new_target)
247 local_change_graph(elt_, site_, new_target.graph());
250 template <
typename S,
typename E>
253 graph_psite_base<S,E>::update_id(
unsigned id)
255 mln_precondition(s_ != 0);
257 site_ = s_->function()(elt_.id());
260 template <
typename S,
typename E>
263 graph_psite_base<S,E>::target_()
const
268 template <
typename S,
typename E>
273 mln_precondition(s_ != 0);
277 template <
typename S,
typename E>
279 const typename S::graph_t&
280 graph_psite_base<S,E>::graph()
const
282 mln_precondition(s_ != 0);
286 template <
typename S,
typename E>
288 typename graph_psite_base<S,E>::id_t
289 graph_psite_base<S,E>::id()
const
294 template <
typename S,
typename E>
297 graph_psite_base<S,E>::is_valid()
const
299 return s_ != 0 && s_->is_valid() && elt_.is_valid();
302 template <
typename S,
typename E>
305 graph_psite_base<S,E>::invalidate()
311 template <
typename S,
typename E>
314 graph_psite_base<S,E>::subj_()
324 template <
typename S,
typename E>
326 graph_psite_base<S,E>::operator
unsigned ()
const
328 mln_precondition(is_valid());
332 template <
typename S,
typename E>
334 graph_psite_base<S,E>::operator
typename S::graph_element::id_t ()
const
336 mln_precondition(is_valid());
340 template <
typename S,
typename E>
342 graph_psite_base<S,E>::operator
const typename S::graph_element&()
const
348 template <
typename S,
typename E>
350 const typename S::graph_element&
351 graph_psite_base<S,E>::element()
const
361 template <
typename S,
typename E>
363 const typename S::graph_element&
364 graph_psite_base<S,E>::p_hook_()
const
370 template <
typename S,
typename P,
typename E>
375 return internal::force_exact<const E>(*this);
378 template <
typename S,
typename P,
typename E>
383 return exact_().get_subject().target();
386 template <
typename S,
typename P,
typename E>
391 return exact_().get_subject().site_set();
395 template <
typename S,
typename P,
typename E>
397 const typename S::graph_t&
400 return exact_().get_subject().graph();
403 template <
typename S,
typename P,
typename E>
408 return exact_().get_subject().id();
411 template <
typename S,
typename P,
typename E>
416 return exact_().get_subject().is_valid();
419 template <
typename S,
typename P,
typename E>
421 const typename S::graph_element&
424 return exact_().get_subject().element();
427 template <
typename S,
typename P,
typename E>
429 const typename S::graph_element&
432 return exact_().get_subject().p_hook_();
436 template <
typename S,
typename P,
typename E>
441 return internal::force_exact<E>(*this);
444 template <
typename S,
typename P,
typename E>
449 exact_().get_subject().change_target(new_target);
452 template <
typename S,
typename P,
typename E>
457 exact_().get_subject().update_id(
id);
460 template <
typename S,
typename P,
typename E>
465 exact_().get_subject().invalidate();
468 # endif // ! MLN_INCLUDE_ONLY
475 #endif // ! MLN_CORE_INTERNAL_GRAPH_PSITE_BASE_HH