STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types | Public Attributes | Protected Member Functions
stapl::array_ro_view< C, OptionalParams > Class Template Reference

One dimensional read only array view. More...

Public Member Functions

 array_ro_view (array_ro_view const &other)=default
 
 array_ro_view (view_container_type *vcont)
 Constructs a view that can reference all the elements of the container provided. The view takes ownership of the container. More...
 
 array_ro_view (view_container_type *vcont, domain_type const &dom)
 Constructs a view with a restricted domain of the elements of the container provided. The view takes ownership of the container. More...
 
 array_ro_view (view_container_type *vcont, domain_type const &dom, map_func_type mfunc)
 Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The view takes ownership of the container. More...
 
 array_ro_view (view_container_type const &vcont)
 Constructs a view that can reference all the elements of the container provided. The view does not take ownership of the container. More...
 
 array_ro_view (view_container_type const &vcont, domain_type const &dom)
 Constructs a view with a restricted domain of the elements of the container provided. The view does not take ownership of the container. More...
 
 array_ro_view (view_container_type const &vcont, domain_type const &dom, map_func_type mfunc)
 Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The view does not take ownership of the container. More...
 
 array_ro_view (view_container_type const &vcont, domain_type const &dom, map_func_type mfunc, array_ro_view const &)
 Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The constructor accepts another ArrayRO instance from which it could copy additional state. The view does not take ownership of the container. More...
 
template<typename ... OtherOptionalParams>
 array_ro_view (array_ro_view< C, OtherOptionalParams... > const &other)
 Copy constructor when the view provided is not the most derived view.
 
bool is_valid (void) const
 
view_container_type * get_container (void) const
 
view_container_type & container (void)
 
view_container_type & container (void) const
 
domain_type const & domain (void) const
 
domain_type & domain (void)
 
void set_domain (domain_type const &dom)
 
map_func_type const & mapfunc (void) const
 
size_type size (void) const
 Returns the number of elements referenced for the view.
 
bool empty (void) const
 Returns true if the view does not reference any element.
 
View Read Operations
value_type get_element (index_t const &index) const
 Get the element index from the container. More...
 
future< value_type > get_element_split (index_t const &index) const
 Get the element index from the container. More...
 
Functor::result_type apply_get (index_t const &index, Functor f)
 Applies the provided function to the value referenced for the given index and returns the result of the operation. More...
 
Functor::result_type apply_get (index_t const &index, Functor f) const
 
View Subscript Operations
reference_t operator[] (index_t const &index) const
 The bracket operator is the basic access method.
 
reference_t make_reference (index_t const &index) const
 
Sequence Iterator
Warning
Methods in the Sequence Iterator group should only be used inside a work function which is processing a segmented view.
iterator begin (void)
 
const_iterator begin (void) const
 
iterator end (void)
 
const_iterator end (void) const
 
iterator make_iterator (index_t i)
 
index_t next (index_t const &index) const
 Computes the next index based on the given index. More...
 
index_t prev (index_t const &index) const
 Computes the previous index based on the given index. More...
 
index_t advance (index_t const &index, Distance n) const
 Computes the new index after advance n positions from the given index. More...
 
long distance (index_t const &index1, index_t const &index2) const
 
bool less_than (index_t const &index1, index_t const &index2) const
 

Public Types

typedef sequence_op_type::iterator iterator
 
typedef sequence_op_type::const_iterator const_iterator
 
typedef C view_container_type
 
typedef view_traits< array_ro_view< C, OptionalParams... > >::domain_type domain_type
 
typedef view_traits< array_ro_view< C, OptionalParams... > >::map_function map_func_type
 
typedef mf_type_helper::index_type index_type
 
typedef mf_type_helper::gid_type gid_type
 
typedef std::size_t size_type
 
using reference_t = typename view_traits< array_ro_view< C, OptionalParams... > >::reference
 
typedef detail::make_iterator< view_traits< array_ro_view< C, OptionalParams... > >::derived_type, iterator > make_iterator_t
 

Public Attributes

C * m_ptr
 
sptr_type m_sptr
 

Protected Member Functions

C * container_ptr (void) const
 Returns the container's pointer.
 

Detailed Description

template<typename C, typename ... OptionalParams>
class stapl::array_ro_view< C, OptionalParams >

One dimensional read only array view.

Provides the operations that are commonly present in an array (random access, iteration). Write operation is not supported.

Template Parameters
CContainer type.
DomDomain type. By default uses the same domain type provided for the container.
MapFuncMapping function type. (default: identity mapping function)
DerivedType of the most derived class (default: itself)

Constructor & Destructor Documentation

◆ array_ro_view() [1/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type *  vcont)

