CLHEP 2.4.6.4
C++ Class Library for High Energy Physics
Loading...
Searching...
No Matches
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 28 of file StaticRandomStates.h.

Member Function Documentation

◆ restore()

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

Definition at line 52 of file StaticRandomStates.cc.

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

◆ save()

std::ostream & CLHEP::StaticRandomStates::save ( std::ostream &  os)
static

Definition at line 38 of file StaticRandomStates.cc.

38 {
41 return os;
42}
static std::ostream & saveDistState(std::ostream &os)
Definition: RandFlat.cc:228
static std::ostream & saveFullState(std::ostream &os)
Definition: RandGauss.cc:405

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