INET Framework for OMNeT++/OMNEST
inet::physicallayer::ConcatConstMapping< Operator > Class Template Reference

Defines it values by concatenating one or more Mappings to a reference Mapping. More...

#include <MappingUtils.h>

Inheritance diagram for inet::physicallayer::ConcatConstMapping< Operator >:
inet::physicallayer::ConstMapping

Public Member Functions

 ConcatConstMapping (const ConcatConstMapping &o)
 
ConcatConstMappingoperator= (const ConcatConstMapping &copy)
 ConcatConstMapping assignment operator. More...
 
void swap (ConcatConstMapping &s)
 Swaps data with another ConcatConstMapping. More...
 
template<class Iterator >
 ConcatConstMapping (ConstMapping *refMapping, Iterator first, Iterator last, bool continueOutOfRange=true, Argument::mapped_type_cref oorValue=Argument::MappedZero, Operator op=Operator())
 Initializes with the passed reference Mapping, the operator and the Mappings defined by the passed iterator. More...
 
 ConcatConstMapping (ConstMapping *refMapping, ConstMapping *other, bool continueOutOfRange=true, Argument::mapped_type_cref oorValue=Argument::MappedZero, Operator op=Operator())
 Initializes with the passed reference Mapping, the operator and another Mapping to concatenate. More...
 
virtual ~ConcatConstMapping ()
 
void addMapping (ConstMapping *m)
 Adds another Mapping to the list of Mappings to concatenate. More...
 
virtual Argument::mapped_type getValue (const Argument &pos) const override
 Returns the value of this Mapping at the position specified by the passed Argument. More...
 
MappingcreateConcatenatedMapping () const
 Returns the concatenated Mapping. More...
 
virtual ConstMappingIteratorcreateConstIterator () const override
 Returns a pointer of a new Iterator which is able to iterate over this Mapping. More...
 
virtual ConstMappingIteratorcreateConstIterator (const Argument &pos) const override
 Returns a pointer of a new Iterator which is able to iterate over the function. More...
 
virtual ConstMappingconstClone () const override
 returns a deep copy of this mapping instance. More...
 
ConstMappinggetRefMapping ()
 Returns the pointer to the reference mapping. 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 std::pair< Dimension, Argument::const_iteratorDimIteratorPair
 
typedef std::list< ConstMapping * > MappingSet
 

Protected Attributes

MappingSet mappings
 
ConstMappingrefMapping
 
bool continueOutOfRange
 
Argument::mapped_type oorValue
 
Operator op
 
- 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::ConstMapping
typedef Argument::mapped_type argument_value_t
 
typedef Argument::mapped_type_cref argument_value_cref_t
 

Detailed Description

template<class Operator>
class inet::physicallayer::ConcatConstMapping< Operator >

Defines it values by concatenating one or more Mappings to a reference Mapping.

Author
Karl Wessel

Member Typedef Documentation

template<class Operator>
typedef std::pair<Dimension, Argument::const_iterator> inet::physicallayer::ConcatConstMapping< Operator >::DimIteratorPair
protected
template<class Operator>
typedef std::list<ConstMapping *> inet::physicallayer::ConcatConstMapping< Operator >::MappingSet
protected

Constructor & Destructor Documentation

template<class Operator>
inet::physicallayer::ConcatConstMapping< Operator >::ConcatConstMapping ( const ConcatConstMapping< Operator > &  o)
inline
2522  : ConstMapping(o)
2523  , mappings(o.mappings)
2524  , refMapping(nullptr)
2525  , continueOutOfRange(o.continueOutOfRange)
2526  , oorValue(o.oorValue)
2527  , op()
2528  {}
bool continueOutOfRange
Definition: MappingUtils.h:2516
Argument::mapped_type oorValue
Definition: MappingUtils.h:2517
ConstMapping * refMapping
Definition: MappingUtils.h:2514
Operator op
Definition: MappingUtils.h:2518
ConstMapping()
Initializes the ConstMapping with a the time dimension as domain.
Definition: MappingBase.h:935
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
template<class Iterator >
inet::physicallayer::ConcatConstMapping< Operator >::ConcatConstMapping ( ConstMapping refMapping,
Iterator  first,
Iterator  last,
bool  continueOutOfRange = true,
Argument::mapped_type_cref  oorValue = Argument::MappedZero,
Operator  op = Operator() 
)
inline

Initializes with the passed reference Mapping, the operator and the Mappings defined by the passed iterator.

