CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DTDBDataHandle.cc
Go to the documentation of this file.
1 //using namespace std;
2 /*
3  * See header file for a description of this class.
4  *
5  * $Date: 2007/11/24 12:29:54 $
6  * $Revision: 1.1.2.1 $
7  * \author Paolo Ronchese INFN Padova
8  *
9  */
10 
11 //-----------------------
12 // This Class' Header --
13 //-----------------------
15 
16 //-------------------------------
17 // Collaborating Class Headers --
18 //-------------------------------
19 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 
26 //-------------------
27 // Initializations --
28 //-------------------
29 
30 
31 //----------------
32 // Constructors --
33 //----------------
35 }
36 
37 //--------------
38 // Destructor --
39 //--------------
41 }
42 
43 //--------------
44 // Operations --
45 //--------------
46 int DTDBDataHandle::nearestInt( double d ) {
47 
48  if ( d > 0.0 ) d += 0.5;
49  else d -= 0.5;
50  return static_cast<int>( d );
51 
52 }
53 
54 
55 bool DTDBDataHandle::toBool( short s ) {
56 
57  union u_short_bool {
58  short s_num;
59  bool b_num;
60  };
61  union u_short_bool dataBuffer;
62  dataBuffer.s_num = s;
63  return dataBuffer.b_num;
64 
65 }
66 
67 
68 short DTDBDataHandle::toShort( bool b ) {
69 
70  union u_short_bool {
71  short s_num;
72  bool b_num;
73  };
74  union u_short_bool dataBuffer;
75  dataBuffer.s_num = 0;
76  dataBuffer.b_num = b;
77  return dataBuffer.s_num;
78 
79 }
80 
81 
82 
83 
static bool toBool(short s)
static short toShort(bool b)
double b
Definition: hdecay.h:120
virtual ~DTDBDataHandle()
string s
Definition: asciidump.py:422
static int nearestInt(double d)