ATLAS Offline Software
Loading...
Searching...
No Matches
TRTCond::LinearPacker< UnpackedType, PackedType > Class Template Reference

Template class for packing data. More...

#include <LinearPacker.h>

Collaboration diagram for TRTCond::LinearPacker< UnpackedType, PackedType >:

Public Member Functions

 LinearPacker ()
 default constructor
 LinearPacker (UnpackedType xmin, UnpackedType xmax)
 normal constructor
UnpackedType unpack (PackedType val) const
 Unpack method.
PackedType pack (UnpackedType x) const
 Pack method.

Private Member Functions

PackedType valmax () const
 returns numeric upper limit of packed type
PackedType valmin () const
 returns numeric lower limit of packed type
UnpackedType dx () const
 returns precision of the packed data

Private Attributes

UnpackedType m_xmin
 minimum data value
UnpackedType m_xmax
 maximum data value

Detailed Description

template<class UnpackedType, class PackedType>
class TRTCond::LinearPacker< UnpackedType, PackedType >

Template class for packing data.

Definition at line 16 of file LinearPacker.h.

Constructor & Destructor Documentation

◆ LinearPacker() [1/2]

template<class UnpackedType, class PackedType>
TRTCond::LinearPacker< UnpackedType, PackedType >::LinearPacker ( )
inline

default constructor

Definition at line 21 of file LinearPacker.h.

21: m_xmin(1),m_xmax(0) {}
UnpackedType m_xmin
minimum data value
UnpackedType m_xmax
maximum data value

◆ LinearPacker() [2/2]

template<class UnpackedType, class PackedType>
TRTCond::LinearPacker< UnpackedType, PackedType >::LinearPacker ( UnpackedType xmin,
UnpackedType xmax )
inline

normal constructor

Definition at line 24 of file LinearPacker.h.

24: m_xmin(xmin), m_xmax(xmax) {}
Template class for packing data.

Member Function Documentation

◆ dx()

template<class UnpackedType, class PackedType>
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::dx ( ) const
inlineprivate

returns precision of the packed data

Definition at line 43 of file LinearPacker.h.

43{ return (m_xmax - m_xmin)/(UnpackedType(valmax()-valmin())+1) ; }
PackedType valmin() const
returns numeric lower limit of packed type
PackedType valmax() const
returns numeric upper limit of packed type

◆ pack()

template<class UnpackedType, class PackedType>
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::pack ( UnpackedType x) const
inline

Pack method.

Definition at line 30 of file LinearPacker.h.

30 {
31 return x>=m_xmax ? valmax() : (x<=m_xmin ? valmin() : valmin() + PackedType((x - m_xmin) /dx() + 0.5) ) ;
32 }
UnpackedType dx() const
returns precision of the packed data

◆ unpack()

template<class UnpackedType, class PackedType>
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::unpack ( PackedType val) const
inline

Unpack method.

Definition at line 27 of file LinearPacker.h.

27{ return m_xmin + (val-valmin()) * dx() ; }

◆ valmax()

template<class UnpackedType, class PackedType>
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::valmax ( ) const
inlineprivate

returns numeric upper limit of packed type

Definition at line 37 of file LinearPacker.h.

◆ valmin()

template<class UnpackedType, class PackedType>
PackedType TRTCond::LinearPacker< UnpackedType, PackedType >::valmin ( ) const
inlineprivate

returns numeric lower limit of packed type

Definition at line 40 of file LinearPacker.h.

Member Data Documentation

◆ m_xmax

template<class UnpackedType, class PackedType>
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::m_xmax
private

maximum data value

Definition at line 46 of file LinearPacker.h.

◆ m_xmin

template<class UnpackedType, class PackedType>
UnpackedType TRTCond::LinearPacker< UnpackedType, PackedType >::m_xmin
private

minimum data value

Definition at line 45 of file LinearPacker.h.


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