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

Helper class which represents a linear interpolation between two other mappings. More...

#include <MappingUtils.h>

Inheritance diagram for inet::physicallayer::LinearIntplMapping:
inet::physicallayer::Mapping inet::physicallayer::ConstMapping

Public Member Functions

 LinearIntplMapping (const LinearIntplMapping &o)
 
LinearIntplMappingoperator= (const LinearIntplMapping &copy)
 
void swap (LinearIntplMapping &s)
 
 LinearIntplMapping (const ConstMapping *const left=nullptr, const ConstMapping *const right=nullptr, argument_value_cref_t f=Argument::MappedZero)
 Initializes the LinearIntplMapping with the passed left and right Mapping to interpolate by the passed interpolation value. More...
 
virtual ~LinearIntplMapping ()
 
virtual Mappingclone () const override
 Interpolated mappings are not supposed to be cloned! More...
 
virtual argument_value_t getValue (const Argument &pos) const override
 Returns the linear interpolated value of this Mapping. More...
 
virtual MappingIteratorcreateIterator () override
 An interpolated mapping doesn't have a valid "first"-entry, so this method is not supported. More...
 
virtual MappingIteratorcreateIterator (const Argument &pos) override
 Creates an iterator for this mapping starting at the passed position. More...
 
virtual void setValue (const Argument &, argument_value_cref_t) override
 This method is not supported! 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 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 Attributes

const ConstMappingleft
 The left mapping to interpolate. More...
 
const ConstMappingright
 The right mapping to interpolate. More...
 
argument_value_t factor
 The interpolation factor determining the linear interpolation between left and right mapping. More...
 
- Protected Attributes inherited from inet::physicallayer::ConstMapping
DimensionSet dimensions
 The dimensions of this mappings domain. More...
 

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

Helper class which represents a linear interpolation between two other mappings.

Author
Karl Wessel

Constructor & Destructor Documentation

inet::physicallayer::LinearIntplMapping::LinearIntplMapping ( const LinearIntplMapping o)
inline
895  : Mapping(o), left(o.left), right(o.right), factor(o.factor) {}
const ConstMapping * left
The left mapping to interpolate.
Definition: MappingUtils.h:885
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
argument_value_t factor
The interpolation factor determining the linear interpolation between left and right mapping...
Definition: MappingUtils.h:891
const ConstMapping * right
The right mapping to interpolate.
Definition: MappingUtils.h:887
inet::physicallayer::LinearIntplMapping::LinearIntplMapping ( const ConstMapping *const  left = nullptr,
const ConstMapping *const  right = nullptr,
argument_value_cref_t  f = Argument::MappedZero 
)
inline

Initializes the LinearIntplMapping with the passed left and right Mapping to interpolate by the passed interpolation value.

923  :
924  Mapping(), left(left), right(right), factor(f) {}
const ConstMapping * left
The left mapping to interpolate.
Definition: MappingUtils.h:885
Mapping()
Initializes the Mapping with the time dimension as domain.
Definition: MappingBase.h:1299
argument_value_t factor
The interpolation factor determining the linear interpolation between left and right mapping...
Definition: MappingUtils.h:891
const ConstMapping * right
The right mapping to interpolate.
Definition: MappingUtils.h:887
virtual inet::physicallayer::LinearIntplMapping::~LinearIntplMapping ( )
inlinevirtual
926 {}

Member Function Documentation

virtual Mapping* inet::physicallayer::LinearIntplMapping::clone ( ) const
inlineoverridevirtual

Interpolated mappings are not supposed to be cloned!

Implements inet::physicallayer::Mapping.

931 { assert(false); return 0; }
virtual MappingIterator* inet::physicallayer::LinearIntplMapping::createIterator ( )
inlineoverridevirtual

An interpolated mapping doesn't have a valid "first"-entry, so this method is not supported.

Implements inet::physicallayer::Mapping.

956  {
957  assert(false);
958  return 0;
959  }
virtual MappingIterator* inet::physicallayer::LinearIntplMapping::createIterator ( const Argument pos)
inlineoverridevirtual