Constructs a view that can reference all the elements of the container provided. The view takes ownership of the container.

Parameters
vcontpointer to the container used to forward the operations.

◆ array_ro_view() [2/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type *  vcont,
domain_type const &  dom 
)

Constructs a view with a restricted domain of the elements of the container provided. The view takes ownership of the container.

Parameters
vcontpointer to the container used to forward the operations.
domdomain to be used by the view.

◆ array_ro_view() [3/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type *  vcont,
domain_type const &  dom,
map_func_type  mfunc 
)

Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The view takes ownership of the container.

Parameters
vcontpointer to the container used to forward the operations.
domdomain to be used by the view.
mfuncmapping function to transform view indices to container gids.

◆ array_ro_view() [4/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type const &  vcont)

Constructs a view that can reference all the elements of the container provided. The view does not take ownership of the container.

Parameters
vcontreference to the container used to forward the operations.

◆ array_ro_view() [5/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type const &  vcont,
domain_type const &  dom 
)

Constructs a view with a restricted domain of the elements of the container provided. The view does not take ownership of the container.

Parameters
vcontreference to the container used to forward the operations.
domdomain to be used by the view.

◆ array_ro_view() [6/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type const &  vcont,
domain_type const &  dom,
map_func_type  mfunc 
)

Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The view does not take ownership of the container.

Parameters
vcontreference to the container used to forward the operations.
domdomain to be used by the view.
mfuncmapping function to transform view indices to container gids.

◆ array_ro_view() [7/7]

template<typename C , typename ... OptionalParams>
stapl::array_ro_view< C, OptionalParams >::array_ro_view ( view_container_type const &  vcont,
domain_type const &  dom,
map_func_type  mfunc,
array_ro_view< C, OptionalParams > const &   
)

Constructs a view with a potentially restricted domain of the elements of the container provided and a non-identity mapping function. The constructor accepts another ArrayRO instance from which it could copy additional state. The view does not take ownership of the container.

This constructor is provided to match the interfaces of other view classes. There is no additional state that needs to be copied from the reference view provided.

Parameters
vcontreference to the container used to forward the operations.
domdomain to be used by the view.
mfuncmapping function to transform view indices to container gids.

Member Function Documentation

◆ get_container()

view_container_type* stapl::core_view< C, view_traits< array_ro_view< C, OptionalParams... > >::domain_type , view_traits< array_ro_view< C, OptionalParams... > >::map_function >::get_container ( void  ) const
inherited

◆ container()

view_container_type& stapl::core_view< C, view_traits< array_ro_view< C, OptionalParams... > >::domain_type , view_traits< array_ro_view< C, OptionalParams... > >::map_function >::container ( void  ) const
inherited

◆ get_element()

value_type stapl::view_operations::read< array_ro_view< C, OptionalParams... > >::get_element ( index_t const &  index) const
inherited

Get the element index from the container.

Parameters
indexof element to get

◆ get_element_split()

future<value_type> stapl::view_operations::read< array_ro_view< C, OptionalParams... > >::get_element_split ( index_t const &  index) const
inherited

Get the element index from the container.

Parameters
indexof element to get

◆ apply_get() [1/2]

Functor::result_type stapl::view_operations::read< array_ro_view< C, OptionalParams... > >::apply_get ( index_t const &  index,
Functor  f 
)
inherited

Applies the provided function to the value referenced for the given index and returns the result of the operation.

Parameters
indexof element to apply the function
ffunction to apply
Returns
result of evaluate the function f on the value referenced for the index

◆ apply_get() [2/2]

Functor::result_type stapl::view_operations::read< array_ro_view< C, OptionalParams... > >::apply_get ( index_t const &  index,
Functor  f 
) const
inherited

◆ next()

index_t stapl::view_operations::sequence< view_traits< array_ro_view< C, OptionalParams... > >::derived_type , use_default >::next ( index_t const &  index) const
inherited

Computes the next index based on the given index.

Overwriting this method allows produce a different way to traverse the elements referenced by the view.

◆ prev()

index_t stapl::view_operations::sequence< view_traits< array_ro_view< C, OptionalParams... > >::derived_type , use_default >::prev ( index_t const &  index) const
inherited

Computes the previous index based on the given index.

Overwriting this method allows produce a different way to traverse the elements referenced by the view.

◆ advance()

index_t stapl::view_operations::sequence< view_traits< array_ro_view< C, OptionalParams... > >::derived_type , use_default >::advance ( index_t const &  index,
Distance  n 
) const
inherited

Computes the new index after advance n positions from the given index.

Overwriting this method allows produce a different way to traverse the elements referenced by the view.


The documentation for this class was generated from the following file: