CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
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 <iostream>
20#include <string>
21
22namespace CLHEP {
23
24std::string RandBit::name() const {return "RandBit";}
25
27}
28
29std::ostream & RandBit::put ( std::ostream & os ) const {
30 os << " " << name() << "\n";
31 RandFlat::put(os);
32 return os;
33}
34
35std::istream & RandBit::get ( std::istream & is ) {
36 std::string inName;
37 is >> inName;
38 if (inName != name()) {
39 is.clear(std::ios::badbit | is.rdstate());
40 std::cerr << "Mismatch when expecting to read state of a "
41 << name() << " distribution\n"
42 << "Name found was " << inName
43 << "\nistream is left in the badbit state\n";
44 return is;
45 }
46 RandFlat::get(is);
47 return is;
48}
49
50} // namespace CLHEP
51
std::string name() const
Definition: RandBit.cc:24
std::istream & get(std::istream &is)
Definition: RandBit.cc:35
std::ostream & put(std::ostream &os) const
Definition: RandBit.cc:29
virtual ~RandBit()
Definition: RandBit.cc:26
std::ostream & put(std::ostream &os) const
Definition: RandFlat.cc:159
std::istream & get(std::istream &is)
Definition: RandFlat.cc:190