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

Represents a set of dimensions which is used to define over which dimensions a mapping is defined (the domain of the mapping). More...

#include <MappingBase.h>

Public Types

typedef _Base::value_type value_type
 
typedef _Base::iterator iterator
 
typedef _Base::reverse_iterator reverse_iterator
 
typedef _Base::reverse_iterator const_reverse_iterator
 
typedef _Base::const_iterator const_iterator
 
typedef _Base::size_type size_type
 
typedef _Base::const_reference const_reference
 

Public Member Functions

 DimensionSet ()
 Default constructor creates an empty DimensionSet. More...
 
 DimensionSet (const DimensionSet &o)
 Copy constructor. More...
 
DimensionSetoperator= (DimensionSet const &copy)
 DimensionSet assignment operator. More...
 
void swap (DimensionSet &s)
 Swaps data with another DimensionSet. More...
 
 DimensionSet (const DimensionSet::value_type &d)
 Creates a new DimensionSet with the passed Dimension as initial Dimension. More...
 
 DimensionSet (const DimensionSet::value_type &d1, const DimensionSet::value_type &d2)
 Creates a new DimensionSet with the passed Dimensions as initial Dimensions (convenience method) More...
 
 DimensionSet (const DimensionSet::value_type &d1, const DimensionSet::value_type &d2, const DimensionSet::value_type &d3)
 Creates a new DimensionSet with the passed Dimensions as initial Dimensions (convenience method) More...
 
bool isSubSet (const DimensionSet &other) const
 Returns true if the passed DimensionSet is a subset of this DimensionSet. More...
 
bool isRealSubSet (const DimensionSet &other) const
 Returns true if the passed DimensionSet is a real subset of this DimensionSet. More...
 
void addDimension (const DimensionSet::value_type &d)
 Adds the passed dimension to the DimensionSet. More...
 
bool hasDimension (const DimensionSet::value_type &d) const
 Returns true if the passed Dimension is inside this DimensionSet. More...
 
bool operator== (const DimensionSet &o) const
 Returns true if the dimensions of both sets are equal. More...
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
reverse_iterator rbegin ()
 
reverse_iterator rend ()
 
const_reverse_iterator rbegin () const
 
const_reverse_iterator rend () const
 
const_iterator find (const value_type &__x) const
 
size_type size () const
 Returns the size of the DimensionSet. More...
 
template<typename _InputIterator >
void insert (_InputIterator __first, _InputIterator __last)
 A template function that attempts to insert a range of elements. More...
 
iterator insert (const_iterator __position, const value_type &__x)
 Attempts to insert an element into the DimensionSet. More...
 
bool empty () const
 Returns true if the DimensionSet is empty. More...
 

Static Public Attributes

static const DimensionSet timeDomain
 Shortcut to a DimensionSet which only contains time. More...
 
static const DimensionSet freqDomain
 Shortcut to a DimensionSet which only contains frequency. More...
 
static const DimensionSet timeFreqDomain
 Shortcut to a DimensionSet which contains time and frequency. More...
 

Protected Types

typedef std::set< Dimension_Base
 

Protected Attributes

_Base Storage
 

Friends

std::ostream & operator<< (std::ostream &out, const DimensionSet &d)
 Output operator for a dimension. More...
 

Detailed Description

Represents a set of dimensions which is used to define over which dimensions a mapping is defined (the domain of the mapping).

This class actually public extends from std::set<Dimension>. So any method provided by std::set can be also used.

The dimensions are stored ordered by their ids.

Note: Unlike Arguments and Mappings, a DimensionSet does not contain "time" as dimension per default. You'll have to add it like any other dimension.

Author
Karl Wessel

Member Typedef Documentation

typedef _Base::reverse_iterator inet::physicallayer::DimensionSet::reverse_iterator

Constructor & Destructor Documentation

inet::physicallayer::DimensionSet::DimensionSet ( )
inline

Default constructor creates an empty DimensionSet.

170 : Storage() {}
_Base Storage
Definition: MappingBase.h:146
inet::physicallayer::DimensionSet::DimensionSet ( const DimensionSet o)
inline

Copy constructor.

175  : Storage(o.Storage)
176  {}
_Base Storage
Definition: MappingBase.h:146
inet::physicallayer::DimensionSet::DimensionSet ( const DimensionSet::value_type d)
inline

Creates a new DimensionSet with the passed Dimension as initial Dimension.

212  : Storage()
213  {
214  Storage.insert(d);
215  }
_Base Storage
Definition: MappingBase.h:146
inet::physicallayer::DimensionSet::DimensionSet ( const DimensionSet::value_type d1,
const DimensionSet::value_type d2 
)
inline

