// -*- mode: C++; c-file-style: "stroustrup"; c-basic-offset: 4; -*-
////////////////////////////////////////////////////////////////////
//
// $Id: invariant.h 816 2011-09-10 13:19:07Z Sebastian Kupferschmid $
//
////////////////////////////////////////////////////////////////////

#ifndef SYSTEM_INVARIANT_H
#define SYSTEM_INVARIANT_H

#include "constraint.h"
#include "constraint_container.h"

class ClockConstraint;

class Invariant : public ConstraintContainer {
public:
    Conjunction<ClockConstraint> clockconstraints;
    
    Invariant();
    
    virtual void addIntConstraint(IntConstraint* ic);
    virtual void addClockConstraint(ClockConstraint* cc);
    virtual bool isSatBy(const State* state) const;
    virtual varset_t readVars() const;
    virtual varset_t writeVars() const;
    
    bool constrain(State* state) const;

    virtual std::ostream& display(std::ostream& o) const;
};

////////////////////////////////////////////////////////////////////

inline bool Invariant::isSatBy(const State* state) const {
    return clockconstraints.isSatBy(state);
}

inline bool Invariant::constrain(State* state) const {
    return clockconstraints.constrain(state);
}

#endif /* SYSTEM_INVARIANT_H */
