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

The container manager is responsible for local metadata for GIDs. It knows in which local base containers GIDs reside. It also provides methods to invoke base container methods on specific GIDs, abstracting out the need for external classes to know exactly in which base container a GID is. More...

Public Member Functions

template<typename Partition , typename Mapper >
 container_manager (Partition const &partition, Mapper const &mapper)
 Constructor that initializes the initial metadata for base containers. More...
 
template<typename Partition , typename Mapper >
 container_manager (Partition const &partition, Mapper const &mapper, boost::mpl::false_)
 
template<typename Partition , typename Mapper >
 container_manager (Partition const &partition, Mapper const &mapper, value_type const &default_value)
 Constructor that initializes the initial metadata for base containers and populates containers with a default value. More...
 
template<typename PartitionContainer , typename Partition , typename Mapper >
 container_manager (PartitionContainer const *const part_cont, Partition const &partition, Mapper const &mapper, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0)
 Constructs the set of base containers required by the arbitrary distribution specified by the elements of part_cont. More...
 
template<typename PartitionContainer , typename Partition , typename Mapper >
 container_manager (PartitionContainer const *const part_cont, Partition const &partition, Mapper const &mapper, value_type const &default_value, typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *=0)
 Constructs the set of base containers required by the arbitrary distribution specified by the elements of part_cont. All elements constructed in the base containers will be initialized to default_value. More...
 
template<typename PartitionContainer , typename Partition , typename Mapper >
 container_manager (PartitionContainer const *const part_cont, Partition const &partition, Mapper const &mapper, boost::mpl::false_)
 Constructor used by associative containers to avoid creation of base containers until elements are inserted into the container. More...
 
 container_manager (container_manager const &other)
 
container_manageroperator= (container_manager const &other)
 
template<typename Partition , typename Mapper >
void redistribute (Partition const &partition, Mapper const &mapper, typename std::enable_if< is_view_based< Partition >::value &&is_view_based< Mapper >::value >::type *=0)
 Performs redistribution of the container elements into a new set of bContainers on possibly different locations to match the distribution specified by the partition and mapper provided. More...
 
size_t rank (base_container_type *bc)
 Return the global rank of this base container in the pContainer. More...
 
cid_type within (gid_type const &gid)
 Return which base container a specified GID is in. More...
 
void add_element (gid_type const &gid, value_type const &val)
 Adds an element (container element) to this base container manager. Updates metadata accordingly. More...
 
void remove_element (gid_type const &gid)
 Removes an element from this base container manager. Updates metadata accordingly. More...
 
void clear (void)
 
bool contains (gid_type const &gid) const
 Returns whether or not this base container manager is responsible for an element. More...
 
size_t num_elements (void) const
 Returns number of elements in all base containers owned by this base container manager.
 
template<typename Functor >
void apply_set (gid_type const &gid, Functor const &f)
 Applies an arbitrary functor to the element with specified GID. More...
 
template<typename Functor , typename Container >
void apply (gid_type const &gid, Functor const &f, Container *container)
 Applies a function f to the element specified by the GID. More...
 
template<typename Functor >
bool contains_apply_set (gid_type const &gid, Functor const &f)
 Applies an arbitrary functor to the element at position GID if the element exists at this location. More...
 
template<typename Functor >
boost::result_of< Functor(value_type &)>::type apply_get (gid_type const &gid, Functor const &f)
 Applies an arbitrary functor to the element with specified GID and returns the result. More...
 
template<typename Functor >
Functor::result_type apply_get (gid_type const &gid, Functor const &f) const
 Applies an arbitrary functor to the element with specified GID and returns the result. More...
 
template<typename Functor >
boost::optional< typename Functor::result_type > contains_apply_get (gid_type const &gid, Functor const &f)
 Applies an arbitrary functor to the element at position GID if the element exists at this location. More...
 
template<typename Functor >
boost::optional< typename boost::result_of< Functor(value_type &)>::type > contains_apply_get (gid_type const &gid, Functor const &f) const
 Applies an arbitrary functor to the element at position GID if the element exists at this location. More...
 
template<typename Class , typename... PMFArgs, typename... Args>
bool contains_invoke (gid_type const &gid, void(Class::*pmf)(PMFArgs...), Args &&... args)
 Invokes a base container method on the given gid if it is present on this location. More...
 
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
boost::optional< Rtn > contains_invoke (gid_type const &gid, Rtn(Class::*pmf)(PMFArgs...), Args &&... args)
 Invokes a base container method on the given gid if it is present on this location. More...
 
