INET Framework for OMNeT++/OMNEST
inet::physicallayer::MultiDimMapping< Interpolator > Class Template Reference

Implementation of the Mapping-interface which is able to represent arbitrary dimensional instances of Mappings by using a tree-like structure of sub-mappings, each representing the values for one of the dimensions. More...

#include <MappingUtils.h>

Inheritance diagram for inet::physicallayer::MultiDimMapping< Interpolator >:
inet::physicallayer::Mapping inet::physicallayer::ConstMapping

Public Member Functions

 MultiDimMapping (const DimensionSet &myDims)
 Initializes the Mapping with the passed DimensionSet as domain. More...
 
 MultiDimMapping (const DimensionSet &myDims, argument_value_cref_t oorv)
 Initializes the Mapping with the passed DimensionSet as domain. More...
 
 MultiDimMapping (const MultiDimMapping< Interpolator > &o)
 Copy-constructor which assures that the sub-mappings are deep copied instead of only their the pointers. More...
 
const MultiDimMappingoperator= (const MultiDimMapping< Interpolator > &o)
 Copy operator which assures that the sub-mappings are deep copied instead of only their the pointers. More...
 
virtual Mappingclone () const override
 returns a deep copy of this mapping instance. More...
 
virtual ~MultiDimMapping ()
 Frees the memory for the sub mappings. More...
 
virtual argument_value_t getValue (const Argument &pos) const override
 Returns the value of this Mapping at position specified by the passed Argument. More...
 
virtual void setValue (const Argument &pos, argument_value_cref_t value) override
 Changes the value of the Mapping at the specified position. More...
 
virtual MappingIteratorcreateIterator () override
 Returns a pointer of a new Iterator which is able to iterate over the Mapping and can change the value the iterator points to. More...
 
virtual MappingIteratorcreateIterator (const Argument &pos) override
 Returns a pointer of a new Iterator which is able to iterate over the Mapping and can change the value the iterator points to. More...
 
Dimension getDimension ()
 Returns the dimension this instance represents. More...
 
- Public Member Functions inherited from inet::physicallayer::Mapping
Mappingoperator= (const Mapping &copy)
 Mapping assignment operator. More...
 
void swap (Mapping &s)
 Swaps data with another Mapping. More...
 
 Mapping (const DimensionSet &dims)
 Initializes the Mapping with the passed DimensionSet as domain. More...
 
 Mapping ()
 Initializes the Mapping with the time dimension as domain. More...
 
 Mapping (const Mapping &o)
 
virtual ~Mapping ()
 
virtual void setValue (const Argument &pos, argument_value_cref_t value)=0
 Changes the value of the Mapping at the specified position. More...
 
virtual void appendValue (const Argument &pos, argument_value_cref_t value)
 Appends the passed value at the passed position to the mapping. More...
 
virtual ConstMappingIteratorcreateConstIterator () const override
 Returns an ConstMappingIterator by use of the respective implementation of the "createIterator()"-method. More...
 
virtual ConstMappingIteratorcreateConstIterator (const Argument &pos) const override
 Returns an ConstMappingIterator by use of the respective implementation of the "createIterator()"-method. More...
 
virtual ConstMappingconstClone () const override
 Returns a deep const copy of this mapping by using the according "clone()"-implementation. More...
 
- Public Member Functions inherited from inet::physicallayer::ConstMapping
ConstMappingoperator= (const ConstMapping &copy)
 ConstMapping assignment operator. More...
 
void swap (ConstMapping &s)
 Swaps data with another ConstMapping. More...
 
 ConstMapping ()
 Initializes the ConstMapping with a the time dimension as domain. More...
 
 ConstMapping (const ConstMapping &o)
 
 ConstMapping (const DimensionSet &dimSet)
 Initializes the ConstMapping with the passed DimensionSet as Domain. More...
 
virtual ~ConstMapping ()
 
