![]() |
Home | Libraries | License | Support | People | ALPS Web Site |
alps::buffered_generator — abstract base class of a runtime-polymorphic buffered_generator
// In header: <alps/random/buffered_generator.hpp> template<typename ResultType> class buffered_generator { public: // types typedef ResultType result_type; typedef std::vector< result_type > buffer_type; // the data type of the buffer used // construct/copy/destruct buffered_generator(std::size_t = ALPS_BUFFERED_GENERATOR_BUFFER_SIZE); buffered_generator(const buffered_generator &); buffered_generator& operator=(const buffered_generator &); ~buffered_generator(); // public member functions result_type operator()(); void reset(); // private member functions void fill_buffer(buffer_type &); };
This class template is an abstract base class for runtime-polymorphic generators. In order to mask the abstraction penalty of a virtual operator()
, the buffered_generator does not produce single numbers at each call, but instead a large buffer is filled in a virtual function call, and then numbers from this buffer used when operator()
is called.
buffered_generator
public
construct/copy/destructbuffered_generator(std::size_t buffer_size = ALPS_BUFFERED_GENERATOR_BUFFER_SIZE);the constructor of the buffered generator
Constructs a
with a buffer of the size given as argument. buffered_generator
Parameters: |
|
buffered_generator(const buffered_generator & gen);the copy constructor copies the buffer
buffered_generator& operator=(const buffered_generator & gen);non-trivial the assignment
~buffered_generator();trivial virtual destructor
Copyright © 2006-2008 Brigitte Surer, Matthias Troyer |