template<typename Class , typename... PMFArgs, typename... Args>
void invoke (gid_type const &gid, void(Class::*const pmf)(PMFArgs...), Args &&... args)
 Invoke a base container method on an element at a certain GID. The element must exist in the current base container manager. More...
 
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn invoke (gid_type const &gid, Rtn(Class::*pmf)(PMFArgs...), Args &&... args)
 Invoke a base container method on an element at a certain GID. The the result. The element must exist in the current base container manager. More...
 
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn const_invoke (gid_type const &gid, Rtn(Class::*const pmf)(PMFArgs...), Args &&... args) const
 Invoke a base container method on an element at a certain GID. The the result. The element must exist in the current base container manager. More...
 
template<typename Comparator , typename Class , typename... PMFArgs, typename... Args>
void min_invoke (Comparator const &comp, void(Class::*pmf)(PMFArgs...), Args &&... args)
 Invoke a base container method returning void on the base container that minimizes a user-defined comparator over the base containers. More...
 
template<typename Comparator , typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn min_invoke (Comparator const &comp, Rtn(Class::*pmf)(PMFArgs...), Args &&... args)
 Invoke a base container method returning void on the base container that minimizes a user-defined comparator over the base containers. More...
 

Public Types

typedef BContainer base_container_type
 
typedef Registry storage_type
 
typedef base_container_ordering ordering_type
 Type of base container ordering that will be enforced.
 
typedef ordering_type::ptr_bcontainer_type ptr_bcontainer_type
 

Public Attributes

ordering_type m_ordering
 Handle ordering amongst base containers across all locations.
 

Detailed Description

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
class stapl::container_manager< BContainer, Registry >

The container manager is responsible for local metadata for GIDs. It knows in which local base containers GIDs reside. It also provides methods to invoke base container methods on specific GIDs, abstracting out the need for external classes to know exactly in which base container a GID is.

The container manager can be seen as the local equivalent of container_directory.

Template Parameters
BContainerThe base container class.

Constructor & Destructor Documentation

◆ container_manager() [1/5]

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename Partition , typename Mapper >
stapl::container_manager< BContainer, Registry >::container_manager ( Partition const &  partition,
Mapper const &  mapper 
)

Constructor that initializes the initial metadata for base containers.

Parameters
partitionPartition object that translates GIDs to CIDs
mapperMapper object that translates CIDs to locations.

◆ container_manager() [2/5]

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename Partition , typename Mapper >
stapl::container_manager< BContainer, Registry >::container_manager ( Partition const &  partition,
Mapper const &  mapper,
value_type const &  default_value 
)

Constructor that initializes the initial metadata for base containers and populates containers with a default value.

Parameters
partitionPartition object that translates GIDs to CIDs
mapperMapper object that translates CIDs to locations.
default_valueThe initial value to populate the containers

◆ container_manager() [3/5]

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename PartitionContainer , typename Partition , typename Mapper >
stapl::container_manager< BContainer, Registry >::container_manager ( PartitionContainer const *const  part_cont,
Partition const &  partition,
Mapper const &  mapper,
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *  = 0 
)

Constructs the set of base containers required by the arbitrary distribution specified by the elements of part_cont.

The container is provided along with the partition and mapper classes to allow construction of base containers by reading directly from the container. The partition and mapper parameters are still required by the base class and manager to allow for later retrieval of elements.

Parameters
part_contContainer of arb_partition_info elements that specifies an arbitrary distribution
partitionPartition object that captures the GID to partition id mapping of the part_cont elements.
mapperMapper object that captures the partition id to location id mapping of the part_cont elements.

◆ container_manager() [4/5]

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename PartitionContainer , typename Partition , typename Mapper >
stapl::container_manager< BContainer, Registry >::container_manager ( PartitionContainer const *const  part_cont,
Partition const &  partition,
Mapper const &  mapper,
value_type const &  default_value,
typename std::enable_if< std::is_same< typename PartitionContainer::value_type, arbitrary_partition_info >::value >::type *  = 0 
)

Constructs the set of base containers required by the arbitrary distribution specified by the elements of part_cont. All elements constructed in the base containers will be initialized to default_value.

The container is provided along with the partition and mapper classes to allow construction of base containers by reading directly from the container. The partition and mapper parameters are still required by the base class and manager to allow for later retrieval of elements.