argument_value_t operator[] (const Argument &pos) const
 Returns the value of this Mapping at the position specified by the passed Argument. More...
 
const DimensionSetgetDimensionSet () const
 Returns this Mappings domain as DimensionSet. More...
 
template<class stream >
stream & print (stream &out, argument_value_cref_t lTimeScale=argument_value_t(1), argument_value_cref_t lLeftColScale=Argument::MappedOne, const std::string &sTableHead=std::string("o\\ms"), const Dimension *const pOnlyDim=nullptr) const
 Prints the Mapping to an output stream. More...
 

Protected Types

typedef InterpolateableMap< Interpolator< std::map< argument_value_t, Mapping * > > > interpolator_map_type
 The templated InterpolateableMap the underlying Mapping uses std::map as storage type. More...
 
typedef interpolator_map_type::interpolator_type interpolator_type
 
typedef interpolator_map_type::mapped_type mapped_type
 
typedef interpolator_map_type::mapped_cref_type mapped_cref_type
 
typedef interpolator_map_type::iterator_intpl iterator
 
typedef interpolator_map_type::const_iterator_intpl const_iterator
 

Protected Member Functions

 MultiDimMapping (const DimensionSet &myDims, Dimension myDim)
 Initializes the Mapping with the passed DimensionSet as domain and the passed dimension as the dimension this instance should represent. More...
 
 MultiDimMapping (const DimensionSet &myDims, Dimension myDim, ConstantSimpleConstMapping *oorm, ConstMappingWrapper *wrappedoorm)
 Initializes the Mapping with the passed DimensionSet as domain and the passed dimension as the dimension this instance should represent. More...
 
 MultiDimMapping (const MultiDimMapping< Interpolator > &o, ConstantSimpleConstMapping *oorm, ConstMappingWrapper *wrappedoorm)
 Intern copy-constructor which assures that the sub-mappings are deep copied instead of only their pointers. More...
 
mapped_type createSubSignal () const
 Internal helper method which creates a new sub-mapping for this MultiDimMapping instance. More...
 
void copySubMappings ()
 

Protected Attributes

ConstantSimpleConstMappingoutOfRangeMapping
 Returned by the Interpolator if the mapping is accessed outside its range (before or after the last key entry in a dimension). More...
 
ConstMappingWrapperwrappedOORMapping
 Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping which setValue method is asserted to never be called. More...
 
interpolator_map_type entries
 Stores the sub-mappings for the dimension this instance represents. More...
 
Dimension myDimension
 The dimension this instance represents. More...
 
bool isMaster
 
- Protected Attributes inherited from inet::physicallayer::ConstMapping
DimensionSet dimensions
 The dimensions of this mappings domain. More...
 

Friends

class MultiDimMappingIterator< Interpolator >
 

Additional Inherited Members

- Public Types inherited from inet::physicallayer::Mapping
enum  InterpolationMethod { STEPS, NEAREST, LINEAR }
 Types of interpolation methods for mappings. More...
 
- Public Types inherited from inet::physicallayer::ConstMapping
typedef Argument::mapped_type argument_value_t
 
typedef Argument::mapped_type_cref argument_value_cref_t
 

Detailed Description

template<template< typename > class Interpolator>
class inet::physicallayer::MultiDimMapping< Interpolator >

Implementation of the Mapping-interface which is able to represent arbitrary dimensional instances of Mappings by using a tree-like structure of sub-mappings, each representing the values for one of the dimensions.

This class internally uses a map of Mappings two represent one dimension. Where every Mapping in the map represents a sub-mapping for the values in the next dimension at that position in the this dimension. These sub-mappings can either be in turn MultiDimMappings with further sub-mappings or they can be TimedMappings if their dimension is the time. The TimedMappings therefore represent the leafs of the tree-like structure.

Author
Karl Wessel

Member Typedef Documentation

