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

The base container used for array. More...

Public Member Functions

 array_base_container (domain_type const &domain, cid_type const &cid=index_bounds< cid_type >::invalid())
 Create a base container with a specific domain and ID. More...
 
 array_base_container (domain_type const &domain, cid_type const &cid, value_type const &default_value)
 Create a base container with a specific domain, ID and initial value. More...
 
 array_base_container (domain_type domain, value_type *extmem)
 Create a base container with a specific domain and using a raw pointer to a block of memory that stores data. More...
 
cid_type const & cid (void) const
 Return the base container ID.
 
domain_type * get_domain (void) const
 
domain_type const & domain (void) const
 
void truncate_tail (gid_type const &gid)
 Truncate a base container by removing a specific GID and modifying the domain to remove from that index to the end of the container. More...
 
void truncate_head (gid_type const &gid)
 Truncate a base container by removing a specific GID and modifying the domain to remove from the beginning of the container to that index. More...
 
container_type & container (void)
 
container_type const & container (void) const
 
value_type * raw (void)
 Return a raw pointer to underlying data. More...
 
gid_type local_position (gid_type const &gid) const
 Return the local position of a global ID. More...
 
reference make_reference (gid_type const &gid)
 Construct a local reference to a specific index of the base container. More...
 
const_reference make_reference (gid_type const &gid) const
 Construct a local reference to a specific index of the base container (read only). More...
 
iterator make_iterator (gid_type const &gid)
 Construct a local iterator to a specific index of the base container. More...
 
reference operator[] (gid_type const &gid)
 Construct a local reference to a specific index of the base container. More...
 
const_reference operator[] (gid_type const &gid) const
 Construct a local reference to a specific index of the base container (read only). More...
 
value_type get_element (gid_type const &gid)
 Get the element corresponding to a specific GID. More...
 
value_type get_element (gid_type const &gid) const
 Get the element corresponding to a specific GID. More...
 
Traits::stored_type get_stored_element (gid_type const &gid) const
 Get the element corresponding to a specific GID. More...
 
template<typename F >
void apply_set (gid_type const &gid, F const &f)
 Invoke the functor provided on the element with the specified key. More...
 
template<typename Functor >
Functor::result_type apply_get (gid_type const &gid, Functor const &f)
 Apply a function object to an element at a specific GID and return the result. More...
 
void set_element (gid_type const &gid, typename Traits::stored_type const &t)
 Update the value of an element at a specific GID. More...
 
template<typename Iterator >
std::enable_if< is_local_iterator< Iterator >::value >::type set_elements (gid_type const &gid, Iterator iter, Iterator e_iter)
 Update the values starting at gid using elements in the given iterator range.
 
template<typename Iterator >
std::enable_if<!is_local_iterator< Iterator >::value >::type set_elements (gid_type const &gid, Iterator iter, Iterator e_iter)
 
template<typename View >
void set_elements (gid_type const &gid, View &&view)
 
size_type size (void) const
 Return the number of elements in this base container.
 
iterator begin (void)
 Construct a local iterator to the beginning of the base container. More...
 
const_iterator begin (void) const
 Construct a const local iterator to the beginning of the base container. More...
 
iterator end (void)
 Construct a local iterator to one past the end of the base container. More...
 
const_iterator end (void) const
 Construct a local iterator to one past the end of the base container that is const. More...
 
void defer (bool defer)
 

Public Types

typedef Traits::value_type value_type
 
typedef Traits::domain_type domain_type
 
typedef size_t cid_type
 
typedef domain_type::index_type gid_type
 
typedef domain_type::size_type size_type
 
typedef Traits::container_type container_type
 
typedef Traits::container_constructor container_constructor
 
typedef local_accessor< array_base_containeraccessor_t
 
typedef const_local_accessor< array_base_containerconst_accessor_t
 
typedef proxy< value_type, accessor_treference
 
typedef proxy< value_type, const_accessor_tconst_reference
 
typedef local_iterator< array_base_containeriterator
 
typedef const_local_iterator< array_base_containerconst_iterator
 
typedef base_container_metadata< array_base_containerloc_dist_metadata
 

Protected Attributes

bool m_defer_cleanup
 

Detailed Description

template<typename Traits>
class stapl::array_base_container< Traits >

The base container used for array.

See also
array
Template Parameters
TraitsA traits class that defines customizable components of the base container, such as the domain type and storage type. The default traits class is array_base_container_traits.

Constructor & Destructor Documentation

◆ array_base_container() [1/3]

template<typename Traits>
stapl::array_base_container< Traits >::array_base_container ( domain_type const &  domain,
cid_type const &  cid = index_bounds<cid_type>::invalid() 
)

Create a base container with a specific domain and ID.

Parameters
domainThe explicit domain for this base container
cidThe id for this base container

◆ array_base_container() [2/3]

template<typename Traits>
stapl::array_base_container< Traits >::array_base_container ( domain_type const &  domain,
cid_type const &  cid,
value_type const &  default_value 
)

Create a base container with a specific domain, ID and initial value.

Parameters
domainThe explicit domain for this base container
cidThe id for this base container
default_valueThe default value for all elements in the base container

◆ array_base_container() [3/3]

template<typename Traits>
stapl::array_base_container< Traits >::array_base_container ( domain_type  domain,
value_type *  extmem 
)

