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 41 42 43 44
|
#pragma once
#include "RuleRef.h"
#include "TransformationLoop.h"
namespace StructureSynth {
namespace Model {
struct SetAction {
QString key;
QString value;
};
/// An actions is a number of loops, that is applied to a rule.
///
/// Rules with only one transformation, e.g.:
/// { x 1 } R1
/// are represented as a loop transformation with one repetitions.
class Action {
public:
Action(Transformation t, QString ruleName);
Action(QString ruleName);
Action(QString key, QString value);
Action() { rule = 0; set = 0; }
void addTransformationLoop(TransformationLoop tl);
void setRule(QString rule);
~Action();
/// If 'callingRule' != 0 the new states generated will be set with
/// a depth equal to 'ruleDepth'
void apply(Builder* b, const Rule* callingRule, int ruleDepth) const;
RuleRef* getRuleRef() const { return rule; }
private:
QList<TransformationLoop> loops;
RuleRef* rule; // The rule that will be called after all transformations.
SetAction* set;
};
}
}
|