CMS 3D CMS Logo

List of all members | Public Member Functions
TRange< T > Class Template Reference

#include <TRange.h>

Inheritance diagram for TRange< T >:

Public Member Functions

bool empty () const
 true for empty region. note that region [x,x] is not empty More...
 
bool inside (const T &value) const
 check if object is inside region More...
 
const Tmax () const
 upper edge of range More...
 
T mean () const
 
const Tmin () const
 lower edge of range More...
 
void sort ()
 
TRange< Tsum (const TRange< T > &r) const
 sum of overlaping regions. the overlapping should be checked before. More...
 
 TRange ()
 
 TRange (const T &aMin, const T &aMax)
 
 TRange (const std::pair< T, T > &apair)
 

Detailed Description

template<class T>
class TRange< T >

Define a range [aMin,aMax]

Definition at line 11 of file TRange.h.

Constructor & Destructor Documentation

template<class T>
TRange< T >::TRange ( )
inline

Definition at line 13 of file TRange.h.

Referenced by TRange< int >::sum().

13 {}
template<class T>
TRange< T >::TRange ( const T aMin,
const T aMax 
)
inline

Definition at line 15 of file TRange.h.

15 : std::pair<T, T>(aMin, aMax) {}
template<class T>
TRange< T >::TRange ( const std::pair< T, T > &  apair)
inline

Definition at line 17 of file TRange.h.

17 : std::pair<T, T>(apair) {}

Member Function Documentation

template<class T>
bool TRange< T >::empty ( ) const
inline

true for empty region. note that region [x,x] is not empty

Definition at line 28 of file TRange.h.

Referenced by Vispa.Gui.VispaWidget.TextField::setAutosizeFont(), Vispa.Gui.VispaWidget.TextField::setAutotruncate(), TRange< int >::sort(), and TRange< int >::sum().

28 { return (this->second < this->first); }
template<class T>
bool TRange< T >::inside ( const T value) const
inline

check if object is inside region

Definition at line 31 of file TRange.h.

31  {
32  if (value < this->first || this->second < value)
33  return false;
34  else
35  return true;
36  }
U second(std::pair< T, U > const &p)
Definition: value.py:1
template<class T>
const T& TRange< T >::max ( ) const
inline

upper edge of range

Definition at line 23 of file TRange.h.

Referenced by PixelToLNKAssociateFromAscii::addConnections(), and TRange< int >::sum().

23 { return this->second; }
U second(std::pair< T, U > const &p)
template<class T>
T TRange< T >::mean ( ) const
inline

Definition at line 25 of file TRange.h.

25 { return (this->first + this->second) / 2.; }
U second(std::pair< T, U > const &p)
template<class T>
const T& TRange< T >::min ( ) const
inline

lower edge of range

Definition at line 20 of file TRange.h.

Referenced by PixelToLNKAssociateFromAscii::addConnections(), PixelBarrelLinkMaker::Order::operator()(), and TRange< int >::sum().

20 { return this->first; }
template<class T>
void TRange< T >::sort ( )
inline

Definition at line 61 of file TRange.h.

61  {
62  if (empty())
63  std::swap(this->first, this->second);
64  }
U second(std::pair< T, U > const &p)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool empty() const
true for empty region. note that region [x,x] is not empty
Definition: TRange.h:28
template<class T>
TRange<T> TRange< T >::sum ( const TRange< T > &  r) const
inline

sum of overlaping regions. the overlapping should be checked before.

Definition at line 52 of file TRange.h.

52  {
53  if (this->empty())
54  return r;
55  else if (r.empty())
56  return *this;
57  else
58  return TRange((min() < r.min()) ? min() : r.min(), (max() < r.max()) ? r.max() : max());
59  }
TRange()
Definition: TRange.h:13
const T & min() const
lower edge of range
Definition: TRange.h:20
const T & max() const
upper edge of range
Definition: TRange.h:23
bool empty() const
true for empty region. note that region [x,x] is not empty
Definition: TRange.h:28