Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes

SimpleConstMapping Class Reference
[mapping - classes representing mathematical mappings]

Abstract subclass of ConstMapping which can be used as base for any ConstMapping implementation with read access of constant complexity. More...

#include <MappingBase.h>

Inherits ConstMapping.

Inherited by ConstantSimpleConstMapping, JakesFadingMapping, SimplePathlossConstMapping, and SimpleTimeConstMapping.

Collaboration diagram for SimpleConstMapping:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ConstMappingIteratorcreateConstIterator ()
 Returns a pointer of a new Iterator which is able to iterate over the Mapping.
virtual ConstMappingIteratorcreateConstIterator (const Argument &pos)
 Returns a pointer of a new Iterator which is able to iterate over the Mapping. The iterator starts at the passed position.
 SimpleConstMapping (const DimensionSet &dims)
 Initializes a not yet iterateable SimpleConstmapping with the passed DimensionSet as domain.
 SimpleConstMapping (const DimensionSet &dims, const Argument &key)
 Fully initializes this mapping with the passed position as key entry.
 SimpleConstMapping (const DimensionSet &dims, const Argument &key1, const Argument &key2)
 Fully initializes this mapping with the passed two positions as key entries.
 SimpleConstMapping (const DimensionSet &dims, const Argument &min, const Argument &max, const Argument &interval)
 Fully initializes this mapping with the key entries defined by the passed min, max and interval values.
void initializeArguments (const Argument &key)
 Initializes the key entry set with the passed position as entry.
void initializeArguments (const Argument &key1, const Argument &key2)
 Initializes the key entry set with the passed two positions as entries.
void initializeArguments (const Argument &min, const Argument &max, const Argument &interval)
 Initializes the key entry set with the passed min, max and interval-Arguments.
virtual double getValue (const Argument &pos) const =0
 Returns the value of the mapping at the passed position.
ConstMappingconstClone () const =0
 creates a clone of this mapping.

Protected Types

typedef std::set< ArgumentKeyEntrySet
 Type for a set of Arguments defining key entries.

Protected Member Functions

void createKeyEntries (const Argument &from, const Argument &to, const Argument &step, Argument &pos)
 Utility method to fill add range of key entries in the time dimension to the key entry set.
void createKeyEntries (const Argument &from, const Argument &to, const Argument &step, DimensionSet::const_iterator curDim, Argument &pos)
 Utility method to fill add range of key entries in the passed dimension (and recursively its sub dimensions) to the key entry set.

Protected Attributes

KeyEntrySet keyEntries
 A set of Arguments defining the "points of interest" an iterator should iterate over.

Detailed Description

Abstract subclass of ConstMapping which can be used as base for any ConstMapping implementation with read access of constant complexity.

Any subclass only has to implement the "getValue()" and the "clone()"-method.

The subclass has to define the "points of interest" an iterator should iterate over. This should be done either at construction time or later by calling the "initializeArguments()"-method.

The SimpleConstMapping class provides Iterator creation by using the SimpleConstMappingIterator which assumes that the underlying ConstMappings getValue()-method is fast enough to be called on every iteration step (which means constant complexity).

Author:
Karl Wessel

Definition at line 1176 of file MappingBase.h.


Constructor & Destructor Documentation

SimpleConstMapping::SimpleConstMapping ( const DimensionSet dims,
const Argument key 
) [inline]

Fully initializes this mapping with the passed position as key entry.

A SimpleConstMapping initialized by this constructor is able to return a valid ConstIterator.

Definition at line 1236 of file MappingBase.h.

References initializeArguments().

SimpleConstMapping::SimpleConstMapping ( const DimensionSet dims,
const Argument key1,
const Argument key2 
) [inline]

Fully initializes this mapping with the passed two positions as key entries.

A SimpleConstMapping initialized by this constructor is able to return a valid ConstIterator.

Definition at line 1250 of file MappingBase.h.

References initializeArguments().

                                                        :
    ConstMapping(dims){

    initializeArguments(key1, key2);
  }

SimpleConstMapping::SimpleConstMapping ( const DimensionSet dims,
const Argument min,
const Argument max,
const Argument interval 
) [inline]

Fully initializes this mapping with the key entries defined by the passed min, max and interval values.

A SimpleConstMapping initialized by this constructor is able to return a valid ConstIterator.

Definition at line 1264 of file MappingBase.h.

References initializeArguments().

                                                                                :
    ConstMapping(dims){

    initializeArguments(min, max, interval);
  }


Member Function Documentation

ConstMapping* SimpleConstMapping::constClone (  )  const [pure virtual]

creates a clone of this mapping.

This method has to be implemented by every subclass.

Implements ConstMapping.

Implemented in ConstantSimpleConstMapping, JakesFadingMapping, SimplePathlossConstMapping, and SimpleTimeConstMapping.

virtual ConstMappingIterator* SimpleConstMapping::createConstIterator (  )  [inline, virtual]

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

This method asserts that the mapping had been fully initialized.

Implements ConstMapping.

Definition at line 1207 of file MappingBase.h.

References keyEntries.

                                                      {
    return new SimpleConstMappingIterator(this, &keyEntries);
  }

virtual ConstMappingIterator* SimpleConstMapping::createConstIterator ( const Argument pos  )  [inline, virtual]

Returns a pointer of a new Iterator which is able to iterate over the Mapping. The iterator starts at the passed position.

This method asserts that the mapping had been fully initialized.

Implements ConstMapping.

Definition at line 1217 of file MappingBase.h.

References keyEntries.

                                                                         {
    return new SimpleConstMappingIterator(this, &keyEntries, pos);
  }

virtual double SimpleConstMapping::getValue ( const Argument pos  )  const [pure virtual]

Returns the value of the mapping at the passed position.

This method has to be implemented by every subclass and should only have constant complexity.

Implements ConstMapping.

Implemented in ConstantSimpleConstMapping, JakesFadingMapping, SimplePathlossConstMapping, and SimpleTimeConstMapping.

void SimpleConstMapping::initializeArguments ( const Argument min,
const Argument max,
const Argument interval 
)

Initializes the key entry set with the passed min, max and interval-Arguments.

After a call to this method this SimpleConstMapping is able to return a valid ConstIterator.

Definition at line 448 of file MappingBase.cc.

References createKeyEntries(), ConstMapping::dimensions, and keyEntries.

                                       {
  keyEntries.clear();
  DimensionSet::const_iterator dimIt = dimensions.end();
  --dimIt;
  Argument pos = min;
  if(*dimIt == Dimension::time)
    createKeyEntries(min, max, interval, pos);
  else
    createKeyEntries(min, max, interval, dimIt, pos);
}

void SimpleConstMapping::initializeArguments ( const Argument key1,
const Argument key2 
) [inline]

Initializes the key entry set with the passed two positions as entries.

Convenience method for simple mappings.

Definition at line 1288 of file MappingBase.h.

References keyEntries.

                                                                      {
    keyEntries.clear();
    keyEntries.insert(key1);
    keyEntries.insert(key2);
  }

void SimpleConstMapping::initializeArguments ( const Argument key  )  [inline]

Initializes the key entry set with the passed position as entry.

Convenience method for simple mappings.

Definition at line 1277 of file MappingBase.h.

References keyEntries.

Referenced by BasePhyLayer::getThermalNoise(), SimpleConstMapping(), and SimpleTimeConstMapping::SimpleTimeConstMapping().

                                               {
    keyEntries.clear();
    keyEntries.insert(key);
  }


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