TODO: add entries for centralizing licensing and authorship information and incorpora...
[Ale.git] / d2 / render / invariant.h
blob1ba42b3adb3de639c7220404634667d52667a66e
1 // Copyright 2004 David Hilvert <dhilvert@auricle.dyndns.org>,
2 // <dhilvert@ugcs.caltech.edu>
4 /* This file is part of the Anti-Lamenessing Engine.
6 The Anti-Lamenessing Engine is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 The Anti-Lamenessing Engine is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with the Anti-Lamenessing Engine; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef __invariant_h__
22 #define __invariant_h__
24 #include "../filter.h"
27 * Class for incremental renderer invariants.
30 #define min 0
31 #define max 1
32 #define avg 2
33 #define first 3
34 #define last 4
35 #define median 5
37 class invariant {
38 public:
39 int type;
40 filter::ssfe *s;
42 invariant(filter::ssfe *s) {
43 this->s = s;
44 type = 2;
46 int equals(const invariant *i) const {
47 return (i->type == type
48 && s->equals(i->ssfe()));
50 const filter::ssfe *ssfe() const {
51 return s;
53 int is_max() const {
54 return type == max;
56 int is_min() const {
57 return type == min;
59 int is_avg() const {
60 return type == avg;
62 int is_first() const {
63 return type == first;
65 int is_last() const {
66 return type == last;
68 int is_median() const {
69 return type == median;
71 void set_max() {
72 type = max;
74 void set_min() {
75 type = min;
77 void set_avg() {
78 type = avg;
80 void set_first() {
81 type = first;
83 void set_last() {
84 type = last;
86 void set_median() {
87 type = median;
89 ~invariant() {
90 delete s;
94 #undef min
95 #undef max
96 #undef avg
97 #undef first
98 #undef last
100 #endif