Parameters
part_contContainer of arb_partition_info elements that specifies an arbitrary distribution
partitionPartition object that captures the GID to partition id mapping of the part_cont elements
mapperMapper object that captures the partition id to location id mapping of the part_cont elements
default_valueValue assigned to each element stored in a base container

◆ container_manager() [5/5]

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename PartitionContainer , typename Partition , typename Mapper >
stapl::container_manager< BContainer, Registry >::container_manager ( PartitionContainer const *const  part_cont,
Partition const &  partition,
Mapper const &  mapper,
boost::mpl::false_   
)

Constructor used by associative containers to avoid creation of base containers until elements are inserted into the container.

Associative containers work by distributing the domain of the possible GIDs of elements that might be stored in the container. In order to avoid creating a large number of empty base containers that will not be used the constructor here does nothing.

Parameters
part_contContainer of arb_partition_info elements that specifies an arbitrary distribution
partitionPartition object that captures the GID to partition id mapping of the part_cont elements
mapperMapper object that captures the partition id to location id mapping of the part_cont elements

Member Function Documentation

◆ redistribute()

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
template<typename Partition , typename Mapper >
void stapl::container_manager< BContainer, Registry >::redistribute ( Partition const &  partition,
Mapper const &  mapper,
typename std::enable_if< is_view_based< Partition >::value &&is_view_based< Mapper >::value >::type *  = 0 
)

Performs redistribution of the container elements into a new set of bContainers on possibly different locations to match the distribution specified by the partition and mapper provided.

Parameters
partitionprovides methods necessary to map element GIDs to the ids of the partitions (bContainers) that will store them.
mapperprovides the methods necessary to map partition ids to the ids of the locations that will store the partitions.

The method is only available when view-based partition and mapper instances are used. The distributor instance is given the partition and mapper information in the constructor. The distributor function operator is given the current set of bContainers and their ordering in order to perform the redistribution.

◆ rank()

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
size_t stapl::container_manager< BContainer, Registry >::rank ( base_container_type *  bc)

Return the global rank of this base container in the pContainer.

◆ within()

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
cid_type stapl::container_manager< BContainer, Registry >::within ( gid_type const &  gid)

Return which base container a specified GID is in.

◆ add_element()

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
void stapl::container_manager< BContainer, Registry >::add_element ( gid_type const &  gid,
value_type const &  val 
)

Adds an element (container element) to this base container manager. Updates metadata accordingly.

Parameters
gidGID of the element to be added.
valValue of the element to be added.

◆ remove_element()

template<typename BContainer, typename Registry = interval_container_registry<BContainer>>
void stapl::container_manager< BContainer, Registry >::remove_element ( gid_type const &  gid)

Removes an element from this base container manager. Updates metadata accordingly.

Parameters
gidGID of the element to be removed.

◆ contains()

template<typename Registry>
bool stapl::container_manager_base< Registry >::contains ( gid_type const &  gid) const
inherited

Returns whether or not this base container manager is responsible for an element.

Parameters
gidGID for the element in question.

◆ apply_set()

template<typename Registry>
template<typename Functor >
void stapl::container_manager_base< Registry >::apply_set ( gid_type const &  gid,
Functor const &  f 
)
inherited

Applies an arbitrary functor to the element with specified GID.

Parameters
gidGID of the element on which to apply the functor
fFunctor to apply

◆ apply()

template<typename Registry>
template<typename Functor , typename Container >
void stapl::container_manager_base< Registry >::apply ( gid_type const &  gid,
Functor const &  f,
Container *  container 
)
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.

◆ contains_apply_set()

template<typename Registry>
template<typename Functor >
bool stapl::container_manager_base< Registry >::contains_apply_set ( gid_type const &  gid,
Functor const &  f 
)
inherited

Applies an arbitrary functor to the element at position GID if the element exists at this location.

Parameters
gidGID of the element on which to apply the functor.
fFunctor to apply.

◆ apply_get() [1/2]

template<typename Registry>
template<typename Functor >
boost::result_of<Functor(value_type&)>::type stapl::container_manager_base< Registry >::apply_get ( gid_type const &  gid,
Functor const &  f 
)
inherited

Applies an arbitrary functor to the element with specified GID and returns the result.

Parameters
gidGID of the element on which to apply the functor
fFunctor to apply
Returns
Result of applying the functor to the element

◆ apply_get() [2/2]