Creates an iterator for this mapping starting at the passed position.

Note: The returned Iterator does only support a subset of the normal MappingIterator-methods. See LinearIntplMappingIterator for details.

Implements inet::physicallayer::Mapping.

970  {
971  assert(left);
972  assert(right);
973 
974  return new LinearIntplMappingIterator(left->createConstIterator(pos), right->createConstIterator(pos), factor);
975  }
const ConstMapping * left
The left mapping to interpolate.
Definition: MappingUtils.h:885
virtual ConstMappingIterator * createConstIterator() const =0
Returns a pointer of a new Iterator which is able to iterate over this Mapping.
argument_value_t factor
The interpolation factor determining the linear interpolation between left and right mapping...
Definition: MappingUtils.h:891
const ConstMapping * right
The right mapping to interpolate.
Definition: MappingUtils.h:887
virtual argument_value_t inet::physicallayer::LinearIntplMapping::getValue ( const Argument pos) const
inlineoverridevirtual

Returns the linear interpolated value of this Mapping.

The value is calculated by the following formula:

v = left + (right - left) * intplFactor

Implements inet::physicallayer::ConstMapping.

941  {
942  assert(left);
943  assert(right);
944 
947  //return v0 + (v1 - v0) * factor;
948  return v0 * (Argument::MappedOne - factor) + v1 * factor;
949  }
virtual argument_value_t getValue(const Argument &pos) const =0
Returns the value of this Mapping at the position specified by the passed Argument.
Argument::mapped_type_cref argument_value_cref_t
Definition: MappingBase.h:875
const ConstMapping * left
The left mapping to interpolate.
Definition: MappingUtils.h:885
static const mapped_type MappedOne
One value of a Argument value.
Definition: MappingBase.h:429
argument_value_t factor
The interpolation factor determining the linear interpolation between left and right mapping...
Definition: MappingUtils.h:891
const ConstMapping * right
The right mapping to interpolate.
Definition: MappingUtils.h:887
LinearIntplMapping& inet::physicallayer::LinearIntplMapping::operator= ( const LinearIntplMapping copy)
inline
898  {
899  LinearIntplMapping tmp(copy); // All resource all allocation happens here.
900  // If this fails the copy will throw an exception
901  // and 'this' object is unaffected by the exception.
902  swap(tmp);
903  return *this;
904  }
void swap(LinearIntplMapping &s)
Definition: MappingUtils.h:908
LinearIntplMapping(const LinearIntplMapping &o)
Definition: MappingUtils.h:894
virtual void inet::physicallayer::LinearIntplMapping::setValue ( const Argument ,
argument_value_cref_t   
)
inlineoverridevirtual

This method is not supported!

Implements inet::physicallayer::Mapping.

980 { assert(false); }
void inet::physicallayer::LinearIntplMapping::swap ( LinearIntplMapping s)
inline
909  {
910  Mapping::swap(s); // swap the base class members
911  /* Swap all D members */
912  std::swap(left, s.left);
913  std::swap(right, s.right);
914  std::swap(factor, s.factor);
915  }
const ConstMapping * left
The left mapping to interpolate.
Definition: MappingUtils.h:885
void swap(Mapping &s)
Swaps data with another Mapping.
Definition: MappingBase.h:1280
value< double, units::s > s
Definition: Units.h:1049
argument_value_t factor
The interpolation factor determining the linear interpolation between left and right mapping...
Definition: MappingUtils.h:891
const ConstMapping * right
The right mapping to interpolate.
Definition: MappingUtils.h:887

Member Data Documentation

argument_value_t inet::physicallayer::LinearIntplMapping::factor
protected

The interpolation factor determining the linear interpolation between left and right mapping.

Referenced by swap().

const ConstMapping* inet::physicallayer::LinearIntplMapping::left
protected

The left mapping to interpolate.

Referenced by swap().

const ConstMapping* inet::physicallayer::LinearIntplMapping::right
protected

The right mapping to interpolate.

Referenced by swap().


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