/* * sim.hpp * * Created on: Sep 19, 2011 * Author: mike */ #pragma once #include using namespace std; #include "randbit.hpp" #include "coin.hpp" #include "exper.hpp" //-------------------------------------------------------------------- class Simulator { private: // Parameters int n; // number of coin flips in experiment int t; // number of trials int tau; // threshold RandBit::Mode_t mode; // mode of bit generation double p; // dependency parameter for random tosses unsigned seed; // seed for random tosses string filename; // file name for recorded bitstream // Objects used for the simulation RandBit* rb; // bit-stream generator Coin* c; // Coin to use for experiments Experiment* ex; // Experiment // Simulation result double est; // Computed estimator // Debugging switch bool debugFlag; // set true for debugging output // Command line parser bool getInt(char* p, int& x); bool getUnsigned(char* p, unsigned& x); bool getDouble(char* p, double& x); bool parse(int argc, char* argv[]); public: Simulator(int argc, char* argvp[]); ~Simulator(); double getEst() const { return est; } void run(); ostream& print( ostream& out) const; bool debug() const { return debugFlag; } };