template<template< typename > class Interpolator>
typedef interpolator_map_type::const_iterator_intpl inet::physicallayer::MultiDimMapping< Interpolator >::const_iterator
protected
template<template< typename > class Interpolator>
typedef InterpolateableMap<Interpolator<std::map<argument_value_t, Mapping *> > > inet::physicallayer::MultiDimMapping< Interpolator >::interpolator_map_type
protected

The templated InterpolateableMap the underlying Mapping uses std::map as storage type.

template<template< typename > class Interpolator>
typedef interpolator_map_type::interpolator_type inet::physicallayer::MultiDimMapping< Interpolator >::interpolator_type
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::iterator_intpl inet::physicallayer::MultiDimMapping< Interpolator >::iterator
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::mapped_cref_type inet::physicallayer::MultiDimMapping< Interpolator >::mapped_cref_type
protected
template<template< typename > class Interpolator>
typedef interpolator_map_type::mapped_type inet::physicallayer::MultiDimMapping< Interpolator >::mapped_type
protected

Constructor & Destructor Documentation

template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const DimensionSet myDims,
Dimension  myDim 
)
inlineprotected

Initializes the Mapping with the passed DimensionSet as domain and the passed dimension as the dimension this instance should represent.

Also takes the interpolation method to use, but not yet implemented.

This constructor is only used internally to create the sub-mappings.

1817  :
1818  Mapping(myDims),
1819  outOfRangeMapping(0),
1820  wrappedOORMapping(0),
1821  entries(),
1822  myDimension(myDim),
1823  isMaster(false) {}
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const DimensionSet myDims,
Dimension  myDim,
ConstantSimpleConstMapping oorm,
ConstMappingWrapper wrappedoorm 
)
inlineprotected

Initializes the Mapping with the passed DimensionSet as domain and the passed dimension as the dimension this instance should represent.

Also takes the interpolation method to use, but not yet implemented.

This constructor is only used internally to create the sub-mappings.

1835  :
1836  Mapping(myDims),
1837  outOfRangeMapping(oorm),
1838  wrappedOORMapping(wrappedoorm),
1840  myDimension(myDim),
1841  isMaster(false) {}
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const MultiDimMapping< Interpolator > &  o,
ConstantSimpleConstMapping oorm,
ConstMappingWrapper wrappedoorm 
)
inlineprotected

Intern copy-constructor which assures that the sub-mappings are deep copied instead of only their pointers.

1849  :
1850  Mapping(o),
1851  outOfRangeMapping(oorm),
1852  wrappedOORMapping(wrappedoorm),
1853  entries(o.entries),
1854  myDimension(o.myDimension),
1855  isMaster(false)
1856  {
1858 
1859  copySubMappings();
1860  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
void copySubMappings()
Definition: MappingUtils.h:1883
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
void setOutOfRangeVal(mapped_cref_type oorv)
Definition: Interpolation.h:882
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const DimensionSet myDims)
inline

Initializes the Mapping with the passed DimensionSet as domain.

Also takes the interpolation-method but is not used yet.

1911  :
1912  Mapping(myDims),
1913  outOfRangeMapping(0),
1914  wrappedOORMapping(0),
1915  entries(),
1916  myDimension(),
1917  isMaster(true)
1918  {
1919  myDimension = *(dimensions.rbegin());
1920  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
reverse_iterator rbegin()
Definition: MappingBase.h:318
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const DimensionSet myDims,
argument_value_cref_t  oorv 
)
inline

Initializes the Mapping with the passed DimensionSet as domain.

Also takes the interpolation-method but is not used yet.

