CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/CondTools/DT/src/DTDBDataHandle.cc

Go to the documentation of this file.
00001 //using namespace std;
00002 /*
00003  *  See header file for a description of this class.
00004  *
00005  *  $Date: 2007/12/07 15:13:20 $
00006  *  $Revision: 1.2 $
00007  *  \author Paolo Ronchese INFN Padova
00008  *
00009  */
00010 
00011 //-----------------------
00012 // This Class' Header --
00013 //-----------------------
00014 #include "CondTools/DT/interface/DTDBDataHandle.h"
00015 
00016 //-------------------------------
00017 // Collaborating Class Headers --
00018 //-------------------------------
00019 
00020 
00021 //---------------
00022 // C++ Headers --
00023 //---------------
00024 
00025 
00026 //-------------------
00027 // Initializations --
00028 //-------------------
00029 
00030 
00031 //----------------
00032 // Constructors --
00033 //----------------
00034 DTDBDataHandle::DTDBDataHandle() {
00035 }
00036 
00037 //--------------
00038 // Destructor --
00039 //--------------
00040 DTDBDataHandle::~DTDBDataHandle() {
00041 }
00042 
00043 //--------------
00044 // Operations --
00045 //--------------
00046 int DTDBDataHandle::nearestInt( double d ) {
00047 
00048   if ( d > 0.0 ) d += 0.5;
00049   else           d -= 0.5;
00050   return static_cast<int>( d );
00051 
00052 }
00053 
00054 
00055 bool DTDBDataHandle::toBool( short s ) {
00056 
00057   union u_short_bool {
00058     short s_num;
00059     bool  b_num;
00060   };
00061   union u_short_bool dataBuffer;
00062   dataBuffer.s_num = s;
00063   return dataBuffer.b_num;
00064 
00065 }
00066 
00067 
00068 short DTDBDataHandle::toShort( bool b ) {
00069 
00070   union u_short_bool {
00071     short s_num;
00072     bool  b_num;
00073   };
00074   union u_short_bool dataBuffer;
00075   dataBuffer.s_num = 0;
00076   dataBuffer.b_num = b;
00077   return dataBuffer.s_num;
00078 
00079 }
00080 
00081 
00082 
00083