BOSS 7.0.3
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcRecoUtil/MdcRecoUtil-00-01-08/MdcRecoUtil/ComPackBase.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: ComPackBase.h,v 1.4 2009/12/23 02:59:56 zhangy Exp $
4//
5// Description:
6// Class ComPackBase
7// - Templated base class for utility classes that
8// take a concrete numerical type and convert it for use in micro
9// and nano databases.
10//
11// Environment:
12// Software developed for the BaBar Detector at the SLAC B-Factory.
13//
14// Author List:
15// D.E.Azzopardi Originator.
16//
17// Copyright Information:
18// Copyright (C) 1999 DESVA Research & Design, for Hedgehog Concepts
19//
20// History:
21// Migration for BESIII MDC
22//
23// Quote:
24// "It ain't what you do, it's the way that you do it"
25//
26//--------------------------------------------------------------------------
27
28#ifndef COMPACKBASE_HH
29#define COMPACKBASE_HH
30
31//
32// C includes
33//
34#include <stddef.h>
35#include <stdlib.h>
36#include "MdcRecoUtil/ComPackBaseBase.h"
37#include "MdcRecoUtil/BesODMGTypes.h"
38
39template <class T>
40class ComPackBase : public ComPackBaseBase{
41public:
42
43 ///////////////////
44 // Constructors: //
45 ///////////////////
47
48 ComPackBase(T minval, T maxval,d_ULong bitrange) :
49 _minVal(minval),_maxVal(maxval),_valRange(maxval-minval),
50 _bitRange(bitrange),_bitMask((1<<bitrange)-1){;}
51
52 ///////////////////
53 // Destructor: //
54 ///////////////////
55 virtual ~ComPackBase(){};
56
57 ///////////////////
58 // Packers: //
59 ///////////////////
60 virtual StatusCode pack (const T ,d_ULong&) const =0;
61
62 ///////////////////
63 // Unpackers: //
64 ///////////////////
65 virtual StatusCode unpack (const d_ULong, T &) const =0;
66
67 ///////////////////
68 // Accessors: //
69 ///////////////////
70 virtual const T& getMinVal() const { return _minVal;};
71 virtual const T& getMaxVal() const { return _maxVal;};
72 virtual const T& getRange() const { return _valRange;};
73// bitrange is defined as the number of bits used; bitmask is the hex map
74 d_ULong bitRange() const { return _bitRange; }
75 d_ULong bitMask() const { return _bitMask; }
76
77 // Don't allow copies, assignment
78 ComPackBase( const ComPackBase& ) { ::abort(); }
79 ComPackBase& operator= ( const ComPackBase& ) {::abort(); return *this;}
80
81protected:
82
83 enum { _maxlongbits = 32 };
84 T _minVal;
85 T _maxVal;
86 T _valRange;
89};
90
91#endif
92
virtual StatusCode unpack(const d_ULong, T &) const =0
virtual StatusCode pack(const T, d_ULong &) const =0
ComPackBase & operator=(const ComPackBase &)