STAPL API Reference          
Overview   Containers   Algorithms   Views   Skeletons   Run-Time System
Modules     Classes    
List of all members | Public Member Functions | Public Types
stapl::container< C, bool > Struct Template Reference

Base-class for pContainers that implements general functionality needed by containers. More...

Public Member Functions

template<typename DistSpecView >
std::enable_if<(is_distribution_view< DistSpecView >::value||detail::has_is_composed_dist_spec< DistSpecView >::value) &&is_view_based< partition_type >::value &&is_view_based< mapper_type >::value >::type redistribute (DistSpecView const &dist_view)
 Redistribute the data stored in the container to match the distribution specified by the distribution view provided. More...
 
template<typename DistSpecView >
std::enable_if<(is_distribution_view< DistSpecView >::value||detail::has_is_composed_dist_spec< DistSpecView >::value) &&is_view_based< partition_type >::value &&is_view_based< mapper_type >::value >::type redistribute (DistSpecView const *dist_view)
 Redistribute the data stored in the container to match the distribution specified by the distribution view provided. More...
 
void destroy (void)
 Used as a target method for rmis implementing one-sided destruction, as a pointer to member variable referring to the destructor cannot be initialized, per the standard. Used when container is an element of another container.
 
size_t get_num_locations (void) const
 
location_type get_location_id (void) const
 
boost::shared_ptr< C > shared_from_this ()
 
Constructors
 container (void)
 
 container (distribution_type const &distribution)
 Creates a container with the given distribution.
 
 container (directory_type const &dir, container_manager_type const &cm)
 Creates a container with the given directory and base container manager. More...
 
template<typename Reg >
 container (directory_type const &dir, container_manager_type const &cm, Reg const &reg)
 Creates a container with the given directory, base container manager, and registry. More...
 
 container (partition_type const &ps, mapper_type const &map)
 Creates a container with a given size, partition and mapper.
 
template<typename Reg >
 container (partition_type const &ps, mapper_type const &map, Reg const &reg, typename std::enable_if< !detail::has_is_composed_dist_spec< Reg >::value >::type *=0)
 Creates a container with a given size, partition and mapper. More...
 
template<typename DistSpecView , typename Reg >
 container (std::shared_ptr< DistSpecView > dist_view, Reg const &reg, typename std::enable_if< !detail::has_is_composed_dist_spec< Reg >::value >::type *=0)
 Creates a container with a given size, partition and mapper. More...
 
 container (partition_type const &ps, mapper_type const &map, value_type const &default_value)
 Creates a container with a given size, partition and mapper, constructing all elements with the default value provided.
 
template<typename DistSpecView >
 container (std::shared_ptr< DistSpecView > dist_view, typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0)
 Creates a container with the given distribution.
 
template<typename DistSpecView >
 container (std::shared_ptr< DistSpecView > dist_view, value_type const &default_value, typename std::enable_if< is_distribution_view< DistSpecView >::value &&!detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0)
 Creates a container with the given distribution, constructing all elements with the default value provided.
 
template<typename PartitionContainer >
 container (PartitionContainer const *const part_cont, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0)
 Creates a container with the distribution specified by the partitions contained in part_cont. More...
 
template<typename PartitionContainer >
 container (PartitionContainer const *const part_cont, value_type const &default_value, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0)
 Creates a container with the distribution specified by the partitions contained in part_cont, constructing all elements with the default value provided. More...
 
template<typename PartitionContainer , typename Reg >
 container (PartitionContainer const *const part_cont, Reg const &reg, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0)
 Creates a container with the distribution specified by the partitions contained in part_cont. More...
 
template<typename DistSpecView , typename ComposedSpec >
 container (std::shared_ptr< DistSpecView > dist_view, ComposedSpec const &comp_spec, typename std::enable_if< is_distribution_view< DistSpecView >::value &&detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *=0)
 Base constructor for composed containers. This constructor is invoked for the containers at the bottom of a m level composed container that has been constructed using distribution specifications. More...
 
