#pragma once #include #include #include "storm/adapters/DereferenceIteratorAdapter.h" #include "storm/storage/jani/BooleanVariable.h" #include "storm/storage/jani/UnboundedIntegerVariable.h" #include "storm/storage/jani/BoundedIntegerVariable.h" #include "storm/storage/jani/RealVariable.h" #include "storm/storage/jani/ArrayVariable.h" #include "storm/storage/jani/ClockVariable.h" namespace storm { namespace jani { namespace detail { template using Variables = storm::adapters::DereferenceIteratorAdapter>>; template using ConstVariables = storm::adapters::DereferenceIteratorAdapter> const>; } class VariableSet { public: /*! * Creates an empty variable set. */ VariableSet(); /*! * Retrieves the boolean variables in this set. */ detail::Variables getBooleanVariables(); /*! * Retrieves the boolean variables in this set. */ detail::ConstVariables getBooleanVariables() const; /*! * Retrieves the bounded integer variables in this set. */ detail::Variables getBoundedIntegerVariables(); /*! * Retrieves the bounded integer variables in this set. */ detail::ConstVariables getBoundedIntegerVariables() const; /*! * Retrieves the unbounded integer variables in this set. */ detail::Variables getUnboundedIntegerVariables(); /*! * Retrieves the unbounded integer variables in this set. */ detail::ConstVariables getUnboundedIntegerVariables() const; /*! * Retrieves the real variables in this set. */ detail::Variables getRealVariables(); /*! * Retrieves the real variables in this set. */ detail::ConstVariables getRealVariables() const; /*! * Retrieves the Array variables in this set. */ detail::Variables getArrayVariables(); /*! * Retrieves the Array variables in this set. */ detail::ConstVariables getArrayVariables() const; /*! * Retrieves the clock variables in this set. */ detail::Variables getClockVariables(); /*! * Retrieves the clock variables in this set. */ detail::ConstVariables getClockVariables() const; /*! * Adds the given variable to this set. */ Variable const& addVariable(Variable const& variable); /*! * Adds the given boolean variable to this set. */ BooleanVariable const& addVariable(BooleanVariable const& variable); /*! * Adds the given bounded integer variable to this set. */ BoundedIntegerVariable const& addVariable(BoundedIntegerVariable const& variable); /*! * Adds the given unbounded integer variable to this set. */ UnboundedIntegerVariable const& addVariable(UnboundedIntegerVariable const& variable); /*! * Adds the given real variable to this set. */ RealVariable const& addVariable(RealVariable const& variable); /*! * Adds the given array variable to this set. */ ArrayVariable const& addVariable(ArrayVariable const& variable); /*! * Removes all array variables in this set */ std::vector> dropAllArrayVariables(); /*! * Adds the given clock variable to this set. */ ClockVariable const& addVariable(ClockVariable const& variable); /*! * Retrieves whether this variable set contains a variable with the given name. */ bool hasVariable(std::string const& name) const; /*! * Retrieves the variable with the given name. */ Variable const& getVariable(std::string const& name) const; /*! * Retrieves whether this variable set contains a given variable. */ bool hasVariable(storm::jani::Variable const& variable) const; /*! * Retrieves whether this variable set contains a variable with the expression variable. */ bool hasVariable(storm::expressions::Variable const& variable) const; /*! * Retrieves the variable object associated with the given expression variable (if any). */ Variable const& getVariable(storm::expressions::Variable const& variable) const; /*! * Erases the given variable from this set. */ std::shared_ptr eraseVariable(storm::expressions::Variable const& variable); /*! * Retrieves whether this variable set contains a transient variable. */ bool hasTransientVariable() const; /*! * Retrieves an iterator to the variables in this set. */ typename detail::Variables::iterator begin(); /*! * Retrieves an iterator to the variables in this set. */ typename detail::ConstVariables::iterator begin() const; /*! * Retrieves the end iterator to the variables in this set. */ typename detail::Variables::iterator end(); /*! * Retrieves the end iterator to the variables in this set. */ typename detail::ConstVariables::iterator end() const; /*! * Retrieves whether the set of variables contains a boolean variable. */ bool containsBooleanVariable() const; /*! * Retrieves whether the set of variables contains a bounded integer variable. */ bool containsBoundedIntegerVariable() const; /*! * Retrieves whether the set of variables contains an unbounded integer variable. */ bool containsUnboundedIntegerVariables() const; /*! * Retrieves whether the set of variables contains a real variable. */ bool containsRealVariables() const; /*! * Retrieves whether the set of variables contains a Array variable. */ bool containsArrayVariables() const; /*! * Retrieves whether the set of variables contains a clock variable. */ bool containsClockVariables() const; /*! * Retrieves whether the set of variables contains a non-transient real variable. */ bool containsNonTransientRealVariables() const; /*! * Retrieves whether the set of variables contains a non-transient unbounded integer variable. */ bool containsNonTransientUnboundedIntegerVariables() const; /*! * Retrieves whether this variable set is empty. */ bool empty() const; /*! * Retrieves the number of transient variables in this variable set. */ uint_fast64_t getNumberOfTransientVariables() const; /*! * Retrieves the number of real transient variables in this variable set. */ uint_fast64_t getNumberOfRealTransientVariables() const; /*! * Retrieves the number of unbounded integer transient variables in this variable set. */ uint_fast64_t getNumberOfUnboundedIntegerTransientVariables() const; /*! * Retrieves the number of numerical (i.e. real, or integer) transient variables in this variable set. */ uint_fast64_t getNumberOfNumericalTransientVariables() const; /*! * Retrieves the transient variables in this variable set. */ typename detail::ConstVariables getTransientVariables() const; /*! * Checks whether any of the provided variables appears in bound expressions or initial values of the * variables contained in this variable set. */ bool containsVariablesInBoundExpressionsOrInitialValues(std::set const& variables) const; /*! * Retrieves a mapping from variable names to (references of) the variable objects. */ std::map> getNameToVariableMap() const; private: /// The vector of all variables. std::vector> variables; /// The boolean variables in this set. std::vector> booleanVariables; /// The bounded integer variables in this set. std::vector> boundedIntegerVariables; /// The unbounded integer variables in this set. std::vector> unboundedIntegerVariables; /// The real variables in this set. std::vector> realVariables; /// The array variables in this set. std::vector> arrayVariables; /// The clock variables in this set. std::vector> clockVariables; /// The transient variables in this set. std::vector> transientVariables; /// A set of all variable names currently in use. std::map nameToVariable; /// A mapping from expression variables to their variable objects. std::map> variableToVariable; }; } }