initial revision
[lsystem3d.git] / src / ruleset.h
diff --git a/src/ruleset.h b/src/ruleset.h
new file mode 100644 (file)
index 0000000..63575a5
--- /dev/null
@@ -0,0 +1,84 @@
+// Copyright (C) 2006 Erik Dahlberg
+// 
+// This file is part of LSystem3D.
+// 
+// LSystem3D is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+// 
+// LSystem3D is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with LSystem3D; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+
+
+#ifndef RULESET_H
+#define RULESET_H
+
+#include <map>
+#include <string>
+
+#include "rule.h"
+
+using namespace std;
+
+typedef multimap<string, Rule> rulemap;
+
+
+
+/**
+ * Set of L-system rules
+ */
+class RuleSet
+{
+public:
+    
+    /**
+     * Constructor
+     */
+    RuleSet();
+
+    /**
+     * Destructor
+     */
+    ~RuleSet();
+    
+    /**
+     * Clear rule set
+     */
+    void clear();
+    
+    /**
+     * Add one rule
+     * @param rule the rule
+     */
+    void addRule(Rule rule);
+    
+    /**
+     * Get one rule with repect of probability factor
+     * @param name the rule name
+     * @return the rule
+     */
+    Rule findRule(string ruleName);
+    
+    /**
+     * Get all rules
+     * @return the rules
+     */
+    rulemap getRules();
+    
+protected:
+    
+    rulemap _rules;
+};
+
+
+
+#endif