2574  :
2576  mappings(),
2579  oorValue(oorValue),
2580  op(op)
2581  {
2582  while (first != last) {
2583  mappings.push_back(*first);
2584  ++first;
2585  }
2586  }
const DimensionSet & getDimensionSet() const
Returns this Mappings domain as DimensionSet.
Definition: MappingBase.h:995
bool continueOutOfRange
Definition: MappingUtils.h:2516
Argument::mapped_type oorValue
Definition: MappingUtils.h:2517
ConstMapping * refMapping
Definition: MappingUtils.h:2514
Operator op
Definition: MappingUtils.h:2518
ConstMapping()
Initializes the ConstMapping with a the time dimension as domain.
Definition: MappingBase.h:935
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
inet::physicallayer::ConcatConstMapping< Operator >::ConcatConstMapping ( ConstMapping refMapping,
ConstMapping other,
bool  continueOutOfRange = true,
Argument::mapped_type_cref  oorValue = Argument::MappedZero,
Operator  op = Operator() 
)
inline

Initializes with the passed reference Mapping, the operator and another Mapping to concatenate.

2595  :
2597  mappings(),
2600  oorValue(oorValue),
2601  op(op)
2602  {
2603  mappings.push_back(other);
2604  }
const DimensionSet & getDimensionSet() const
Returns this Mappings domain as DimensionSet.
Definition: MappingBase.h:995
bool continueOutOfRange
Definition: MappingUtils.h:2516
Argument::mapped_type oorValue
Definition: MappingUtils.h:2517
ConstMapping * refMapping
Definition: MappingUtils.h:2514
Operator op
Definition: MappingUtils.h:2518
ConstMapping()
Initializes the ConstMapping with a the time dimension as domain.
Definition: MappingBase.h:935
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
virtual inet::physicallayer::ConcatConstMapping< Operator >::~ConcatConstMapping ( )
inlinevirtual
2606 { delete refMapping; }
ConstMapping * refMapping
Definition: MappingUtils.h:2514

Member Function Documentation

template<class Operator>
void inet::physicallayer::ConcatConstMapping< Operator >::addMapping ( ConstMapping m)
inline

Adds another Mapping to the list of Mappings to concatenate.

2613  {
2614  mappings.push_back(m);
2615  }
MappingSet mappings
Definition: MappingUtils.h:2513
value< double, units::m > m
Definition: Units.h:1047
template<class Operator>
virtual ConstMapping* inet::physicallayer::ConcatConstMapping< Operator >::constClone ( ) const
inlineoverridevirtual

returns a deep copy of this mapping instance.

Implements inet::physicallayer::ConstMapping.

2669  {
2670  return new ConcatConstMapping(*this);
2671  }
ConcatConstMapping(const ConcatConstMapping &o)
Definition: MappingUtils.h:2521
template<class Operator>
Mapping* inet::physicallayer::ConcatConstMapping< Operator >::createConcatenatedMapping ( ) const
inline

Returns the concatenated Mapping.

