view include/Mandelbrot.h @ 4:df02a7de7fe2

I think I've got the Abstract Factory code working pretty robustly now, though I still need to make the factory singletons thread-safe
author Eris Caffee <discordia@eldalin.com>
date Tue, 26 Oct 2010 02:03:47 -0500
parents 0f4ad525f49a
children d691ce98f406
line source
1 ////////////////////////////////////////////////////////////////////////////////
2 //
3 // (C) 2010 Sarah Eris Horsley Caffee
4 //
5 // mandelbrot - A simple Mandelbrot Set viewer.
6 //
7 // Mandelbrot.h
8 // Mandelbrot set calculator class definition
9 //
10 ////////////////////////////////////////////////////////////////////////////////
12 #ifndef MANDELBROT_H
13 #define MANDELBROT_H
15 #include <string>
16 #include <typeinfo>
18 #include "SDL.h"
20 #include "Fractal.h"
22 class Mandelbrot : public Fractal
23 {
24 public:
25 Mandelbrot();
27 bool calc_set();
28 bool init(SDL_Surface * surf);
30 std::string const & get_fractal_name() const;
32 private:
34 void draw_pixel(int x, int y, Uint32 * color);
35 };
37 namespace
38 {
39 class MandelbrotCreator : public FractalCreator
40 {
41 public:
42 MandelbrotCreator()
43 {
44 get_Fractal_map()[typeid(Mandelbrot).name()]=this;
45 }
47 virtual Fractal * create() const
48 {
49 return new Mandelbrot;
50 }
51 } the_Mandelbrot_creator;
52 }
54 #endif