Creates a new DimensionSet with the passed Dimensions as initial Dimensions (convenience method)

221  : Storage()
222  {
223  Storage.insert(d1);
224  Storage.insert(d2);
225  }
_Base Storage
Definition: MappingBase.h:146
inet::physicallayer::DimensionSet::DimensionSet ( const DimensionSet::value_type d1,
const DimensionSet::value_type d2,
const DimensionSet::value_type d3 
)
inline

Creates a new DimensionSet with the passed Dimensions as initial Dimensions (convenience method)

231  : Storage()
232  {
233  Storage.insert(d1);
234  Storage.insert(d2);
235  Storage.insert(d3);
236  }
_Base Storage
Definition: MappingBase.h:146

Member Function Documentation

void inet::physicallayer::DimensionSet::addDimension ( const DimensionSet::value_type d)
inline
iterator inet::physicallayer::DimensionSet::begin ( )
inline

Referenced by inet::physicallayer::Argument::Argument(), isRealSubSet(), operator==(), and inet::physicallayer::ConstMapping::print().

299  {
300  return Storage.begin();
301  }
_Base Storage
Definition: MappingBase.h:146
const_iterator inet::physicallayer::DimensionSet::begin ( ) const
inline
309  {
310  return Storage.begin();
311  }
_Base Storage
Definition: MappingBase.h:146
bool inet::physicallayer::DimensionSet::empty ( ) const
inline

Returns true if the DimensionSet is empty.

Referenced by inet::physicallayer::Argument::compare().

388  {
389  return Storage.empty();
390  }
_Base Storage
Definition: MappingBase.h:146
const_iterator inet::physicallayer::DimensionSet::end ( ) const
inline
314  {
315  return Storage.end();
316  }
_Base Storage
Definition: MappingBase.h:146
const_iterator inet::physicallayer::DimensionSet::find ( const value_type __x) const
inline

Referenced by inet::physicallayer::Argument::compare(), and inet::physicallayer::MappingUtils::createCompatibleMapping().

339  {
340  return Storage.find(__x);
341  }
_Base Storage
Definition: MappingBase.h:146
template<typename _InputIterator >
void inet::physicallayer::DimensionSet::insert ( _InputIterator  __first,
_InputIterator  __last 
)
inline

A template function that attempts to insert a range of elements.

Parameters
firstIterator pointing to the start of the range to be inserted.
lastIterator pointing to the end of the range.

Complexity similar to that of the range constructor.

Referenced by inet::physicallayer::Argument::getDimensions().

360  { Storage.insert(__first, __last); }
_Base Storage
Definition: MappingBase.h:146
iterator inet::physicallayer::DimensionSet::insert ( const_iterator  __position,
const value_type __x 
)
inline

Attempts to insert an element into the DimensionSet.

Parameters
positionAn iterator that serves as a hint as to where the element should be inserted.
xElement to be inserted.
Returns
An iterator that points to the element with key of x (may or may not be the element passed in).

This function is not concerned about whether the insertion took place, and thus does not return a boolean like the single-argument insert() does. Note that the first parameter is only a hint and can potentially improve the performance of the insertion process. A bad hint would cause no gains in efficiency.

For more on hinting, see: http://gcc.gnu.org/onlinedocs/libstdc++/manual/bk01pt07ch17.html

Insertion requires logarithmic time (if the hint is not taken).

382  {
383  return Storage.insert(__position, __x);
384  }
_Base Storage
Definition: MappingBase.h:146
bool inet::physicallayer::DimensionSet::isRealSubSet ( const DimensionSet other) const
inline

Returns true if the passed DimensionSet is a real subset of this DimensionSet.

A DimensionSet is a real subset of this DimensionSet if every Dimension of the passed DimensionSet is defined in this DimensionSet and there is at least one Dimensions in this set which isn't in the other set.

264  {
265  if (size() <= other.size())
266  return false;
267 
268  return std::includes(begin(), end(), other.begin(), other.end());
269  }
iterator begin()
Definition: MappingBase.h:298
iterator end()
Definition: MappingBase.h:303
size_type size() const
Returns the size of the DimensionSet.
Definition: MappingBase.h:344
bool inet::physicallayer::DimensionSet::isSubSet ( const DimensionSet other) const
inline

Returns true if the passed DimensionSet is a subset of this DimensionSet.

A DimensionSet is a subset of this DimensionSet if every Dimension of the passed DimensionSet is defined in this DimensionSet.

