Ocean
Ocean::SegmentUnion< T > Class Template Reference

This class implements a functionality to determine the union of individual segments. More...

Public Types

typedef std::map< T, T > SegmentMap
 Definition of a map mapping a start point to the corresponding end point of a segment. More...
 

Public Member Functions

void addSegment (const T &startPosition, const T &stopPosition)
 Adds a new segment to this union object. More...
 
SegmentUnion< T > intersection (const T &startPosition, const T &stopPosition) const
 Returns the intersection of this union with a given range (an additional segment). More...
 
maximalGap () const
 Returns the maximal gap between all successive segments. More...
 
const SegmentMapsegments () const
 Returns the segments of this object. More...
 
unionSize () const
 Returns the sum of all segment sizes. More...
 
 operator bool () const
 Returns whether the union is composed of at least one segment. More...
 

Protected Member Functions

bool isCorrect () const
 Returns whether the data structure of this object is correct. More...
 

Protected Attributes

SegmentMap segmentMap_
 The map holding all segments. More...
 

Detailed Description

template<typename T>
class Ocean::SegmentUnion< T >

This class implements a functionality to determine the union of individual segments.

Each segment is defined by a start point and an end point.
The result of such a uion is depicted below:

      Segment A:          S---------P
      Segment B:   S--P
      Segment C:                S-----------P
      Segment D:                                S----P
         ...
      Segment Z:                                     S-P
Resulting Union:   S--P   S-----------------P   S------P

(with 's' as including start point, and 'p' as including end point)
Template Parameters
TThe data type of the start and end point of a segment, should be 'float', 'double', or 'int'

Member Typedef Documentation

◆ SegmentMap

template<typename T >
typedef std::map<T, T> Ocean::SegmentUnion< T >::SegmentMap

Definition of a map mapping a start point to the corresponding end point of a segment.

Member Function Documentation

◆ addSegment()

template<typename T >
void Ocean::SegmentUnion< T >::addSegment ( const T &  startPosition,
const T &  stopPosition 
)

Adds a new segment to this union object.

Parameters
startPositionThe (including) start position of the segment, with range (-infinity, startPosition)
stopPositionThe (including) stop position of the segment, with range (stopPosition, infinity)

◆ intersection()

template<typename T >
SegmentUnion< T > Ocean::SegmentUnion< T >::intersection ( const T &  startPosition,
const T &  stopPosition 
) const

Returns the intersection of this union with a given range (an additional segment).

An intersection between this object an a given range/segment is depicted below:

Segments of this object:    X------X    X---X  X-----------X
   Intersection Segment:        S--------------------------------P
       Resulting object:        X--X    X---X  X-----------X
Parameters
startPositionThe (including) start position of the segment, with range (-infinity, startPosition)
stopPositionThe (including) stop position of the segment, with range (stopPosition, infinity)
Returns
The new object holding the intersection of this object and the specified segment, may be empty if no intersection exists

◆ isCorrect()

template<typename T >
bool Ocean::SegmentUnion< T >::isCorrect
protected

Returns whether the data structure of this object is correct.

Returns
True, if so

◆ maximalGap()

template<typename T >
T Ocean::SegmentUnion< T >::maximalGap

Returns the maximal gap between all successive segments.

Returns
The maximal gap, 0 if this object is composed of zero or one segments, with range [0, infinity)

◆ operator bool()

template<typename T >
Ocean::SegmentUnion< T >::operator bool
inlineexplicit

Returns whether the union is composed of at least one segment.

Returns
True, if so

◆ segments()

template<typename T >
const SegmentUnion< T >::SegmentMap & Ocean::SegmentUnion< T >::segments
inline

Returns the segments of this object.

Returns
The individual segments defining the union

◆ unionSize()

template<typename T >
T Ocean::SegmentUnion< T >::unionSize

Returns the sum of all segment sizes.

Returns
The size of all segments, with range [0, infinity)

Field Documentation

◆ segmentMap_

template<typename T >
SegmentMap Ocean::SegmentUnion< T >::segmentMap_
protected

The map holding all segments.


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