Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Static Public Member Functions
CLHEP::StaticRandomStates Class Reference

#include <StaticRandomStates.h>

Static Public Member Functions

static std::ostream & save (std::ostream &os)
 
static std::istream & restore (std::istream &is)
 

Detailed Description

Author
mf@fn.nosp@m.al.g.nosp@m.ov

Definition at line 27 of file StaticRandomStates.h.

Member Function Documentation

std::istream & CLHEP::StaticRandomStates::restore ( std::istream &  is)
static

Definition at line 51 of file StaticRandomStates.cc.

References CLHEP::HepRandom::getTheEngine(), CLHEP::HepRandomEngine::name(), CLHEP::HepRandomEngine::newEngine(), CLHEP::RandGauss::restoreDistState(), CLHEP::RandFlat::restoreDistState(), and CLHEP::HepRandom::setTheEngine().

Referenced by CLHEP::HepRandom::restoreStaticRandomStates().

51  {
52  HepRandomEngine * e = HepRandom::getTheEngine();
53  HepRandomEngine *ne = HepRandomEngine::newEngine(is);
54  if ( !is ) return is;
55  if ( !ne ) return is;
56  if (ne->name() == e->name()) {
57  // Because e has const data members, cannot simply do *e = *ne
58  std::ostringstream os;
59  os << *ne;
60  std::istringstream istst(os.str());
61  istst >> *e;
62  if (!istst) {
63  std::cerr << "???? Unexpected behavior in StaticRandomStates::restore:\n"
64  << "The new engine, which had been input successfully from istream\n"
65  << "has encountered a problem when used to set state of theEngine\n";
66  is.clear(std::ios::badbit | is.rdstate());
67  return is;
68  }
69  } else {
71  }
74  return is;
75 }
static std::istream & restoreDistState(std::istream &is)
Definition: RandGauss.cc:324
static std::istream & restoreDistState(std::istream &is)
Definition: RandFlat.cc:211
static HepRandomEngine * getTheEngine()
Definition: Random.cc:165
static void setTheEngine(HepRandomEngine *theNewEngine)
Definition: Random.cc:170
static HepRandomEngine * newEngine(std::istream &is)
Definition: RandomEngine.cc:89
std::ostream & CLHEP::StaticRandomStates::save ( std::ostream &  os)
static

Definition at line 37 of file StaticRandomStates.cc.

References CLHEP::RandFlat::saveDistState(), and CLHEP::RandGauss::saveFullState().

Referenced by CLHEP::HepRandom::saveStaticRandomStates().

37  {
40  return os;
41 }
static std::ostream & saveDistState(std::ostream &os)
Definition: RandFlat.cc:202
static std::ostream & saveFullState(std::ostream &os)
Definition: RandGauss.cc:368

The documentation for this class was generated from the following files: