CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 14 of file TRange.h.

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

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

Definition at line 16 of file TRange.h.

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

Definition at line 19 of file TRange.h.

20  : 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 31 of file TRange.h.

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

31 { return (this->second < this->first); }
bool first
Definition: L1TdeRCT.cc:94
template<class T>
bool TRange< T >::inside ( const T value) const
inline

check if object is inside region

Definition at line 34 of file TRange.h.

Referenced by SiPixelFedCablingMapBuilder::produce().

34  {
35  if (value < this->first || this->second < value) return false;
36  else return true;
37  }
U second(std::pair< T, U > const &p)
bool first
Definition: L1TdeRCT.cc:94
template<class T>
const T& TRange< T >::max ( ) const
inline

upper edge of range

Definition at line 26 of file TRange.h.

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

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

Definition at line 28 of file TRange.h.

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

lower edge of range

Definition at line 23 of file TRange.h.

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

23 { return this->first; }
bool first
Definition: L1TdeRCT.cc:94
template<class T>
void TRange< T >::sort ( )
inline

Definition at line 60 of file TRange.h.

60 { if (empty() ) std::swap(this->first,this->second); }
U second(std::pair< T, U > const &p)
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
bool first
Definition: L1TdeRCT.cc:94
bool empty() const
true for empty region. note that region [x,x] is not empty
Definition: TRange.h:31
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 53 of file TRange.h.

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