Referenced by inet::physicallayer::MappingUtils::findMax(), inet::physicallayer::MappingUtils::findMin(), and inet::physicallayer::SimpleConstMappingIterator::SimpleConstMappingIterator().

247  {
248  if (Storage.size() < other.Storage.size())
249  return false;
250 
251  return std::includes(Storage.begin(), Storage.end(), other.Storage.begin(), other.Storage.end());
252  }
_Base Storage
Definition: MappingBase.h:146
DimensionSet& inet::physicallayer::DimensionSet::operator= ( DimensionSet const &  copy)
inline

DimensionSet assignment operator.

Parameters
copyA DimensionSet of identical element and allocator types.

All the elements of copy are copied.

185  {
186  DimensionSet tmp(copy); // All resource all allocation happens here.
187  // If this fails the copy will throw an exception
188  // and 'this' object is unaffected by the exception.
189  swap(tmp);
190  return *this;
191  }
DimensionSet()
Default constructor creates an empty DimensionSet.
Definition: MappingBase.h:170
void swap(DimensionSet &s)
Swaps data with another DimensionSet.
Definition: MappingBase.h:201
bool inet::physicallayer::DimensionSet::operator== ( const DimensionSet o) const
inline

Returns true if the dimensions of both sets are equal.

291  {
292  if (size() != o.size())
293  return false;
294 
295  return std::equal(begin(), end(), o.begin());
296  }
iterator begin()
Definition: MappingBase.h:298
iterator end()
Definition: MappingBase.h:303
size_type size() const
Returns the size of the DimensionSet.
Definition: MappingBase.h:344
reverse_iterator inet::physicallayer::DimensionSet::rbegin ( )
inline

Referenced by inet::physicallayer::MappingUtils::createCompatibleMapping().

319  {
320  return Storage.rbegin();
321  }
_Base Storage
Definition: MappingBase.h:146
const_reverse_iterator inet::physicallayer::DimensionSet::rbegin ( ) const
inline
329  {
330  return Storage.rbegin();
331  }
_Base Storage
Definition: MappingBase.h:146
reverse_iterator inet::physicallayer::DimensionSet::rend ( )
inline

Referenced by inet::physicallayer::MappingUtils::createCompatibleMapping().

324  {
325  return Storage.rend();
326  }
_Base Storage
Definition: MappingBase.h:146
const_reverse_iterator inet::physicallayer::DimensionSet::rend ( ) const
inline
334  {
335  return Storage.rend();
336  }
_Base Storage
Definition: MappingBase.h:146
size_type inet::physicallayer::DimensionSet::size ( ) const
inline

Returns the size of the DimensionSet.

Referenced by inet::physicallayer::MappingUtils::createMapping(), isRealSubSet(), operator==(), and inet::physicallayer::ConstMapping::print().

345  {
346  return Storage.size();
347  }
_Base Storage
Definition: MappingBase.h:146
void inet::physicallayer::DimensionSet::swap ( DimensionSet s)
inline

Swaps data with another DimensionSet.

Parameters
sA DimensionSet of the same element and allocator types.

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

Referenced by inet::physicallayer::ConstMapping::swap().

202  {
203  // X::swap(s); // swap the base class members
204  /* Swap all D members */
205  std::swap(Storage, s.Storage);
206  }
value< double, units::s > s
Definition: Units.h:1049
_Base Storage
Definition: MappingBase.h:146

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const DimensionSet d 
)
friend

Output operator for a dimension.

394  {
395  using std::operator<<;
396 
397  out << "(";
398  for (const_iterator it = d.Storage.begin(); it != d.Storage.end(); ++it) {
399  if (it != d.Storage.begin())
400  out << ", ";
401  out << *it;
402  }
403  return out << ")";
404  }
_Base::const_iterator const_iterator
Definition: MappingBase.h:153

Member Data Documentation

const DimensionSet inet::physicallayer::DimensionSet::freqDomain
static

Shortcut to a DimensionSet which only contains frequency.

Referenced by inet::physicallayer::Dimension::Dimension().

_Base inet::physicallayer::DimensionSet::Storage
protected

Referenced by isSubSet(), and swap().

const DimensionSet inet::physicallayer::DimensionSet::timeDomain
static

Shortcut to a DimensionSet which only contains time.

Referenced by inet::physicallayer::Dimension::Dimension().

const DimensionSet inet::physicallayer::DimensionSet::timeFreqDomain
static

Shortcut to a DimensionSet which contains time and frequency.

Referenced by inet::physicallayer::Dimension::Dimension().


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