Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Data Structures | Static Public Member Functions
CLHEP::DoubConv Class Reference

#include <DoubConv.h>

Static Public Member Functions

static std::vector< unsigned long > dto2longs (double d)
 
static double longs2double (const std::vector< unsigned long > &v)
 
static std::string d2x (double d)
 

Detailed Description

Definition at line 28 of file DoubConv.h.

Member Function Documentation

std::string CLHEP::DoubConv::d2x ( double  d)
static

Definition at line 86 of file DoubConv.cc.

References int().

86  {
87  if ( !byte_order_known ) fill_byte_order ();
88  DB8 db;
89  db.d = d;
90  std::ostringstream ss;
91  for (int i=0; i<8; ++i) {
92  int k = byte_order[i];
93  ss << std::hex << std::setw(2) << std::setfill('0') << (int)db.b[k];
94  }
95  return ss.str();
96 }
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
std::vector< unsigned long > CLHEP::DoubConv::dto2longs ( double  d)
static

Definition at line 98 of file DoubConv.cc.

References test::v.

Referenced by CLHEP::RandPoissonQ::put(), CLHEP::RandPoisson::put(), CLHEP::RandStudentT::put(), CLHEP::NonRandomEngine::put(), CLHEP::RandExponential::put(), CLHEP::HepJamesRandom::put(), CLHEP::RandChiSquare::put(), CLHEP::RandGamma::put(), CLHEP::RandBinomial::put(), CLHEP::Ranlux64Engine::put(), CLHEP::RandExpZiggurat::put(), CLHEP::RandGauss::put(), CLHEP::RandGeneral::put(), CLHEP::RandBreitWigner::put(), CLHEP::RandFlat::put(), CLHEP::RandGauss::saveDistState(), and CLHEP::RandGauss::saveEngineStatus().

98  {
99  std::vector<unsigned long> v(2);
100  if ( !byte_order_known ) fill_byte_order ();
101  DB8 db;
102  db.d = d;
103  v[0] = ((static_cast<unsigned long>(db.b[byte_order[0]])) << 24)
104  | ((static_cast<unsigned long>(db.b[byte_order[1]])) << 16)
105  | ((static_cast<unsigned long>(db.b[byte_order[2]])) << 8)
106  | ((static_cast<unsigned long>(db.b[byte_order[3]])) );
107  v[1] = ((static_cast<unsigned long>(db.b[byte_order[4]])) << 24)
108  | ((static_cast<unsigned long>(db.b[byte_order[5]])) << 16)
109  | ((static_cast<unsigned long>(db.b[byte_order[6]])) << 8)
110  | ((static_cast<unsigned long>(db.b[byte_order[7]])) );
111  return v;
112 }
double CLHEP::DoubConv::longs2double ( const std::vector< unsigned long > &  v)
static

Definition at line 114 of file DoubConv.cc.

Referenced by CLHEP::RandPoissonQ::get(), CLHEP::RandPoisson::get(), CLHEP::RandStudentT::get(), CLHEP::RandExponential::get(), CLHEP::RandChiSquare::get(), CLHEP::RandBinomial::get(), CLHEP::RandGamma::get(), CLHEP::RandExpZiggurat::get(), CLHEP::RandGauss::get(), CLHEP::RandGeneral::get(), CLHEP::RandBreitWigner::get(), CLHEP::RandFlat::get(), CLHEP::NonRandomEngine::getState(), CLHEP::HepJamesRandom::getState(), CLHEP::Ranlux64Engine::getState(), CLHEP::RandGauss::restoreDistState(), and CLHEP::RandGauss::restoreEngineStatus().

114  {
115  DB8 db;
116  unsigned char bytes[8];
117  if ( !byte_order_known ) fill_byte_order ();
118  bytes[0] = static_cast<unsigned char>((v[0] >> 24) & 0xFF);
119  bytes[1] = static_cast<unsigned char>((v[0] >> 16) & 0xFF);
120  bytes[2] = static_cast<unsigned char>((v[0] >> 8) & 0xFF);
121  bytes[3] = static_cast<unsigned char>((v[0] ) & 0xFF);
122  bytes[4] = static_cast<unsigned char>((v[1] >> 24) & 0xFF);
123  bytes[5] = static_cast<unsigned char>((v[1] >> 16) & 0xFF);
124  bytes[6] = static_cast<unsigned char>((v[1] >> 8) & 0xFF);
125  bytes[7] = static_cast<unsigned char>((v[1] ) & 0xFF);
126  for (int i=0; i<8; ++i) {
127  db.b[byte_order[i]] = bytes[i];
128  }
129  return db.d;
130 }

The documentation for this class was generated from the following files: