view host/Rule.h @ 17:3cbd40805795 tip

Remove obsolete stuff from README
author Chris Cannam
date Tue, 03 Dec 2013 16:33:08 +0000
parents 10715d2b3069
children
line wrap: on
line source
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */

#ifndef _RULE_H_
#define _RULE_H_

#include <vector>

#include "Action.h"

class Condition
{
public:
    enum Type {
        EqualTo,
        GreaterThan,
        LessThan,
        NotEqualTo,
        Present,
        Changed,
        GapGreaterThan,
        GapLessThan
    };

    Condition(int pluginIndex, int outputNumber,
              Type type, float argument = 0.f) :
        m_pluginIndex(pluginIndex),
        m_outputNumber(outputNumber),
        m_type(type),
        m_argument(argument)
    { }

    int getPluginIndex() const { return m_pluginIndex; }
    int getOutputNumber() const { return m_outputNumber; }
    Type getType() const { return m_type; }
    float getArgument() const { return m_argument; }

protected:
    int m_pluginIndex;
    int m_outputNumber;
    Type m_type;
    float m_argument;
};

class Rule
{
public:
    Rule() { }
    virtual ~Rule();

    void addCondition(Condition condition);
    void addAction(Action *action); // I take ownership of action

    typedef std::vector<Condition> ConditionList;
    const ConditionList &getConditions() const { return m_conditions; }

    typedef std::vector<Action *> ActionList;
    const ActionList &getActions() const { return m_actions; }

protected:
    ConditionList m_conditions;
    ActionList m_actions;
};

#endif