CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

RandBit.cc
Go to the documentation of this file.
1// $Id: RandBit.cc,v 1.6 2010/06/16 17:24:53 garren Exp $
2// -*- C++ -*-
3//
4// -----------------------------------------------------------------------
5// HEP Random
6// --- RandBit ---
7// class implementation file
8// -----------------------------------------------------------------------
9// This file is part of Geant4 (simulation toolkit for HEP).
10
11// =======================================================================
12// M Fischler - Created from RandFlat.cc, deleting almost all the content
13// since inheritance takes care of it. 2/15/00
14// M Fischler - put and get to/from streams 12/10/04
15// =======================================================================
16
17#include "CLHEP/Random/defs.h"
18#include "CLHEP/Random/RandBit.h"
19#include <string>
20
21namespace CLHEP {
22
23std::string RandBit::name() const {return "RandBit";}
24
27
28std::ostream & RandBit::put ( std::ostream & os ) const {
29 os << " " << name() << "\n";
30 RandFlat::put(os);
31 return os;
32}
33
34std::istream & RandBit::get ( std::istream & is ) {
35 std::string inName;
36 is >> inName;
37 if (inName != name()) {
38 is.clear(std::ios::badbit | is.rdstate());
39 std::cerr << "Mismatch when expecting to read state of a "
40 << name() << " distribution\n"
41 << "Name found was " << inName
42 << "\nistream is left in the badbit state\n";
43 return is;
44 }
45 RandFlat::get(is);
46 return is;
47}
48
49} // namespace CLHEP
50
std::string name() const
Definition RandBit.cc:23
std::istream & get(std::istream &is)
Definition RandBit.cc:34
std::ostream & put(std::ostream &os) const
Definition RandBit.cc:28
virtual ~RandBit()
Definition RandBit.cc:25
std::ostream & put(std::ostream &os) const
Definition RandFlat.cc:156
std::istream & get(std::istream &is)
Definition RandFlat.cc:187