1927  :
1928  Mapping(myDims),
1929  outOfRangeMapping(new ConstantSimpleConstMapping(myDims, oorv)),
1930  wrappedOORMapping(new ConstMappingWrapper(outOfRangeMapping)),
1932  myDimension(),
1933  isMaster(true)
1934  {
1935  myDimension = *(dimensions.rbegin());
1936  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
reverse_iterator rbegin()
Definition: MappingBase.h:318
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
inet::physicallayer::MultiDimMapping< Interpolator >::MultiDimMapping ( const MultiDimMapping< Interpolator > &  o)
inline

Copy-constructor which assures that the sub-mappings are deep copied instead of only their the pointers.

1942  :
1943  Mapping(o),
1944  outOfRangeMapping(o.outOfRangeMapping),
1945  wrappedOORMapping(o.wrappedOORMapping),
1946  entries(o.entries),
1947  myDimension(o.myDimension),
1948  isMaster(true)
1949  {
1950  if (outOfRangeMapping != 0) {
1951  outOfRangeMapping = new ConstantSimpleConstMapping(dimensions, o.outOfRangeMapping->getValue());
1952  wrappedOORMapping = new ConstMappingWrapper(outOfRangeMapping);
1953  entries.setOutOfRangeVal(wrappedOORMapping);
1954  }
1955  copySubMappings();
1956  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
void copySubMappings()
Definition: MappingUtils.h:1883
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
void setOutOfRangeVal(mapped_cref_type oorv)
Definition: Interpolation.h:882
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
virtual inet::physicallayer::MultiDimMapping< Interpolator >::~MultiDimMapping ( )
inlinevirtual

Frees the memory for the sub mappings.

1997  {
1998  const typename interpolator_map_type::const_iterator itEnd = entries.end();
1999  for (typename interpolator_map_type::const_iterator it = entries.begin(); it != itEnd; ++it) {
2000  if (it->second)
2001  delete it->second;
2002  }
2003 
2004  if (isMaster) {
2005  if (outOfRangeMapping)
2006  delete outOfRangeMapping;
2007  if (wrappedOORMapping)
2008  delete wrappedOORMapping;
2009  }
2010  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
base_class_type::const_iterator const_iterator
Definition: Interpolation.h:864
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790

Member Function Documentation

template<template< typename > class Interpolator>
virtual Mapping* inet::physicallayer::MultiDimMapping< Interpolator >::clone ( ) const
inlineoverridevirtual

returns a deep copy of this mapping instance.

Implements inet::physicallayer::Mapping.

1991 { return new MultiDimMapping<Interpolator>(*this); }
template<template< typename > class Interpolator>
void inet::physicallayer::MultiDimMapping< Interpolator >::copySubMappings ( )
inlineprotected
1884  {
1885  const auto itEnd = entries.end();
1886  Dimension nextDim = *(--dimensions.find(myDimension));
1887 
1888  if (nextDim == Dimension::time) {
1889  for (auto it = entries.begin(); it != itEnd; ++it) {
1890  it->second = new TimeMapping<Interpolator>(*(static_cast<TimeMapping<Interpolator> *>(it->second)));
1891  }
1892  }
1893  else {
1894  for (auto it = entries.begin(); it != itEnd; ++it) {
1895  if (outOfRangeMapping == 0) {
1896  it->second = new MultiDimMapping<Interpolator>(*(static_cast<MultiDimMapping<Interpolator> *>(it->second)));
1897  }
1898  else {
1899  it->second = new MultiDimMapping<Interpolator>(*(static_cast<MultiDimMapping<Interpolator> *>(it->second)), outOfRangeMapping, wrappedOORMapping);
1900  }
1901  }
1902  }
1903  }
static const Dimension time
Shortcut to the time Dimension, same as &#39;Dimension("time")&#39;, but spares the parsing of a string...
Definition: MappingBase.h:64
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
const_iterator find(const value_type &__x) const
Definition: MappingBase.h:338
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
virtual MappingIterator* inet::physicallayer::MultiDimMapping< Interpolator >::createIterator ( )
inlineoverridevirtual

Returns a pointer of a new Iterator which is able to iterate over the Mapping and can change the value the iterator points to.

The caller of this method has to delete the Iterator if not needed anymore.

Implements inet::physicallayer::Mapping.

Reimplemented in inet::physicallayer::FilledUpMapping.

2057  {
2058  return new MultiDimMappingIterator<Interpolator>(*this);
2059  }
friend class MultiDimMappingIterator< Interpolator >
Definition: MappingUtils.h:1806
template<template< typename > class Interpolator>
virtual MappingIterator* inet::physicallayer::MultiDimMapping< Interpolator >::createIterator ( const Argument pos)
inlineoverridevirtual

Returns a pointer of a new Iterator which is able to iterate over the Mapping and can change the value the iterator points to.

The caller of this method has to delete the Iterator if not needed anymore.

Implements inet::physicallayer::Mapping.

Reimplemented in inet::physicallayer::FilledUpMapping.

2069  {
2070  return new MultiDimMappingIterator<Interpolator>(*this, pos);
2071  }
friend class MultiDimMappingIterator< Interpolator >
Definition: MappingUtils.h:1806
template<template< typename > class Interpolator>
mapped_type inet::physicallayer::MultiDimMapping< Interpolator >::createSubSignal ( ) const
inlineprotected

Internal helper method which creates a new sub-mapping for this MultiDimMapping instance.

Referenced by inet::physicallayer::FilledUpMapping::createSubSignal(), and inet::physicallayer::MultiDimMappingIterator< Linear >::setValue().

1867  {
1868  const Dimension& nextDim = *(--dimensions.find(myDimension));
1869  if (wrappedOORMapping == 0) {
1870  if (nextDim == Dimension::time)
1871  return new TimeMapping<Interpolator>();
1872  else
1873  return new MultiDimMapping<Interpolator>(dimensions, nextDim);
1874  }
1875  else {
1876  if (nextDim == Dimension::time)
1877  return new TimeMapping<Interpolator>(outOfRangeMapping->getValue());
1878  else
1879  return new MultiDimMapping<Interpolator>(dimensions, nextDim, outOfRangeMapping, wrappedOORMapping);
1880  }
1881  }
static const Dimension time
Shortcut to the time Dimension, same as &#39;Dimension("time")&#39;, but spares the parsing of a string...
Definition: MappingBase.h:64
virtual argument_value_t getValue(const Argument &) const override
Returns the value of this Mapping at the position specified by the passed Argument.
Definition: MappingUtils.h:1228
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
const_iterator find(const value_type &__x) const
Definition: MappingBase.h:338
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
Dimension inet::physicallayer::MultiDimMapping< Interpolator >::getDimension ( )
inline

Returns the dimension this instance represents.

2076 { return myDimension; }
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
template<template< typename > class Interpolator>
virtual argument_value_t inet::physicallayer::MultiDimMapping< Interpolator >::getValue ( const Argument pos) const
inlineoverridevirtual

Returns the value of this Mapping at position specified by the passed Argument.

Has logarithmic complexity over the number of dimensions and the number of entries per dimension.

Implements inet::physicallayer::ConstMapping.

2020  {
2021  assert(pos.hasArgVal(myDimension));
2022  argument_value_cref_t argVal = pos.getArgValue(myDimension);
2024 
2025  if (!(*subM))
2026  return Argument::MappedZero;
2027 
2028  return (*subM)->getValue(pos);
2029  }
static const mapped_type MappedZero
Zero value of a Argument value.
Definition: MappingBase.h:427
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:875
interpolator_type::interpolated interpolated
typedef for the returned Interpolated value of this class.
Definition: Interpolation.h:863
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
interpolated getIntplValue(key_cref_type pos) const
Definition: Interpolation.h:887
template<template< typename > class Interpolator>
const MultiDimMapping& inet::physicallayer::MultiDimMapping< Interpolator >::operator= ( const MultiDimMapping< Interpolator > &  o)
inline

Copy operator which assures that the sub-mappings are deep copied instead of only their the pointers.

1963  {
1964  const typename interpolator_map_type::const_iterator itEnd = entries.end();
1965  for (typename interpolator_map_type::const_iterator it = entries.begin(); it != itEnd; ++it) {
1966  if (it->second)
1967  delete it->second;
1968  }
1969 
1970  dimensions = o.dimensions;
1971  entries = o.entries;
1972  myDimension = o.myDimension;
1973  outOfRangeMapping = o.outOfRangeMapping;
1974  wrappedOORMapping = o.wrappedOORMapping;
1975  isMaster = true;
1976 
1977  if (outOfRangeMapping != 0) {
1978  outOfRangeMapping = new ConstantSimpleConstMapping(dimensions, o.outOfRangeMapping->getValue());
1979  wrappedOORMapping = new ConstMappingWrapper(outOfRangeMapping);
1980  entries.setOutOfRangeVal(wrappedOORMapping);
1981  }
1982 
1983  copySubMappings();
1984 
1985  return *this;
1986  }
ConstMappingWrapper * wrappedOORMapping
Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping whi...
Definition: MappingUtils.h:1796
base_class_type::const_iterator const_iterator
Definition: Interpolation.h:864
DimensionSet dimensions
The dimensions of this mappings domain.
Definition: MappingBase.h:879
void copySubMappings()
Definition: MappingUtils.h:1883
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
void setOutOfRangeVal(mapped_cref_type oorv)
Definition: Interpolation.h:882
bool isMaster
Definition: MappingUtils.h:1804
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
ConstantSimpleConstMapping * outOfRangeMapping
Returned by the Interpolator if the mapping is accessed outside its range (before or after the last k...
Definition: MappingUtils.h:1790
template<template< typename > class Interpolator>
virtual void inet::physicallayer::MultiDimMapping< Interpolator >::setValue ( const Argument pos,
argument_value_cref_t  value 
)
inlineoverridevirtual

Changes the value of the Mapping at the specified position.

Has logarithmic complexity over the number of dimensions and the number of entries per dimension.

2039  {
2040  argument_value_cref_t argVal = pos.getArgValue(myDimension);
2041  auto posIt = entries.lower_bound(argVal);
2042 
2043  if (posIt == entries.end() || (entries.key_comp()(argVal, posIt->first))) {
2044  posIt = entries.insert(posIt, std::make_pair(argVal, createSubSignal()));
2045  }
2046  posIt->second->setValue(pos, value);
2047  }
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:875
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
mapped_type createSubSignal() const
Internal helper method which creates a new sub-mapping for this MultiDimMapping instance.
Definition: MappingUtils.h:1866

Friends And Related Function Documentation

template<template< typename > class Interpolator>
friend class MultiDimMappingIterator< Interpolator >
friend

Member Data Documentation

template<template< typename > class Interpolator>
interpolator_map_type inet::physicallayer::MultiDimMapping< Interpolator >::entries
protected

Stores the sub-mappings for the dimension this instance represents.

Referenced by inet::physicallayer::MultiDimMapping< Linear >::operator=().

template<template< typename > class Interpolator>
bool inet::physicallayer::MultiDimMapping< Interpolator >::isMaster
protected
template<template< typename > class Interpolator>
ConstantSimpleConstMapping* inet::physicallayer::MultiDimMapping< Interpolator >::outOfRangeMapping
protected

Returned by the Interpolator if the mapping is accessed outside its range (before or after the last key entry in a dimension).

Referenced by inet::physicallayer::MultiDimMapping< Linear >::MultiDimMapping(), and inet::physicallayer::MultiDimMapping< Linear >::operator=().

template<template< typename > class Interpolator>
ConstMappingWrapper* inet::physicallayer::MultiDimMapping< Interpolator >::wrappedOORMapping
protected

Wraps the out of range mapping which is an instance of ConstMapping inside an instance of Mapping which setValue method is asserted to never be called.

Referenced by inet::physicallayer::MultiDimMapping< Linear >::operator=().


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