Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
MapSequencesMethods< Container, Key, Data > Class Template Reference

Common methods to mapping containers. More...

#include <ah-dry.H>

Public Member Functions

template<template< typename > class C = Aleph::DynList>
C< Key > keys () const
 Return the domain set of container.
 
template<template< typename > class C = Aleph::DynList>
C< Data > values () const
 Return the range set of container.
 
template<template< typename > class C = Aleph::DynList>
C< Data * > values_ptr () const
 Return a container of pointers to the elements of range set of container.
 
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, Data > > items () const
 Return a container with the entire mapping.
 
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, Data * > > items_ptr () const
 Return a container with the entire mapping where the range could be modified.
 
Data & operator() (const Key &key)
 Return the image or element mapped to key.
 
const Data & operator() (const Key &key) const
 Return the image or element mapped to key.
 

Private Member Functions

const Containerconst_me () const
 

Detailed Description

template<class Container, typename Key, typename Data>
class MapSequencesMethods< Container, Key, Data >

Common methods to mapping containers.

Definition at line 1590 of file ah-dry.H.

Member Function Documentation

◆ const_me()

◆ items()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, Data > > MapSequencesMethods< Container, Key, Data >::items ( ) const
inline

Return a container with the entire mapping.

items() returns a container copy of an entire mapping. Each element of returned mapping is a pair <key, value>.

Returns
A new container, according the passed template parameter, containing all the pairs key,value of mapping.
Exceptions
bad_allocif there is no enough memory

Definition at line 1681 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ items_ptr()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
C< std::pair< Key, Data * > > MapSequencesMethods< Container, Key, Data >::items_ptr ( ) const
inline

Return a container with the entire mapping where the range could be modified.

items_ptr() returns a container copy of an entire mapping. Each element of returned mapping is a pair <key, pointer to value>.

Returns
A new container, according the passed template parameter, containing all the pairs key,pointer-value of mapping.
Exceptions
bad_allocif there is no enough memory

Definition at line 1700 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ keys()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
C< Key > MapSequencesMethods< Container, Key, Data >::keys ( ) const
inline

Return the domain set of container.

This is a template method whose unique parameter is the type of container where the domain set will be stored. By default, this type is DynList.

Often the elements of domain are called "keys" and those of codomain or range "values".

Returns
A new container, according the passed template parameter, containing all the elements of domain of mapping.
Exceptions
bad_allocif there is no enough memory

Definition at line 1613 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ operator()() [1/2]

template<class Container , typename Key , typename Data >
Data & MapSequencesMethods< Container, Key, Data >::operator() ( const Key &  key)
inline

Return the image or element mapped to key.

Returns
a modifiable reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping

Definition at line 1716 of file ah-dry.H.

◆ operator()() [2/2]

template<class Container , typename Key , typename Data >
const Data & MapSequencesMethods< Container, Key, Data >::operator() ( const Key &  key) const
inline

Return the image or element mapped to key.

Returns
a constant reference to value associated to the key.
Exceptions
domain_errorif key is not present in the mapping.

Definition at line 1726 of file ah-dry.H.

◆ values()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
C< Data > MapSequencesMethods< Container, Key, Data >::values ( ) const
inline

Return the range set of container.

This is a template method whose unique parameter is the type of container where the range set will be stored. By default this type is DynList.

Often the elements of range are called "value" and those of domain "values".

Returns
A new container, according the passed template parameter, containing all the elements of range of mapping.
Exceptions
bad_allocif there is no enough memory

Definition at line 1637 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().

◆ values_ptr()

template<class Container , typename Key , typename Data >
template<template< typename > class C = Aleph::DynList>
C< Data * > MapSequencesMethods< Container, Key, Data >::values_ptr ( ) const
inline

Return a container of pointers to the elements of range set of container.

This is a template method whose unique parameter is the type of container where the pointers set will be stored. By default this type is DynList.

Often the elements of range are called "value" and those of domain "values". This method returns a container with pointers to those elements. In this way, the value could be modified.

Returns
A new container, according the passed template parameter, containing all the pointers to elements of range of mapping.
Exceptions
bad_allocif there is no enough memory

Definition at line 1663 of file ah-dry.H.

References MapSequencesMethods< Container, Key, Data >::const_me().


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