#pragma once #include #include #include "src/adapters/DereferenceIteratorAdapter.h" #include "src/storage/jani/BooleanVariable.h" #include "src/storage/jani/UnboundedIntegerVariable.h" #include "src/storage/jani/BoundedIntegerVariable.h" #include "src/storage/jani/RealVariable.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; /*! * 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); /*! * 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 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; /*! * 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 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 a vector of transient variables in this variable set. */ std::vector> 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; 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; /// A set of all variable names currently in use. std::map nameToVariable; /// A mapping from expression variables to their variable objects. std::map> variableToVariable; }; } }