RandBit.cc

Go to the documentation of this file.
00001 // $Id:$
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/RandBit.h"
00018 #include <string>
00019 
00020 namespace CLHEP {
00021 
00022 std::string RandBit::name() const {return "RandBit";}
00023 
00024 RandBit::~RandBit() {
00025 }
00026 
00027 std::ostream & RandBit::put ( std::ostream & os ) const {
00028   os << " " << name() << "\n";
00029   RandFlat::put(os);
00030   return os;
00031 }
00032 
00033 std::istream & RandBit::get ( std::istream & is ) {
00034   std::string inName;
00035   is >> inName;
00036   if (inName != name()) {
00037     is.clear(std::ios::badbit | is.rdstate());
00038     std::cerr << "Mismatch when expecting to read state of a "
00039               << name() << " distribution\n"
00040               << "Name found was " << inName
00041               << "\nistream is left in the badbit state\n";
00042     return is;
00043   }
00044   RandFlat::get(is);
00045   return is;
00046 }
00047   
00048 }  // namespace CLHEP
00049 

Generated on Mon May 27 17:50:33 2013 for Geant4 by  doxygen 1.4.7