Panda3D
Main Page
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
direct
src
dcparser
primeNumberGenerator.h
1
// Filename: primeNumberGenerator.h
2
// Created by: drose (22Mar01)
3
//
4
////////////////////////////////////////////////////////////////////
5
//
6
// PANDA 3D SOFTWARE
7
// Copyright (c) Carnegie Mellon University. All rights reserved.
8
//
9
// All use of this software is subject to the terms of the revised BSD
10
// license. You should have received a copy of this license along
11
// with this source code in a file named "LICENSE."
12
//
13
////////////////////////////////////////////////////////////////////
14
15
#ifndef PRIMENUMBERGENERATOR_H
16
#define PRIMENUMBERGENERATOR_H
17
18
#include "dcbase.h"
19
20
#ifdef WITHIN_PANDA
21
// We only have the vector_int header file if we're compiling this
22
// package within the normal Panda environment.
23
#include "vector_int.h"
24
25
#else
26
typedef
vector<int> vector_int;
27
#endif
28
29
////////////////////////////////////////////////////////////////////
30
// Class : PrimeNumberGenerator
31
// Description : This class generates a table of prime numbers, up to
32
// the limit of an int. For a given integer n, it will
33
// return the nth prime number. This will involve a
34
// recompute step only if n is greater than any previous
35
// n.
36
////////////////////////////////////////////////////////////////////
37
class
PrimeNumberGenerator
{
38
public
:
39
PrimeNumberGenerator
();
40
41
int
operator []
(
int
n);
42
43
private
:
44
typedef
vector_int Primes;
45
Primes _primes;
46
};
47
48
#endif
PrimeNumberGenerator
This class generates a table of prime numbers, up to the limit of an int.
Definition:
primeNumberGenerator.h:37
PrimeNumberGenerator::operator[]
int operator[](int n)
Returns the nth prime number.
Definition:
primeNumberGenerator.cxx:37
Generated on Mon Feb 1 2016 13:44:14 for Panda3D by
1.8.5