INET Framework for OMNeT++/OMNEST
inet::physicallayer::FilledUpMapping Class Reference

Takes a source ConstMapping with a domain A and a set of KeyEntries for a domain B and creates a clone of the source mapping with the domain B and the KeyEntries passed. More...

#include <MappingUtils.h>

Inheritance diagram for inet::physicallayer::FilledUpMapping:
inet::physicallayer::MultiDimMapping< Linear > inet::physicallayer::Mapping inet::physicallayer::ConstMapping

Public Types

typedef std::set< argument_value_tKeySet
 
typedef std::map< Dimension, KeySetKeyMap
 
- 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
 

Public Member Functions

 FilledUpMapping (const ConstMapping *source, const DimensionSet &dims, const KeyMap &rkeys)
 
virtual ~FilledUpMapping ()
 
virtual void appendValue (const Argument &pos, argument_value_cref_t value) override
 
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...
 
- Public Member Functions inherited from inet::physicallayer::MultiDimMapping< Linear >
 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< Linear > &o)
 Copy-constructor which assures that the sub-mappings are deep copied instead of only their the pointers. More...
 
const MultiDimMappingoperator= (const MultiDimMapping< Linear > &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...
 
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 Member Functions

void fillRefIfNecessary ()
 
 FilledUpMapping (const DimensionSet &myDims, Dimension myDim, const KeyMap &rkeys)
 
MappingcreateSubSignal () const
 
- Protected Member Functions inherited from inet::physicallayer::MultiDimMapping< Linear >
 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< Linear > &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

MappingfillRef
 
const KeyMapkeys
 
- Protected Attributes inherited from inet::physicallayer::MultiDimMapping< Linear >
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...
 

Private Member Functions

 FilledUpMapping (const FilledUpMapping &)
 Copy constructor is not allowed. More...
 
FilledUpMappingoperator= (const FilledUpMapping &)
 Assignment operator is not allowed. More...
 

Additional Inherited Members

- Protected Types inherited from inet::physicallayer::MultiDimMapping< Linear >
typedef InterpolateableMap< Linear< 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
 

Detailed Description

Takes a source ConstMapping with a domain A and a set of KeyEntries for a domain B and creates a clone of the source mapping with the domain B and the KeyEntries passed.

This class is used by "applyElementWiseOperator()"-method to be able to handle cases where the second mappings domain is a real subset of the first mappings domain (meaning the first mappings domain has the same dimensions as the seconds domain and at least one further dimension).

Author
Karl Wessel

Member Typedef Documentation

Constructor & Destructor Documentation

inet::physicallayer::FilledUpMapping::FilledUpMapping ( const FilledUpMapping )
private

Copy constructor is not allowed.

inet::physicallayer::FilledUpMapping::FilledUpMapping ( const DimensionSet myDims,
Dimension  myDim,
const KeyMap rkeys 
)
inlineprotected
2154  :
2155  MultiDimMapping<Linear>(myDims, myDim), fillRef(0), keys(rkeys)
2156  {
2158  }
const KeyMap & keys
Definition: MappingUtils.h:2125
Mapping * fillRef
Definition: MappingUtils.h:2124
void fillRefIfNecessary()
Definition: MappingUtils.h:2138
inet::physicallayer::FilledUpMapping::FilledUpMapping ( const ConstMapping source,
const DimensionSet dims,
const KeyMap rkeys 
)
inline
2170  :
2171  MultiDimMapping<Linear>(dims), fillRef(0), keys(rkeys)
2172  {
2173  ConstMappingIterator *it = source->createConstIterator();
2174 
2175  if (it->inRange()) {
2177 
2178  while (it->inRange()) {
2179  appendValue(it->getPosition(), it->getValue());
2180 
2181  if (!it->hasNext())
2182  break;
2183  it->next();
2184  }
2185  }
2186  delete it;
2187  }
const KeyMap & keys
Definition: MappingUtils.h:2125
Mapping * fillRef
Definition: MappingUtils.h:2124
virtual void appendValue(const Argument &pos, argument_value_cref_t value) override
Definition: MappingUtils.h:2197
void fillRefIfNecessary()
Definition: MappingUtils.h:2138
virtual inet::physicallayer::FilledUpMapping::~FilledUpMapping ( )
inlinevirtual
2190  {
2191  if (fillRef != 0) {
2192  delete fillRef;
2193  entries.clear();
2194  }
2195  }
Mapping * fillRef
Definition: MappingUtils.h:2124
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799

Member Function Documentation

virtual void inet::physicallayer::FilledUpMapping::appendValue ( const Argument pos,
argument_value_cref_t  value 
)
inlineoverridevirtual
2198  {
2199  if (fillRef != 0) {
2200  fillRef->appendValue(pos, value);
2201  return;
2202  }
2203  argument_value_cref_t argVal = pos.getArgValue(myDimension);
2204  auto posIt = entries.lower_bound(argVal);
2205 
2206  if (posIt == entries.end() || (entries.key_comp()(argVal, posIt->first))) {
2207  posIt = entries.insert(posIt, std::make_pair(argVal, createSubSignal()));
2208  }
2209  posIt->second->appendValue(pos, value);
2210  }
Mapping * createSubSignal() const
Definition: MappingUtils.h:2160
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:875
Mapping * fillRef
Definition: MappingUtils.h:2124
Dimension myDimension
The dimension this instance represents.
Definition: MappingUtils.h:1802
virtual void appendValue(const Argument &pos, argument_value_cref_t value)
Appends the passed value at the passed position to the mapping.
Definition: MappingBase.h:1328
interpolator_map_type entries
Stores the sub-mappings for the dimension this instance represents.
Definition: MappingUtils.h:1799
virtual MappingIterator* inet::physicallayer::FilledUpMapping::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.

Reimplemented from inet::physicallayer::MultiDimMapping< Linear >.

2213  {
2214  return new FilledUpMappingIterator(*this);
2215  }
virtual MappingIterator* inet::physicallayer::FilledUpMapping::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.

Reimplemented from inet::physicallayer::MultiDimMapping< Linear >.

2218  {
2219  return new FilledUpMappingIterator(*this, pos);
2220  }
Mapping* inet::physicallayer::FilledUpMapping::createSubSignal ( ) const
inlineprotected
2161  {
2162  const Dimension& nextDim = *(--dimensions.find(myDimension));
2163  if (nextDim == Dimension::time)
2165  else
2166  return new FilledUpMapping(dimensions, nextDim, keys);
2167  }
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
const KeyMap & keys
Definition: MappingUtils.h:2125
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
mapped_type createSubSignal() const
Internal helper method which creates a new sub-mapping for this MultiDimMapping instance.
Definition: MappingUtils.h:1866
FilledUpMapping(const FilledUpMapping &)
Copy constructor is not allowed.
void inet::physicallayer::FilledUpMapping::fillRefIfNecessary ( )
inlineprotected
2139  {
2140  const KeyMap::const_iterator itEnd = keys.end();
2141  KeyMap::const_iterator it = keys.find(myDimension);
2142 
2143  if (it == itEnd)
2144  return;
2145 
2147 
2148  const KeySet::const_iterator keyItEnd = it->second.end();
2149  for (KeySet::const_iterator keyIt = it->second.begin(); keyIt != keyItEnd; ++keyIt) {
2150  entries.insert(entries.end(), std::make_pair(*keyIt, fillRef));
2151  }
2152  }
Mapping * createSubSignal() const
Definition: MappingUtils.h:2160
const KeyMap & keys
Definition: MappingUtils.h:2125
Mapping * fillRef
Definition: MappingUtils.h:2124
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
FilledUpMapping& inet::physicallayer::FilledUpMapping::operator= ( const FilledUpMapping )
private

Assignment operator is not allowed.

Member Data Documentation

Mapping* inet::physicallayer::FilledUpMapping::fillRef
protected
const KeyMap& inet::physicallayer::FilledUpMapping::keys
protected

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