Create a base container with a specific domain and using a raw pointer to a block of memory that stores data.

Parameters
domainThe explicit domain for this base container
extmemA pointer to a raw chunk of memory that contains the base container's data

Member Function Documentation

◆ truncate_tail()

template<typename Traits>
void stapl::array_base_container< Traits >::truncate_tail ( gid_type const &  gid)

Truncate a base container by removing a specific GID and modifying the domain to remove from that index to the end of the container.

Parameters
gidThe GID to remove.

◆ truncate_head()

template<typename Traits>
void stapl::array_base_container< Traits >::truncate_head ( gid_type const &  gid)

Truncate a base container by removing a specific GID and modifying the domain to remove from the beginning of the container to that index.

Parameters
gidThe GID to remove.

◆ raw()

template<typename Traits>
value_type* stapl::array_base_container< Traits >::raw ( void  )

Return a raw pointer to underlying data.

◆ local_position()

template<typename Traits>
gid_type stapl::array_base_container< Traits >::local_position ( gid_type const &  gid) const

Return the local position of a global ID.

Parameters
gidThe GID for which to find the local position.

◆ make_reference() [1/2]

template<typename Traits>
reference stapl::array_base_container< Traits >::make_reference ( gid_type const &  gid)

Construct a local reference to a specific index of the base container.

Parameters
gidThe GID for which to create the reference
Returns
A proxy to the value at gid

◆ make_reference() [2/2]

template<typename Traits>
const_reference stapl::array_base_container< Traits >::make_reference ( gid_type const &  gid) const

Construct a local reference to a specific index of the base container (read only).

Parameters
gidThe GID for which to create the reference
Returns
A proxy of the value at gid

◆ make_iterator()

template<typename Traits>
iterator stapl::array_base_container< Traits >::make_iterator ( gid_type const &  gid)

Construct a local iterator to a specific index of the base container.

Parameters
gidThe GID for which to create the iterator
Returns
An iterator to the value at gid

◆ operator[]() [1/2]

template<typename Traits>
reference stapl::array_base_container< Traits >::operator[] ( gid_type const &  gid)

Construct a local reference to a specific index of the base container.

Parameters
gidThe GID for which to create the reference
Returns
A proxy of the value at gid

◆ operator[]() [2/2]

template<typename Traits>
const_reference stapl::array_base_container< Traits >::operator[] ( gid_type const &  gid) const

Construct a local reference to a specific index of the base container (read only).

Parameters
gidThe GID for which to create the reference
Returns
A proxy of the value at gid

◆ get_element() [1/2]

template<typename Traits>
value_type stapl::array_base_container< Traits >::get_element ( gid_type const &  gid)

Get the element corresponding to a specific GID.

Parameters
gidThe id associated with the element for which we want to read the value.
Returns
A copy of the element.

◆ get_element() [2/2]

template<typename Traits>
value_type stapl::array_base_container< Traits >::get_element ( gid_type const &  gid) const

Get the element corresponding to a specific GID.

Parameters
gidThe id associated with the element for which we want to read the value.
Returns
A copy of the element.

◆ get_stored_element()

template<typename Traits>
Traits::stored_type stapl::array_base_container< Traits >::get_stored_element ( gid_type const &  gid) const

Get the element corresponding to a specific GID.

This method is used in the redistribution of composed containers. It is needed to allow the distributor object to get the instance of the container_wrapper_ref for a container instance on one location and send it to another location where it will be placed in a base container by calling set_element. set_element only accepts instances of the stored type.

Parameters
gidThe id associated with the element for which we want to read the value.
Returns
A copy of the stored instance of the element.

◆ apply_set()

template<typename Traits>
template<typename F >
void stapl::array_base_container< Traits >::apply_set ( gid_type const &  gid,
F const &  f 
)

Invoke the functor provided on the element with the specified key.

Parameters
gidThe specified key.
fThe functor to apply

◆ apply_get()

template<typename Traits>
template<typename Functor >
Functor::result_type stapl::array_base_container< Traits >::apply_get ( gid_type const &  gid,
Functor const &  f 
)

Apply a function object to an element at a specific GID and return the result.

Parameters
gidThe GID associated with the element for which we want to apply the functor and read the result.
fThe functor to apply to gid
Returns
The result of applying f to the value at gid

◆ set_element()

template<typename Traits>
void stapl::array_base_container< Traits >::set_element ( gid_type const &  gid,
typename Traits::stored_type const &  t 
)

Update the value of an element at a specific GID.

Parameters
gidThe GID of the element to set.
tThe new value

◆ begin() [1/2]

template<typename Traits>
iterator stapl::array_base_container< Traits >::begin ( void  )

Construct a local iterator to the beginning of the base container.

Returns
A local iterator.

◆ begin() [2/2]

template<typename Traits>
const_iterator stapl::array_base_container< Traits >::begin ( void  ) const

Construct a const local iterator to the beginning of the base container.

Returns
A local iterator to the begin.

◆ end() [1/2]

template<typename Traits>
iterator stapl::array_base_container< Traits >::end ( void  )

Construct a local iterator to one past the end of the base container.

Returns
A local iterator to the end.

◆ end() [2/2]

template<typename Traits>
const_iterator stapl::array_base_container< Traits >::end ( void  ) const

Construct a local iterator to one past the end of the base container that is const.

Returns
A const local iterator to the end.

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