#include <array.hh>
Public Types | |
typedef Function_v2v< void > | category |
typedef T | element |
Element associated type. | |
typedef E | exact_t |
typedef array_bkd_iter< T > | bkd_eiter |
Backward iterator associated type. | |
typedef fwd_eiter | eiter |
Iterator associated type. | |
typedef array_fwd_iter< T > | fwd_eiter |
Iterator types | |
typedef std::vector< T >::reference | mutable_result |
typedef T | result |
Returned value types. | |
typedef std::vector< T > ::const_reference | ro_result |
Public Member Functions | |
template<typename U> | |
array< T > & | append (const array< U > &other) |
Add the elements of other at the end of this array. | |
array< T > & | append (const T &elt) |
Add the element elt at the end of this array. | |
void | clear () |
Empty the array. | |
void | fill (const T &value) |
Fill the whole array with value value . | |
std::vector< T > & | hook_std_vector_ () |
Hook to the mutable std::vector of elements. | |
bool | is_empty () const |
Test if the array is empty. | |
std::size_t | memory_size () const |
Return the size of this array in memory. | |
unsigned | nelements () const |
Return the number of elements of the array. | |
mutable_result | operator() (unsigned i) |
Return the i-th element of the array. | |
ro_result | operator() (unsigned i) const |
Return the i-th element of the array. | |
mutable_result | operator[] (unsigned i) |
Return the i-th element of the array. | |
ro_result | operator[] (unsigned i) const |
Return the i-th element of the array. | |
void | reserve (unsigned n) |
Reserve memory for n elements. | |
void | resize (unsigned n, const T &value) |
Resize this array to n elements with value as value. | |
void | resize (unsigned n) |
Resize this array to n elements. | |
unsigned | size () const |
Return the number of elements of the array. | |
const std::vector< T > & | std_vector () const |
Return the corresponding std::vector of elements. | |
array (unsigned n, const T &value) | |
Construct a new array, resize it to elements and fill it with default_value . | |
array (unsigned n) | |
Construct a new array and resize it to elements. | |
array () | |
Constructors | |
Private Attributes | |
std::vector< T > | v_ |
Elements are stored by copy. Implementation is lazy.
The parameter T
is the element type, which shall not be const-qualified.
Definition at line 99 of file util/array.hh.
typedef array_bkd_iter<T> mln::util::array< T >::bkd_eiter |
typedef Function_v2v<void> mln::Function_v2v< E >::category [inherited] |
Reimplemented from mln::Function< E >.
Reimplemented in mln::Function_v2b< E >, mln::Function_v2b< f_box2d_t >, mln::Function_v2b< mln::fun::v2b::lnot< V > >, mln::Function_v2b< mln::fun::p2b::antilogy >, mln::Function_v2b< mln::fun::p2b::has< I > >, mln::Function_v2b< mln::fun::p2b::tautology >, mln::Function_v2b< keep_specific_colors >, mln::Function_v2b< my_box2d >, mln::Function_v2b< mln::topo::is_simple_cell< I > >, mln::Function_v2b< mln::world::inter_pixel::dim2::is_edge >, mln::Function_v2b< mln::world::inter_pixel::dim2::is_row_odd >, mln::Function_v2b< mln::world::inter_pixel::dim2::is_pixel >, mln::Function_v2b< mln::fun::v2b::threshold< V > >, mln::Function_v2b< mln::world::inter_pixel::is_separator >, mln::Function_v2b< mln::topo::is_n_face< N > >, mln::Function_v2b< not_to_remove >, mln::Function_v2b< mln::fun::p2b::chess >, mln::Function_v2b< f_box1d_t >, mln::Function_v2b< mln::world::inter_pixel::dim2::is_dot >, mln::Function_v2b< mln::fun::p2b::big_chess< B > >, mln::Function_v2b< mln::world::inter_pixel::is_pixel >, and mln::Function_v2b< f_box3d_t >.
Definition at line 93 of file function.hh.
typedef fwd_eiter mln::util::array< T >::eiter |
typedef T mln::util::array< T >::element |
typedef E mln::Object< E >::exact_t [inherited] |
typedef array_fwd_iter<T> mln::util::array< T >::fwd_eiter |
typedef std::vector<T>::reference mln::util::array< T >::mutable_result |
typedef T mln::util::array< T >::result |
Returned value types.
Related to the Function_v2v concept.
Definition at line 112 of file util/array.hh.
typedef std::vector<T>::const_reference mln::util::array< T >::ro_result |
Definition at line 113 of file util/array.hh.
mln::util::array< T >::array | ( | ) | [inline] |
mln::util::array< T >::array | ( | unsigned | n | ) | [inline] |
mln::util::array< T >::array | ( | unsigned | n, | |
const T & | value | |||
) | [inline] |
Construct a new array, resize it to
elements and fill it with default_value
.
Definition at line 435 of file util/array.hh.
array< T > & mln::util::array< T >::append | ( | const array< U > & | other | ) | [inline] |
Add the elements of other
at the end of this array.
Definition at line 477 of file util/array.hh.
References mln::util::array< T >::is_empty(), mln::util::array< T >::std_vector(), and mln::util::array< T >::v_.
array< T > & mln::util::array< T >::append | ( | const T & | elt | ) | [inline] |
Add the element elt
at the end of this array.
Definition at line 467 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::labeling::internal::compute_functor< L, A >::init(), mln::p_mutable_array_of< S >::insert(), mln::io::plot::load(), mln::graph::attribute::representative_t::new_component_from_vertex(), mln::graph::attribute::card_t::new_component_from_vertex(), mln::labeling::internal::compute_functor< L, A >::new_label(), Functor::process_vertex(), mln::make::impl::generic::rag_and_labeled_wsl(), mln::data::impl::generic::sort_offsets_decreasing(), and mln::data::impl::generic::sort_offsets_increasing().
void mln::util::array< T >::clear | ( | ) | [inline] |
Empty the array.
All elements contained in the array are destroyed.
Definition at line 490 of file util/array.hh.
References mln::util::array< T >::is_empty(), and mln::util::array< T >::v_.
Referenced by mln::p_mutable_array_of< S >::clear(), and mln::io::plot::load().
void mln::util::array< T >::fill | ( | const T & | value | ) | [inline] |
Fill the whole array with value value
.
Definition at line 499 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::graph::attribute::representative_t::init(), mln::graph::attribute::card_t::init(), and Functor::init().
std::vector< T > & mln::util::array< T >::hook_std_vector_ | ( | ) | [inline] |
Hook to the mutable std::vector of elements.
Definition at line 573 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::data::impl::generic::sort_offsets_decreasing(), and mln::data::impl::generic::sort_offsets_increasing().
bool mln::util::array< T >::is_empty | ( | ) | const [inline] |
Test if the array is empty.
Definition at line 557 of file util/array.hh.
References mln::util::array< T >::nelements().
Referenced by mln::util::array< T >::append(), mln::util::array< T >::clear(), mln::make::image3d(), mln::p_mutable_array_of< S >::is_empty_(), and mln::io::pnms::load().
std::size_t mln::util::array< T >::memory_size | ( | ) | const [inline] |
Return the size of this array in memory.
Definition at line 581 of file util/array.hh.
References mln::util::array< T >::nelements().
Referenced by mln::p_mutable_array_of< S >::memory_size().
unsigned mln::util::array< T >::nelements | ( | ) | const [inline] |
Return the number of elements of the array.
Definition at line 515 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::canvas::morpho::impl::attribute_filter_fastest(), mln::canvas::impl::distance_front_fastest(), mln::canvas::impl::distance_geodesic_fastest(), mln::labeling::fill_holes(), mln::morpho::watershed::impl::flooding_fastest(), mln::convert::over_load::from_to_(), mln::p_mutable_array_of< S >::has(), mln::make::image3d(), mln::transform::impl::influence_zone_geodesic_fastest(), mln::util::array< T >::is_empty(), mln::io::pnms::load(), mln::util::array< T >::memory_size(), mln::labeling::n_max(), mln::p_mutable_array_of< S >::nelements(), mln::util::operator<<(), mln::p_mutable_array_of< S >::operator[](), mln::util::array< T >::operator[](), mln::make::impl::generic::rag_and_labeled_wsl(), mln::io::plot::save(), mln::util::array< T >::size(), mln::canvas::labeling::impl::sorted_fastest(), and mln::canvas::labeling::impl::video_fastest().
array< T >::mutable_result mln::util::array< T >::operator() | ( | unsigned | i | ) | [inline] |
Return the i-th
element of the array.
Definition at line 531 of file util/array.hh.
array< T >::ro_result mln::util::array< T >::operator() | ( | unsigned | i | ) | const [inline] |
Return the i-th
element of the array.
Definition at line 523 of file util/array.hh.
array< T >::mutable_result mln::util::array< T >::operator[] | ( | unsigned | i | ) | [inline] |
Return the i-th
element of the array.
Definition at line 548 of file util/array.hh.
References mln::util::array< T >::nelements(), and mln::util::array< T >::v_.
array< T >::ro_result mln::util::array< T >::operator[] | ( | unsigned | i | ) | const [inline] |
Return the i-th
element of the array.
Definition at line 539 of file util/array.hh.
References mln::util::array< T >::nelements(), and mln::util::array< T >::v_.
void mln::util::array< T >::reserve | ( | unsigned | n | ) | [inline] |
Reserve memory for n
elements.
Definition at line 443 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::labeling::internal::compute_functor< L, A >::init(), mln::p_mutable_array_of< S >::reserve(), mln::data::impl::generic::sort_offsets_decreasing(), and mln::data::impl::generic::sort_offsets_increasing().
void mln::util::array< T >::resize | ( | unsigned | n, | |
const T & | value | |||
) | [inline] |
Resize this array to n
elements with value
as value.
Definition at line 459 of file util/array.hh.
References mln::util::array< T >::v_.
void mln::util::array< T >::resize | ( | unsigned | n | ) | [inline] |
Resize this array to n
elements.
Definition at line 451 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::convert::over_load::from_to_(), mln::graph::attribute::representative_t::init(), mln::graph::attribute::card_t::init(), and Functor::init().
unsigned mln::util::array< T >::size | ( | ) | const [inline] |
Return the number of elements of the array.
Added for compatibility with fun::i2v::array.
Definition at line 507 of file util/array.hh.
References mln::util::array< T >::nelements().
Referenced by mln::value::lut_vec< S, T >::lut_vec(), and mln::labeled_image_base< I, E >::update_data().
const std::vector< T > & mln::util::array< T >::std_vector | ( | ) | const [inline] |
Return the corresponding std::vector of elements.
Definition at line 565 of file util/array.hh.
References mln::util::array< T >::v_.
Referenced by mln::util::array< T >::append(), mln::value::lut_vec< S, T >::lut_vec(), and mln::util::operator==().
std::vector<T> mln::util::array< T >::v_ [private] |
Definition at line 208 of file util/array.hh.
Referenced by mln::util::array< T >::append(), mln::util::array< T >::clear(), mln::util::array< T >::fill(), mln::util::array< T >::hook_std_vector_(), mln::util::array< T >::nelements(), mln::util::array< T >::operator[](), mln::util::array< T >::reserve(), mln::util::array< T >::resize(), and mln::util::array< T >::std_vector().