26 #ifndef MLN_CORE_INTERNAL_RUN_IMAGE_HH
27 # define MLN_CORE_INTERNAL_RUN_IMAGE_HH
34 # include <mln/core/internal/image_primary.hh>
35 # include <mln/core/site_set/p_run.hh>
36 # include <mln/core/site_set/p_set_of.hh>
49 template <
typename T,
typename P,
typename E>
50 class run_image_ :
public internal::image_primary< P, p_set_of< p_run<P> >, E >
64 float compression()
const;
80 P point_at(
const mln_psite(p_set_of< p_run<P> >)& ps)
const;
86 bool has(
const mln_psite(p_set_of< p_run<P> >)& ps)
const;
89 # ifndef MLN_INCLUDE_ONLY
91 template <
typename T,
typename P,
typename E>
93 run_image_<T, P, E>::run_image_()
97 template <
typename T,
typename P,
typename E>
100 run_image_<T, P, E>::compression()
const
102 return float(exact(
this)->data_->memory_size()) /
103 float (
sizeof(T) * exact(
this)->data_->domain_.bbox().nsites());
106 template <
typename T,
typename P,
typename E>
109 run_image_<T, P, E>::finalize()
111 exact(
this)->data_->finalize();
114 template <
typename T,
typename P,
typename E>
117 run_image_<T, P, E>::point_at(
const mln_psite(p_set_of< p_run<P> >)& ps)
const
119 const E* ima = exact(
this);
120 mln_precondition(ps.index() < ima->data_->domain_.nsites());
121 mln_precondition(ps.p().index() < ima->data_->domain_[ps.index()].length());
122 return ima->data_->domain_[ps.index()][ps.p().index()];
125 template <
typename T,
typename P,
typename E>
128 run_image_<T, P, E>::has(
const mln_psite(p_set_of< p_run<P> >)& ps)
const
130 const E* ima = exact(
this);
131 if (!ima->is_valid())
134 return (ps.index() < ima->data_->domain_.nsites()
135 && ps.p().index() < ima->data_->domain_[ps.index()].length()
136 && ima->data_->domain_[ps.index()][ps.p().index()] == ps);
139 # endif // ! MLN_INCLUDE_ONLY
146 #endif // ! MLN_CORE_INTERNAL_RUN_IMAGE_HH