2633  {
2634  assert(!mappings.empty());
2635 
2636  MappingSet::const_iterator it = mappings.begin();
2637  const MappingSet::const_iterator itEnd = mappings.end();
2638 
2639  Mapping *result = MappingUtils::applyElementWiseOperator(*refMapping, **it, op,
2641 
2642  while (++it != itEnd) {
2643  Mapping *buf = result;
2644  result = MappingUtils::applyElementWiseOperator(*buf, **it, op,
2646  delete buf;
2647  }
2648 
2649  return result;
2650  }
bool continueOutOfRange
Definition: MappingUtils.h:2516
Argument::mapped_type oorValue
Definition: MappingUtils.h:2517
ConstMapping * refMapping
Definition: MappingUtils.h:2514
static Mapping * applyElementWiseOperator(const ConstMapping &f1, const ConstMapping &f2, const Argument &intvlStart, const Argument &intvlEnd, Operator op)
Definition: MappingUtils.h:2272
Operator op
Definition: MappingUtils.h:2518
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
virtual ConstMappingIterator* inet::physicallayer::ConcatConstMapping< Operator >::createConstIterator ( ) const
inlineoverridevirtual

Returns a pointer of a new Iterator which is able to iterate over this Mapping.

See class ConstIterator for details.

Implements inet::physicallayer::ConstMapping.

2653  {
2654  if (mappings.empty()) {
2655  return refMapping->createConstIterator();
2656  }
2657  return new ConcatConstMappingIterator(createConcatenatedMapping());
2658  }
Mapping * createConcatenatedMapping() const
Returns the concatenated Mapping.
Definition: MappingUtils.h:2632
virtual ConstMappingIterator * createConstIterator() const =0
Returns a pointer of a new Iterator which is able to iterate over this Mapping.
ConstMapping * refMapping
Definition: MappingUtils.h:2514
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
virtual ConstMappingIterator* inet::physicallayer::ConcatConstMapping< Operator >::createConstIterator ( const Argument pos) const
inlineoverridevirtual

Returns a pointer of a new Iterator which is able to iterate over the function.

The iterator starts at the passed position.

See class ConstIterator for details.

Implements inet::physicallayer::ConstMapping.

2661  {
2662  if (mappings.empty()) {
2663  return refMapping->createConstIterator(pos);
2664  }
2665  return new ConcatConstMappingIterator(createConcatenatedMapping(), pos);
2666  }
Mapping * createConcatenatedMapping() const
Returns the concatenated Mapping.
Definition: MappingUtils.h:2632
virtual ConstMappingIterator * createConstIterator() const =0
Returns a pointer of a new Iterator which is able to iterate over this Mapping.
ConstMapping * refMapping
Definition: MappingUtils.h:2514
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
ConstMapping* inet::physicallayer::ConcatConstMapping< Operator >::getRefMapping ( )
inline

Returns the pointer to the reference mapping.

2677  {
2678  return refMapping;
2679  }
ConstMapping * refMapping
Definition: MappingUtils.h:2514
template<class Operator>
virtual Argument::mapped_type inet::physicallayer::ConcatConstMapping< Operator >::getValue ( const Argument pos) const
inlineoverridevirtual

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

The complexity of this method depends on the actual implementation.

Implements inet::physicallayer::ConstMapping.

2618  {
2619  const MappingSet::const_iterator itEnd = mappings.end();
2621 
2622  for (MappingSet::const_iterator it = mappings.begin(); it != itEnd; ++it) {
2623  res = op(res, (*it)->getValue(pos));
2624  }
2625 
2626  return res;
2627  }
virtual argument_value_t getValue(const Argument &pos) const =0
Returns the value of this Mapping at the position specified by the passed Argument.
ConstMapping * refMapping
Definition: MappingUtils.h:2514
Operator op
Definition: MappingUtils.h:2518
double mapped_type
Definition: MappingBase.h:423
MappingSet mappings
Definition: MappingUtils.h:2513
template<class Operator>
ConcatConstMapping& inet::physicallayer::ConcatConstMapping< Operator >::operator= ( const ConcatConstMapping< Operator > &  copy)
inline

ConcatConstMapping assignment operator.

Parameters
copyA ConcatConstMapping of identical element and allocator types.

All the elements of copy are copied.

2537  {
2538  ConcatConstMapping tmp(copy); // All resource all allocation happens here.
2539  // If this fails the copy will throw an exception
2540  // and 'this' object is unaffected by the exception.
2541  swap(tmp);
2542  return *this;
2543  }
ConcatConstMapping(const ConcatConstMapping &o)
Definition: MappingUtils.h:2521
void swap(ConcatConstMapping &s)
Swaps data with another ConcatConstMapping.
Definition: MappingUtils.h:2553
template<class Operator>
void inet::physicallayer::ConcatConstMapping< Operator >::swap ( ConcatConstMapping< Operator > &  s)
inline

Swaps data with another ConcatConstMapping.

Parameters
sA ConcatConstMapping of the same element and allocator types.

This exchanges the elements between two ConcatConstMapping's in constant time. Note that the global std::swap() function is specialized such that std::swap(s1,s2) will feed to this function.

2554  {
2555  ConstMapping::swap(s); // swap the base class members
2556  /* Swap all D members */
2557  std::swap(mappings, s.mappings);
2558  std::swap(refMapping, s.refMapping);
2559  std::swap(continueOutOfRange, s.continueOutOfRange);
2560  std::swap(oorValue, s.oorValue);
2561  std::swap(op, s.op);
2562  }
bool continueOutOfRange
Definition: MappingUtils.h:2516
Argument::mapped_type oorValue
Definition: MappingUtils.h:2517
ConstMapping * refMapping
Definition: MappingUtils.h:2514
Operator op
Definition: MappingUtils.h:2518
value< double, units::s > s
Definition: Units.h:1049
void swap(ConstMapping &s)
Swaps data with another ConstMapping.
Definition: MappingBase.h:902
MappingSet mappings
Definition: MappingUtils.h:2513

Member Data Documentation

template<class Operator>
bool inet::physicallayer::ConcatConstMapping< Operator >::continueOutOfRange
protected
template<class Operator>
MappingSet inet::physicallayer::ConcatConstMapping< Operator >::mappings
protected
template<class Operator>
Operator inet::physicallayer::ConcatConstMapping< Operator >::op
protected
template<class Operator>
ConstMapping* inet::physicallayer::ConcatConstMapping< Operator >::refMapping
protected

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