CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
HGCSample Class Reference

wrapper for a data word More...

#include <HGCSample.h>

Public Types

enum  HGCSampleMasks { ADC_MASK =0x7fff, GAIN_MASK =0x1 }
 
enum  HGCSamplePos { ADC_POS =0, GAIN_POS =15 }
 

Public Member Functions

uint16_t adc () const
 
uint16_t gain () const
 
 HGCSample ()
 CTOR. More...
 
 HGCSample (uint16_t value)
 
uint16_t operator() ()
 
uint16_t raw () const
 getters More...
 
void set (uint16_t gain, uint16_t adc)
 
void setADC (uint16_t adc)
 
void setGain (uint16_t gain)
 setters More...
 

Private Member Functions

void setWord (uint16_t word, uint16_t mask, uint16_t pos)
 wrapper to reset words at a given position More...
 

Private Attributes

uint16_t value_
 

Detailed Description

wrapper for a data word

Definition at line 12 of file HGCSample.h.

Member Enumeration Documentation

Enumerator
ADC_MASK 
GAIN_MASK 

Definition at line 16 of file HGCSample.h.

Enumerator
ADC_POS 
GAIN_POS 

Definition at line 17 of file HGCSample.h.

Constructor & Destructor Documentation

HGCSample::HGCSample ( )
inline

CTOR.

Definition at line 22 of file HGCSample.h.

22 : value_(0) { }
uint16_t value_
Definition: HGCSample.h:54
HGCSample::HGCSample ( uint16_t  value)
inline

Definition at line 23 of file HGCSample.h.

23 : value_(value) { }
uint16_t value_
Definition: HGCSample.h:54

Member Function Documentation

uint16_t HGCSample::adc ( ) const
inline

Definition at line 37 of file HGCSample.h.

References ADC_MASK, ADC_POS, and value_.

37 { return ((value_ >> ADC_POS) & ADC_MASK); }
uint16_t value_
Definition: HGCSample.h:54
uint16_t HGCSample::gain ( ) const
inline

Definition at line 36 of file HGCSample.h.

References GAIN_MASK, GAIN_POS, and value_.

36 { return ((value_ >> GAIN_POS) & GAIN_MASK); }
uint16_t value_
Definition: HGCSample.h:54
uint16_t HGCSample::operator() ( )
inline

Definition at line 38 of file HGCSample.h.

References value_.

38 { return value_; }
uint16_t value_
Definition: HGCSample.h:54
uint16_t HGCSample::raw ( ) const
inline

getters

Definition at line 35 of file HGCSample.h.

References value_.

35 { return value_; }
uint16_t value_
Definition: HGCSample.h:54
void HGCSample::set ( uint16_t  gain,
uint16_t  adc 
)
inline
void HGCSample::setADC ( uint16_t  adc)
inline

Definition at line 29 of file HGCSample.h.

References ADC_MASK, ADC_POS, and setWord().

Referenced by set().

uint16_t adc() const
Definition: HGCSample.h:37
void setWord(uint16_t word, uint16_t mask, uint16_t pos)
wrapper to reset words at a given position
Definition: HGCSample.h:45
void HGCSample::setGain ( uint16_t  gain)
inline

setters

Definition at line 28 of file HGCSample.h.

References GAIN_MASK, GAIN_POS, and setWord().

Referenced by set().

void setWord(uint16_t word, uint16_t mask, uint16_t pos)
wrapper to reset words at a given position
Definition: HGCSample.h:45
uint16_t gain() const
Definition: HGCSample.h:36
void HGCSample::setWord ( uint16_t  word,
uint16_t  mask,
uint16_t  pos 
)
inlineprivate

wrapper to reset words at a given position

Definition at line 45 of file HGCSample.h.

References value_.

Referenced by setADC(), and setGain().

46  {
47  //clear required bits
48  value_ &= ~((word & mask) << pos);
49  //now set the new value
50  value_ |= ((word & mask) << pos);
51  }
uint16_t value_
Definition: HGCSample.h:54

Member Data Documentation

uint16_t HGCSample::value_
private

Definition at line 54 of file HGCSample.h.

Referenced by adc(), gain(), operator()(), raw(), and setWord().