template<typename DistSpecView , typename ComposedSpec >
 container (std::shared_ptr< DistSpecView > dist_view, ComposedSpec const &comp_spec, boost::mpl::false_ const &reg, typename std::enable_if< is_distribution_view< DistSpecView >::value &&detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *=0)
 Base constructor for composed containers. This constructor is invoked for the containers at the bottom of a m level composed container that has been constructed using distribution specifications. More...
 
Element Manipulation
void set_element (index_type const &idx, value_type const &val)
 Sets the element specified by the index to the provided value. More...
 
template<typename View >
void set_elements (index_type const &idx, View &&vals)
 Sets a range of elements starting with a given index to a sequence of provided values. More...
 
value_type get_element (index_type const &idx) const
 Returns the value of the element specified by the index. More...
 
future< value_typeget_element_split (index_type const &idx)
 Returns a stapl::future holding the value of the element specified by the index. More...
 
template<typename F >
void apply_set (gid_type const &gid, F const &f)
 Applies a function f to the element specified by the GID. More...
 
template<typename F >
F::result_type apply_get (gid_type const &gid, F const &f)
 Applies a function f to the element specified by the GID, and returns the result. More...
 
template<typename F >
F::result_type apply_get (gid_type const &gid, F const &f) const
 Applies a function f to the element specified by the GID, and returns the result. More...
 

Public Types

typedef container_traits< C >::template construct_distribution< C >::type distribution_type
 
typedef index_type gid_type
 
typedef size_t size_type
 

Memory and Domain Management

domain_type domain (void) const
 
void migrate (gid_type const &gid, location_type destination)
 Migrates the element specified by the gid to the destination location. More...
 
size_type size (void) const
 Return the number of elements in the container. More...
 
bool empty (void) const
 
distribution_type & distribution (void)
 
distribution_type const & distribution (void) const
 
distribution_type * get_distribution (void)
 
locality_info locality (gid_type gid)
 Return locality information about the element specified by the gid. More...
 
template<typename... Indices>
bool is_local (Indices const &... i) const
 Returns true if the element specified by the GID formed from the index components provided is stored on this location, or false otherwise.
 
rmi_handle::reference get_rmi_handle_reference (void)
 
template<typename DistSpecView >
std::shared_ptr< DistSpecView > get_spec (DistSpecView const &dist_view, typename std::enable_if< !detail::has_is_composed_dist_spec< DistSpecView >::value >::type *=0)
 Return a shared_ptr to the distribution specification for this container instance. More...
 
template<typename ComposedSpec >
std::shared_ptr< typename ComposedSpec::distribution_spec > get_spec (ComposedSpec const &dist_view, typename std::enable_if< detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *=0)
 Return a shared_ptr to the distribution specification for this container instance that is part of a composed container instantiation. More...
 

Detailed Description

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
struct stapl::container< C, bool >

Base-class for pContainers that implements general functionality needed by containers.

Template Parameters
Cderived container class for use with CRTP.

Constructor & Destructor Documentation

