Project Euler Solutions
Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
c::include::primes::prime_sieve Struct Reference

#include <primes.h>

Inheritance diagram for c::include::primes::prime_sieve:
Inheritance graph
[legend]
Collaboration diagram for c::include::primes::prime_sieve:
Collaboration graph
[legend]

Public Member Functions

prime_sieve prime_sieve0 ()
 The constructor for the prime number sieve. More...
 

Public Attributes

prime_counter source
 The source of new reference prime numbers. More...
 
uintmax_t prime_squared
 The reference prime squared. More...
 
uintmax_t prime: (sizeof(uintmax_t) * 4)
 The current reference prime. More...
 
size_t sieve_len: (sizeof(size_t) * 8 - 1)
 The length of the sieve state (divided by 2) More...
 
uintmax_t * sieve
 The sieve state used to generate new primes stored as pairs of [value, step]. More...
 
uintmax_t candidate
 The current candidate prime number. More...
 
- Public Attributes inherited from c::include::iterator::Iterator
bool exhausted: 1
 An indicator that the iterator has stopped. More...
 
bool started: 1
 An indicator that the iterator has started. More...
 
bool phase: 1
 An indicator that changes each time the iterator moves. More...
 

Private Member Functions

void free_prime_sieve (prime_sieve *ps)
 The destructor for the prime number sieve. More...
 
uintmax_t advance_prime_sieve (prime_sieve *ps)
 The function to advance a prime sieve iterator. More...
 

Private Attributes

uintmax_t(*const iterator_function )(prime_sieve *it)
 The pointer to the iteration function. More...
 
void(*const destructor )(void *it)
 The pointer to the destructor function. More...
 

Additional Inherited Members

Detailed Description

The iterator that implements a modified sieve of eratosthenes

Member Function Documentation

uintmax_t advance_prime_sieve ( prime_sieve ps)
private

The function to advance a prime sieve iterator.

Parameters
psthe sieve you want to advance
Returns
the next prime number in the iteration
void free_prime_sieve ( prime_sieve ps)
private

The destructor for the prime number sieve.

prime_sieve prime_sieve0 ( )

The constructor for the prime number sieve.

Here is the call graph for this function:

Member Data Documentation

uintmax_t c::include::primes::prime_sieve::candidate

The current candidate prime number.

void(*const c::include::primes::prime_sieve::destructor) (void *it)
private

The pointer to the destructor function.

See also
free_iterator
uintmax_t(*const c::include::primes::prime_sieve::iterator_function) (prime_sieve *it)
private

The pointer to the iteration function.

See also
next
uintmax_t c::include::primes::prime_sieve::prime

The current reference prime.

uintmax_t c::include::primes::prime_sieve::prime_squared

The reference prime squared.

uintmax_t* c::include::primes::prime_sieve::sieve

The sieve state used to generate new primes stored as pairs of [value, step].

size_t c::include::primes::prime_sieve::sieve_len

The length of the sieve state (divided by 2)

prime_counter c::include::primes::prime_sieve::source

The source of new reference prime numbers.


The documentation for this struct was generated from the following file: