| 1 | // Copyright (C) 2006 Erik Dahlberg |
| 2 | // |
| 3 | // This file is part of LSystem3D. |
| 4 | // |
| 5 | // LSystem3D is free software; you can redistribute it and/or |
| 6 | // modify it under the terms of the GNU General Public License |
| 7 | // as published by the Free Software Foundation; either version 2 |
| 8 | // of the License, or (at your option) any later version. |
| 9 | // |
| 10 | // LSystem3D is distributed in the hope that it will be useful, |
| 11 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | // GNU General Public License for more details. |
| 14 | // |
| 15 | // You should have received a copy of the GNU General Public License |
| 16 | // along with LSystem3D; if not, write to the Free Software |
| 17 | // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | #ifndef RULESET_H |
| 23 | #define RULESET_H |
| 24 | |
| 25 | #include <map> |
| 26 | #include <string> |
| 27 | |
| 28 | #include "rule.h" |
| 29 | |
| 30 | using namespace std; |
| 31 | |
| 32 | typedef multimap<string, Rule> rulemap; |
| 33 | |
| 34 | |
| 35 | |
| 36 | /** |
| 37 | * Set of L-system rules |
| 38 | */ |
| 39 | class RuleSet |
| 40 | { |
| 41 | public: |
| 42 | |
| 43 | /** |
| 44 | * Constructor |
| 45 | */ |
| 46 | RuleSet(); |
| 47 | |
| 48 | /** |
| 49 | * Destructor |
| 50 | */ |
| 51 | ~RuleSet(); |
| 52 | |
| 53 | /** |
| 54 | * Clear rule set |
| 55 | */ |
| 56 | void clear(); |
| 57 | |
| 58 | /** |
| 59 | * Add one rule |
| 60 | * @param rule the rule |
| 61 | */ |
| 62 | void addRule(Rule rule); |
| 63 | |
| 64 | /** |
| 65 | * Get one rule with repect of probability factor |
| 66 | * @param name the rule name |
| 67 | * @return the rule |
| 68 | */ |
| 69 | Rule findRule(string ruleName); |
| 70 | |
| 71 | /** |
| 72 | * Get all rules |
| 73 | * @return the rules |
| 74 | */ |
| 75 | rulemap getRules(); |
| 76 | |
| 77 | protected: |
| 78 | |
| 79 | rulemap _rules; |
| 80 | }; |
| 81 | |
| 82 | |
| 83 | |
| 84 | #endif |