template<typename Registry>
template<typename Functor >
Functor::result_type stapl::container_manager_base< Registry >::apply_get ( gid_type const &  gid,
Functor const &  f 
) const
inherited

Applies an arbitrary functor to the element with specified GID and returns the result.

Parameters
gidGID of the element on which to apply the functor
fFunctor to apply
Returns
Result of applying the functor to the element

◆ contains_apply_get() [1/2]

template<typename Registry>
template<typename Functor >
boost::optional<typename Functor::result_type> stapl::container_manager_base< Registry >::contains_apply_get ( gid_type const &  gid,
Functor const &  f 
)
inherited

Applies an arbitrary functor to the element at position GID if the element exists at this location.

Parameters
gidGID of the element on which to apply the functor.
fFunctor to apply.

◆ contains_apply_get() [2/2]

template<typename Registry>
template<typename Functor >
boost::optional<typename boost::result_of<Functor(value_type&)>::type> stapl::container_manager_base< Registry >::contains_apply_get ( gid_type const &  gid,
Functor const &  f 
) const
inherited

Applies an arbitrary functor to the element at position GID if the element exists at this location.

Parameters
gidGID of the element on which to apply the functor.
fFunctor to apply.

◆ contains_invoke() [1/2]

template<typename Registry>
template<typename Class , typename... PMFArgs, typename... Args>
bool stapl::container_manager_base< Registry >::contains_invoke ( gid_type const &  gid,
void(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invokes a base container method on the given gid if it is present on this location.

Parameters
gidThe GID of the element to invoke the method on.
pmfA pointer to a base container's member method.
argsArguments to pmf.
Returns
True if gid was found and functor applied, otherwise return false.

◆ contains_invoke() [2/2]

template<typename Registry>
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
boost::optional<Rtn> stapl::container_manager_base< Registry >::contains_invoke ( gid_type const &  gid,
Rtn(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invokes a base container method on the given gid if it is present on this location.

Parameters
gidThe GID of the element to invoke the method on.
pmfA pointer to a base container's member method.
argsArguments to pmf.
Returns
boost::optional with result of invocation if element was found.

◆ invoke() [1/2]

template<typename Registry>
template<typename Class , typename... PMFArgs, typename... Args>
void stapl::container_manager_base< Registry >::invoke ( gid_type const &  gid,
void(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invoke a base container method on an element at a certain GID. The element must exist in the current base container manager.

Parameters
gidThe GID of the element to invoke the method on.
pmfA pointer to a base container's member method.
argsArguments to pmf.

◆ invoke() [2/2]

template<typename Registry>
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn stapl::container_manager_base< Registry >::invoke ( gid_type const &  gid,
Rtn(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invoke a base container method on an element at a certain GID. The the result. The element must exist in the current base container manager.

Parameters
gidThe GID of the element to invoke the method on.
pmfA pointer to a base container's member method.
argsArguments to pmf.
Returns
The result of invoking the function pointer.

◆ const_invoke()

template<typename Registry>
template<typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn stapl::container_manager_base< Registry >::const_invoke ( gid_type const &  gid,
Rtn(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
) const
inherited

Invoke a base container method on an element at a certain GID. The the result. The element must exist in the current base container manager.

Parameters
gidThe GID of the element to invoke the method on.
pmfA pointer to a base container's member method.
argsArguments to pmf.
Returns
The result of invoking the function pointer.

◆ min_invoke() [1/2]

template<typename Registry>
template<typename Comparator , typename Class , typename... PMFArgs, typename... Args>
void stapl::container_manager_base< Registry >::min_invoke ( Comparator const &  comp,
void(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invoke a base container method returning void on the base container that minimizes a user-defined comparator over the base containers.

Parameters
compComparator that receives two base containers and returns the more optimal of the two.
pmfA pointer to a base container's member method.
argsArguments to pmf.

◆ min_invoke() [2/2]

template<typename Registry>
template<typename Comparator , typename Class , typename Rtn , typename... PMFArgs, typename... Args>
Rtn stapl::container_manager_base< Registry >::min_invoke ( Comparator const &  comp,
Rtn(Class::*)(PMFArgs...)  pmf,
Args &&...  args 
)
inherited

Invoke a base container method returning void on the base container that minimizes a user-defined comparator over the base containers.

Parameters
compComparator that receives two base containers and returns the more optimal of the two.
pmfA pointer to a base container's member method.
argsArguments to pmf.
Returns
The result of invoking the function pointer

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