CLHEP 2.0.4.7 Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // $Id: RandBit.cc,v 1.4.4.1 2005/03/18 22:26:48 garren Exp $ 00002 // -*- C++ -*- 00003 // 00004 // ----------------------------------------------------------------------- 00005 // HEP Random 00006 // --- RandBit --- 00007 // class implementation file 00008 // ----------------------------------------------------------------------- 00009 // This file is part of Geant4 (simulation toolkit for HEP). 00010 00011 // ======================================================================= 00012 // M Fischler - Created from RandFlat.cc, deleting almost all the content 00013 // since inheritance takes care of it. 2/15/00 00014 // M Fischler - put and get to/from streams 12/10/04 00015 // ======================================================================= 00016 00017 #include "CLHEP/Random/defs.h" 00018 #include "CLHEP/Random/RandBit.h" 00019 #include <string> 00020 00021 namespace CLHEP { 00022 00023 std::string RandBit::name() const {return "RandBit";} 00024 00025 RandBit::~RandBit() { 00026 } 00027 00028 RandBit::RandBit(const RandBit& right) : RandFlat(right) { 00029 } 00030 00031 std::ostream & RandBit::put ( std::ostream & os ) const { 00032 os << " " << name() << "\n"; 00033 RandFlat::put(os); 00034 return os; 00035 } 00036 00037 std::istream & RandBit::get ( std::istream & is ) { 00038 std::string inName; 00039 is >> inName; 00040 if (inName != name()) { 00041 is.clear(std::ios::badbit | is.rdstate()); 00042 std::cerr << "Mismatch when expecting to read state of a " 00043 << name() << " distribution\n" 00044 << "Name found was " << inName 00045 << "\nistream is left in the badbit state\n"; 00046 return is; 00047 } 00048 RandFlat::get(is); 00049 return is; 00050 } 00051 00052 } // namespace CLHEP 00053