You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
5.0 KiB

  1. /*
  2. * Update.h
  3. *
  4. * Created on: 06.01.2013
  5. * Author: Christian Dehnert
  6. */
  7. #ifndef STORM_IR_UPDATE_H_
  8. #define STORM_IR_UPDATE_H_
  9. #include <map>
  10. #include <memory>
  11. #include "expressions/BaseExpression.h"
  12. #include "Assignment.h"
  13. namespace storm {
  14. namespace parser {
  15. namespace prism {
  16. class VariableState;
  17. } // namespace prismparser
  18. } // namespace parser
  19. namespace ir {
  20. /*!
  21. * A class representing an update of a command.
  22. */
  23. class Update {
  24. public:
  25. /*!
  26. * Default constructor. Creates an empty update.
  27. */
  28. Update();
  29. /*!
  30. * Creates an update with the given expression specifying the likelihood and the mapping of
  31. * variable to their assignments.
  32. *
  33. * @param likelihoodExpression An expression specifying the likelihood of this update.
  34. * @param assignments A map of variable names to their assignments.
  35. */
  36. Update(std::shared_ptr<storm::ir::expressions::BaseExpression> const& likelihoodExpression, std::map<std::string, storm::ir::Assignment> const& booleanAssignments, std::map<std::string, storm::ir::Assignment> const& integerAssignments);
  37. /*!
  38. * Creates a copy of the given update and performs the provided renaming.
  39. *
  40. * update The update that is to be copied.
  41. * renaming A mapping from names that are to be renamed to the names they are to be
  42. * replaced with.
  43. * @param variableState An object knowing about the variables in the system.
  44. */
  45. Update(Update const& update, std::map<std::string, std::string> const& renaming, storm::parser::prism::VariableState const& variableState);
  46. /*!
  47. * Retrieves the expression for the likelihood of this update.
  48. *
  49. * @return The expression for the likelihood of this update.
  50. */
  51. std::shared_ptr<storm::ir::expressions::BaseExpression> const& getLikelihoodExpression() const;
  52. /*!
  53. * Retrieves the number of boolean assignments associated with this update.
  54. *
  55. * @return The number of boolean assignments associated with this update.
  56. */
  57. uint_fast64_t getNumberOfBooleanAssignments() const;
  58. /*!
  59. * Retrieves the number of integer assignments associated with this update.
  60. *
  61. * @return The number of integer assignments associated with this update.
  62. */
  63. uint_fast64_t getNumberOfIntegerAssignments() const;
  64. /*!
  65. * Retrieves a reference to the map of boolean variable names to their respective assignments.
  66. *
  67. * @return A reference to the map of boolean variable names to their respective assignments.
  68. */
  69. std::map<std::string, storm::ir::Assignment> const& getBooleanAssignments() const;
  70. /*!
  71. * Retrieves a reference to the map of integer variable names to their respective assignments.
  72. *
  73. * @return A reference to the map of integer variable names to their respective assignments.
  74. */
  75. std::map<std::string, storm::ir::Assignment> const& getIntegerAssignments() const;
  76. /*!
  77. * Retrieves a reference to the assignment for the boolean variable with the given name.
  78. *
  79. * @return A reference to the assignment for the boolean variable with the given name.
  80. */
  81. storm::ir::Assignment const& getBooleanAssignment(std::string const& variableName) const;
  82. /*!
  83. * Retrieves a reference to the assignment for the integer variable with the given name.
  84. *
  85. * @return A reference to the assignment for the integer variable with the given name.
  86. */
  87. storm::ir::Assignment const& getIntegerAssignment(std::string const& variableName) const;
  88. /*!
  89. * Retrieves a string representation of this update.
  90. *
  91. * @return A string representation of this update.
  92. */
  93. std::string toString() const;
  94. private:
  95. // An expression specifying the likelihood of taking this update.
  96. std::shared_ptr<storm::ir::expressions::BaseExpression> likelihoodExpression;
  97. // A mapping of boolean variable names to their assignments in this update.
  98. std::map<std::string, storm::ir::Assignment> booleanAssignments;
  99. // A mapping of integer variable names to their assignments in this update.
  100. std::map<std::string, storm::ir::Assignment> integerAssignments;
  101. };
  102. } // namespace ir
  103. } // namespace storm
  104. #endif /* STORM_IR_UPDATE_H_ */