CLHEP VERSION Reference Documentation
CLHEP Home Page CLHEP Documentation CLHEP Bug Reports |
00001 // $Id: RandBit.cc,v 1.6 2010/06/16 17:24:53 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 std::ostream & RandBit::put ( std::ostream & os ) const { 00029 os << " " << name() << "\n"; 00030 RandFlat::put(os); 00031 return os; 00032 } 00033 00034 std::istream & RandBit::get ( std::istream & is ) { 00035 std::string inName; 00036 is >> inName; 00037 if (inName != name()) { 00038 is.clear(std::ios::badbit | is.rdstate()); 00039 std::cerr << "Mismatch when expecting to read state of a " 00040 << name() << " distribution\n" 00041 << "Name found was " << inName 00042 << "\nistream is left in the badbit state\n"; 00043 return is; 00044 } 00045 RandFlat::get(is); 00046 return is; 00047 } 00048 00049 } // namespace CLHEP 00050