ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RandBit.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file RandBit.cc
1 // -*- C++ -*-
2 //
3 // -----------------------------------------------------------------------
4 // HEP Random
5 // --- RandBit ---
6 // class implementation file
7 // -----------------------------------------------------------------------
8 // This file is part of Geant4 (simulation toolkit for HEP).
9 
10 // =======================================================================
11 // M Fischler - Created from RandFlat.cc, deleting almost all the content
12 // since inheritance takes care of it. 2/15/00
13 // M Fischler - put and get to/from streams 12/10/04
14 // =======================================================================
15 
16 #include "CLHEP/Random/RandBit.h"
17 #include <string>
18 
19 namespace CLHEP {
20 
21 std::string RandBit::name() const {return "RandBit";}
22 
24 }
25 
26 std::ostream & RandBit::put ( std::ostream & os ) const {
27  os << " " << name() << "\n";
28  RandFlat::put(os);
29  return os;
30 }
31 
32 std::istream & RandBit::get ( std::istream & is ) {
33  std::string inName;
34  is >> inName;
35  if (inName != name()) {
36  is.clear(std::ios::badbit | is.rdstate());
37  std::cerr << "Mismatch when expecting to read state of a "
38  << name() << " distribution\n"
39  << "Name found was " << inName
40  << "\nistream is left in the badbit state\n";
41  return is;
42  }
43  RandFlat::get(is);
44  return is;
45 }
46 
47 } // namespace CLHEP
48