File: Rule.h

package info (click to toggle)
structure-synth 1.5.0-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,268 kB
  • ctags: 1,966
  • sloc: cpp: 10,209; python: 164; makefile: 71; sh: 15
file content (40 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "Rendering/Renderer.h"
#include "State.h"

namespace StructureSynth {
	namespace Model {	

		
		class RuleRef; // forward decl.
		class Builder; // forward decl.

		/// (Abstract) Base class for rules.
		class Rule {
		public:
			/// Every rule must have a name.
			Rule(QString name) : name(name) { maxDepth = -1; };
			Rule() { maxDepth = -1; };

			virtual ~Rule() {};

			QString getName() const { return name; }

			/// When applied the rule will add new pending rules to the ExecutionStack for execution.
			/// Only PrimitiveRules will make use of the renderer.
			virtual void apply(Builder* builder) const = 0;

			/// Returns a list over rules that this rule references.
			virtual QList<RuleRef*> getRuleRefs() const { return QList<RuleRef*>(); }

			virtual void setMaxDepth(int maxDepth) { this->maxDepth = maxDepth; }
			virtual int getMaxDepth() const { return maxDepth; }
			
		protected:
			QString name;
			int maxDepth;
		};
	}
}