BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Reconstruction/MdcPatRec/MdcRecoUtil/include/MdcRecoUtil/ComPackSignedExpFloat.h
Go to the documentation of this file.
1//--------------------------------------------------------------------------
2// File and Version Information:
3// $Id: ComPackSignedExpFloat.h,v 1.2 2009/12/23 02:59:56 zhangy Exp $
4//
5// Description:
6// class ComPackSignedExpFloat; Uses ComPackExpFloat to store the
7// magnitude of a signed quantity, then adds in the sign.
8// Environment:
9// Software developed for the BaBar Detector at the SLAC B-Factory.
10//
11// Author List:
12// Dave Brown 10/12/00
13//
14// Copyright Information:
15// Copyright (C) 2000 LBNL
16//
17// History:
18// Migration for BESIII MDC
19//
20//
21//--------------------------------------------------------------------------
22
23#ifndef COMPACKSIGNEDEXPFLOAT_HH
24#define COMPACKSIGNEDEXPFLOAT_HH
25
26#include "MdcRecoUtil/ComPackExpFloat.h"
27#include <iostream>
28
29class ComPackSignedExpFloat : public ComPackBase<double> {
30
31public:
32 // See ComPackExpFloat for an explanation. Note that in this class, the number
33 // of bits should include 1 for the sign. The invert flag specifies that the best
34 // resolution should occur at the +-maxval end of the range instead of around 0.
35 ComPackSignedExpFloat( unsigned nbits, unsigned maxexponent, double maxval,
36 bool invert = false, bool center = false );
38 // ComPackBase functions
39 virtual StatusCode pack( const double, d_ULong& ) const;
40 virtual StatusCode unpack( const d_ULong, double& ) const;
41 void print( std::ostream& s = std::cout ) const;
42
43private:
44 // This class uses ComPackExpFloat to do the dirty work
45 ComPackExpFloat _packer;
46 unsigned _signbit; // sign bits location
47 unsigned _signmask; // mask for positive
48};
49
50#endif
XmlRpcServer s
virtual ~ComPackSignedExpFloat()
ComPackSignedExpFloat(unsigned nbits, unsigned maxexponent, double maxval, bool invert=false, bool center=false)
virtual StatusCode unpack(const d_ULong, double &) const
void print(std::ostream &s=std::cout) const
virtual StatusCode pack(const double, d_ULong &) const