OpenWalnut  1.5.0dev
Public Types | Public Member Functions | Private Attributes | List of all members
WInterval< T > Class Template Reference

Basic class for encapsulating a std::pair to be interpreted as interval. More...

#include <WInterval.h>

+ Inheritance diagram for WInterval< T >:
+ Collaboration diagram for WInterval< T >:

Public Types

typedef std::shared_ptr< WInterval< T > > SPtr
 Convenience typedef for a std::shared_ptr< WInterval >. More...
 
typedef std::shared_ptr< const WInterval< T > > ConstSPtr
 Convenience typedef for a std::shared_ptr< const WInterval >. More...
 
typedef std::pair< T, T > StoreType
 Type used to store the information. More...
 
typedef WInterval< T > Type
 My own type. More...
 

Public Member Functions

 WInterval (const StoreType &c)
 Copy constructor to create a WInterval using a std::pair. More...
 
 WInterval (const T &l, const T &u)
 Create a new interval instance using the given values. More...
 
virtual ~WInterval ()
 Destructor. More...
 
 operator const StoreType & () const
 Convert the WInterval instance to a std::pair again. More...
 
const T & getLower () const
 Get the lower value of the interval. More...
 
const T & getUpper () const
 Return the upper value of the interval. More...
 
getLength () const
 The length of the interval. More...
 
bool operator== (Type interval) const
 Compare this interval with another one. More...
 
bool operator!= (Type interval) const
 Compare this interval with another one. More...
 

Private Attributes

StoreType m_interval
 The interval itself. More...
 

Detailed Description

template<typename T>
class WInterval< T >

Basic class for encapsulating a std::pair to be interpreted as interval.

This class intentionally does not include a parameter telling whether the interval is open or not (mathematically: [],][,[[,]])

Template Parameters
Tthe type used for this interval

Definition at line 42 of file WInterval.h.

Member Typedef Documentation

◆ ConstSPtr

template<typename T >
typedef std::shared_ptr< const WInterval< T > > WInterval< T >::ConstSPtr

Convenience typedef for a std::shared_ptr< const WInterval >.

Definition at line 53 of file WInterval.h.

◆ SPtr

template<typename T >
typedef std::shared_ptr< WInterval< T > > WInterval< T >::SPtr

Convenience typedef for a std::shared_ptr< WInterval >.

Definition at line 48 of file WInterval.h.

◆ StoreType

template<typename T >
typedef std::pair< T, T > WInterval< T >::StoreType

Type used to store the information.

Definition at line 58 of file WInterval.h.

◆ Type

template<typename T >
typedef WInterval< T > WInterval< T >::Type

My own type.

Definition at line 63 of file WInterval.h.

Constructor & Destructor Documentation

◆ WInterval() [1/2]

template<typename T >
WInterval< T >::WInterval ( const StoreType c)
explicit

Copy constructor to create a WInterval using a std::pair.

Parameters
cthe pair to use

Definition at line 230 of file WInterval.h.

◆ WInterval() [2/2]

template<typename T >
WInterval< T >::WInterval ( const T &  l,
const T &  u 
)

Create a new interval instance using the given values.

Parameters
lthe lower border
uthe upper border

Definition at line 238 of file WInterval.h.

◆ ~WInterval()

template<typename T >
WInterval< T >::~WInterval
virtual

Destructor.

Definition at line 245 of file WInterval.h.

Member Function Documentation

◆ getLength()

template<typename T >
T WInterval< T >::getLength

The length of the interval.

This is upper - lower.

Returns
length

Definition at line 269 of file WInterval.h.

Referenced by WMColormapper::updateColorbarScale().

+ Here is the caller graph for this function:

◆ getLower()

template<typename T >
const T & WInterval< T >::getLower

Get the lower value of the interval.

Returns
the lower value

Definition at line 257 of file WInterval.h.

Referenced by PROPERTY_TYPE_HELPER::WStringConversion< WPVBaseTypes::PV_INTERVAL >::asString(), WMTemplate::moduleMain(), WInterval< T >::operator==(), wge::toUniformType(), and WMColormapper::updateColorbarScale().

+ Here is the caller graph for this function:

◆ getUpper()

template<typename T >
const T & WInterval< T >::getUpper

Return the upper value of the interval.

Returns
the upper value

Definition at line 263 of file WInterval.h.

Referenced by PROPERTY_TYPE_HELPER::WStringConversion< WPVBaseTypes::PV_INTERVAL >::asString(), WMTemplate::moduleMain(), WInterval< T >::operator==(), and wge::toUniformType().

+ Here is the caller graph for this function:

◆ operator const StoreType &()

template<typename T >
WInterval< T >::operator const StoreType &

Convert the WInterval instance to a std::pair again.

Returns
the pair

Definition at line 251 of file WInterval.h.

◆ operator!=()

template<typename T >
bool WInterval< T >::operator!= ( Type  interval) const

Compare this interval with another one.

Parameters
intervalthe other one
Returns
true if lower and upper bounds are equal

Definition at line 281 of file WInterval.h.

◆ operator==()

template<typename T >
bool WInterval< T >::operator== ( Type  interval) const

Compare this interval with another one.

Parameters
intervalthe other one
Returns
true if lower and upper bounds are equal

Definition at line 275 of file WInterval.h.

References WInterval< T >::getLower(), and WInterval< T >::getUpper().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_interval

template<typename T >
StoreType WInterval< T >::m_interval
private

The interval itself.

Definition at line 136 of file WInterval.h.


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