◆ container() [1/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
stapl::container< C, bool >::container ( directory_type const &  dir,
container_manager_type const &  cm 
)

Creates a container with the given directory and base container manager.

Parameters
dirThe directory for this container.
cmThe base container manager for this container.

◆ container() [2/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename Reg >
stapl::container< C, bool >::container ( directory_type const &  dir,
container_manager_type const &  cm,
Reg const &  reg 
)

Creates a container with the given directory, base container manager, and registry.

Parameters
dirThe directory for this container.
cmThe base container manager for this container.
regThe registry for this container.

◆ container() [3/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename Reg >
stapl::container< C, bool >::container ( partition_type const &  ps,
mapper_type const &  map,
Reg const &  reg,
typename std::enable_if< !detail::has_is_composed_dist_spec< Reg >::value >::type *  = 0 
)

Creates a container with a given size, partition and mapper.

The reg parameter is used by map constructors to prevent keys from being pre-registered as the container is constructed.

◆ container() [4/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename DistSpecView , typename Reg >
stapl::container< C, bool >::container ( std::shared_ptr< DistSpecView >  dist_view,
Reg const &  reg,
typename std::enable_if< !detail::has_is_composed_dist_spec< Reg >::value >::type *  = 0 
)

Creates a container with a given size, partition and mapper.

The reg parameter is used by map constructors to prevent keys from being pre-registered as the container is constructed.

◆ container() [5/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename PartitionContainer >
stapl::container< C, bool >::container ( PartitionContainer const *const  part_cont,
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *  = 0 
)

Creates a container with the distribution specified by the partitions contained in part_cont.

◆ container() [6/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename PartitionContainer >
stapl::container< C, bool >::container ( PartitionContainer const *const  part_cont,
value_type const &  default_value,
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *  = 0 
)

Creates a container with the distribution specified by the partitions contained in part_cont, constructing all elements with the default value provided.

◆ container() [7/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename PartitionContainer , typename Reg >
stapl::container< C, bool >::container ( PartitionContainer const *const  part_cont,
Reg const &  reg,
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *  = 0 
)

Creates a container with the distribution specified by the partitions contained in part_cont.

The reg parameter is used by map constructors to prevent keys from being pre-registered as the container is constructed.

◆ container() [8/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename DistSpecView , typename ComposedSpec >
stapl::container< C, bool >::container ( std::shared_ptr< DistSpecView >  dist_view,
ComposedSpec const &  comp_spec,
typename std::enable_if< is_distribution_view< DistSpecView >::value &&detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *  = 0 
)

Base constructor for composed containers. This constructor is invoked for the containers at the bottom of a m level composed container that has been constructed using distribution specifications.

Parameters
psThe partition for this container.
mapThe mapper for this container.
comp_specIgnored because there are no nested containers to initialize.

◆ container() [9/9]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename DistSpecView , typename ComposedSpec >
stapl::container< C, bool >::container ( std::shared_ptr< DistSpecView >  dist_view,
ComposedSpec const &  comp_spec,
boost::mpl::false_ const &  reg,
typename std::enable_if< is_distribution_view< DistSpecView >::value &&detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *  = 0 
)

Base constructor for composed containers. This constructor is invoked for the containers at the bottom of a m level composed container that has been constructed using distribution specifications.

Parameters
psThe partition for this container.
mapThe mapper for this container.
comp_specIgnored because there are no nested containers to initialize.
regFlag to indicate that the GIDs of the container are not to be registered. This is used for associative containers such as map.

Member Function Documentation

◆ redistribute() [1/2]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename DistSpecView >
std::enable_if< (is_distribution_view<DistSpecView>::value || detail::has_is_composed_dist_spec<DistSpecView>::value) && is_view_based<partition_type>::value && is_view_based<mapper_type>::value>::type stapl::container< C, bool >::redistribute ( DistSpecView const &  dist_view)

Redistribute the data stored in the container to match the distribution specified by the distribution view provided.

Parameters
dist_viewView-based specification of the desired distribution.
Note
The method is only available in array instances that use view_based_partition and view_based_mapper as their partition and mapper types, respectively.

◆ redistribute() [2/2]

template<typename C, bool = is_p_object< typename detail::get_nested_stored_value_type< container_traits<C> >::type>::value>
template<typename DistSpecView >
std::enable_if< (is_distribution_view<DistSpecView>::value || detail::has_is_composed_dist_spec<DistSpecView>::value) && is_view_based<partition_type>::value && is_view_based<mapper_type>::value>::type stapl::container< C, bool >::redistribute ( DistSpecView const *  dist_view)

Redistribute the data stored in the container to match the distribution specified by the distribution view provided.

Parameters
dist_viewView-based specification of the desired distribution.

This function is invoked from the proxy when nested containers are being redistributed.

Note
The method is only available in array instances that use view_based_partition and view_based_mapper as their partition and mapper types, respectively.

◆ set_element()

template<typename C>
void stapl::detail::container_impl< C >::set_element ( index_type const &  idx,
value_type const &  val 
)
inherited

Sets the element specified by the index to the provided value.

Parameters
idxGID of the element to be set.
valThe new value of the element.

◆ set_elements()

template<typename C>
template<typename View >
void stapl::detail::container_impl< C >::set_elements ( index_type const &  idx,
View &&  vals 
)
inherited

Sets a range of elements starting with a given index to a sequence of provided values.

Parameters
idxGID of start of element range to be set.
valsThe new values to be assigned to the element range.

◆ get_element()

template<typename C>
value_type stapl::detail::container_impl< C >::get_element ( index_type const &  idx) const
inherited

Returns the value of the element specified by the index.

Parameters
idxGID of the element to be retrieved.
Returns
The value of the element.

◆ get_element_split()

template<typename C>
future<value_type> stapl::detail::container_impl< C >::get_element_split ( index_type const &  idx)
inherited

Returns a stapl::future holding the value of the element specified by the index.

Parameters
idxGID of the element to be set.
Returns
The future holding the value of the element.

◆ apply_set()

template<typename C>
template<typename F >
void stapl::detail::container_impl< C >::apply_set ( gid_type const &  gid,
F const &  f 
)
inherited

Applies a function f to the element specified by the GID.

Parameters
gidThe GID of the element.
fThe Functor to apply on the element.

◆ apply_get() [1/2]

template<typename C>
template<typename F >
F::result_type stapl::detail::container_impl< C >::apply_get ( gid_type const &  gid,
F const &  f 
)
inherited

Applies a function f to the element specified by the GID, and returns the result.

Parameters
gidThe GID of the element.
fThe Functor to apply on the element.
Returns
The result of applying the functor to the element.

◆ apply_get() [2/2]

template<typename C>
template<typename F >
F::result_type stapl::detail::container_impl< C >::apply_get ( gid_type const &  gid,
F const &  f 
) const
inherited

Applies a function f to the element specified by the GID, and returns the result.

Parameters
gidThe GID of the element.
fThe Functor to apply on the element.
Returns
The result of applying the functor to the element.

◆ domain()

template<typename C>
domain_type stapl::detail::container_impl< C >::domain ( void  ) const
inherited

◆ migrate()

template<typename C>
void stapl::detail::container_impl< C >::migrate ( gid_type const &  gid,
location_type  destination 
)
inherited

Migrates the element specified by the gid to the destination location.

Parameters
gidGID of the element to be migrated.
destinationId of the location where the element is to be migrated.

◆ size()

template<typename C>
size_type stapl::detail::container_impl< C >::size ( void  ) const
inherited

Return the number of elements in the container.

This method is one-sided, If other locations may be concurrently performing operations that change their local size and the effects are desired to be observed in a deterministic way, then appropriate synchronization, e.g. a fence, may be required before or after the call to size, to enforce appropriate ordering.

◆ locality()

template<typename C>
locality_info stapl::detail::container_impl< C >::locality ( gid_type  gid)
inherited

Return locality information about the element specified by the gid.

Returns
A locality_qualifier, affinity specifier, as well as this object's handle and associated location for this affinity.

◆ get_spec() [1/2]

template<typename C>
template<typename DistSpecView >
std::shared_ptr<DistSpecView> stapl::detail::container_impl< C >::get_spec ( DistSpecView const &  dist_view,
typename std::enable_if< !detail::has_is_composed_dist_spec< DistSpecView >::value >::type *  = 0 
)
protectedinherited

Return a shared_ptr to the distribution specification for this container instance.

This function is called by redistribute when the distribution specification provided is for a single container instance instead of a collection of composed container instance.

Parameters
dist_viewInstantiation of distribution_spec that describes the target distribution for redistribute
Returns
shared_ptr to the distribution specification

◆ get_spec() [2/2]

template<typename C>
template<typename ComposedSpec >
std::shared_ptr<typename ComposedSpec::distribution_spec> stapl::detail::container_impl< C >::get_spec ( ComposedSpec const &  dist_view,
typename std::enable_if< detail::has_is_composed_dist_spec< ComposedSpec >::value >::type *  = 0 
)
protectedinherited

Return a shared_ptr to the distribution specification for this container instance that is part of a composed container instantiation.

This function is called by redistribute when the distribution specification provided is for all container instances of a composed container.

Parameters
dist_viewInstantiation of composed_dist_spec that describes the target distributions for redistribute for all container instances in a composed container
Returns
shared_ptr to the distribution specification for this container instance

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