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.

114 lines
6.6 KiB

  1. #ifndef SYLVAN_STORM_FUNCTION_WRAPPER_H
  2. #define SYLVAN_STORM_FUNCTION_WRAPPER_H
  3. #include <stdint.h>
  4. #include <stdio.h>
  5. #include <sylvan.h>
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. /***************************************************
  10. Function-wrappers for storm::RationalNumber
  11. ****************************************************/
  12. typedef void* storm_rational_number_ptr;
  13. // Functions that are registered to sylvan for the rational number type.
  14. void storm_rational_number_init(storm_rational_number_ptr* a);
  15. void storm_rational_number_destroy(storm_rational_number_ptr a);
  16. int storm_rational_number_equals(storm_rational_number_ptr a, storm_rational_number_ptr b);
  17. char* storm_rational_number_to_str(storm_rational_number_ptr val, char *buf, size_t buflen);
  18. // Fundamental functions.
  19. storm_rational_number_ptr storm_rational_number_clone(storm_rational_number_ptr a);
  20. storm_rational_number_ptr storm_rational_number_get_zero();
  21. storm_rational_number_ptr storm_rational_number_get_one();
  22. storm_rational_number_ptr storm_rational_number_get_infinity();
  23. int storm_rational_number_is_zero(storm_rational_number_ptr a);
  24. uint64_t storm_rational_number_hash(storm_rational_number_ptr const a, uint64_t const seed);
  25. double storm_rational_number_get_value_double(storm_rational_number_ptr a);
  26. storm_rational_number_ptr storm_rational_number_from_double(double value);
  27. // Binary operations.
  28. storm_rational_number_ptr storm_rational_number_plus(storm_rational_number_ptr a, storm_rational_number_ptr b);
  29. storm_rational_number_ptr storm_rational_number_minus(storm_rational_number_ptr a, storm_rational_number_ptr b);
  30. storm_rational_number_ptr storm_rational_number_times(storm_rational_number_ptr a, storm_rational_number_ptr b);
  31. storm_rational_number_ptr storm_rational_number_divide(storm_rational_number_ptr a, storm_rational_number_ptr b);
  32. storm_rational_number_ptr storm_rational_number_pow(storm_rational_number_ptr a, storm_rational_number_ptr b);
  33. storm_rational_number_ptr storm_rational_number_mod(storm_rational_number_ptr a, storm_rational_number_ptr b);
  34. storm_rational_number_ptr storm_rational_number_min(storm_rational_number_ptr a, storm_rational_number_ptr b);
  35. storm_rational_number_ptr storm_rational_number_max(storm_rational_number_ptr a, storm_rational_number_ptr b);
  36. // Binary relations.
  37. int storm_rational_number_less(storm_rational_number_ptr a, storm_rational_number_ptr b);
  38. int storm_rational_number_less_or_equal(storm_rational_number_ptr a, storm_rational_number_ptr b);
  39. // Unary operations.
  40. storm_rational_number_ptr storm_rational_number_negate(storm_rational_number_ptr a);
  41. storm_rational_number_ptr storm_rational_number_floor(storm_rational_number_ptr a);
  42. storm_rational_number_ptr storm_rational_number_ceil(storm_rational_number_ptr a);
  43. storm_rational_number_ptr storm_double_sharpen(double value, size_t precision);
  44. storm_rational_number_ptr storm_rational_number_sharpen(storm_rational_number_ptr a, size_t precision);
  45. // Other operations.
  46. int storm_rational_number_equal_modulo_precision(int relative, storm_rational_number_ptr a, storm_rational_number_ptr b, storm_rational_number_ptr precision);
  47. // Printing functions.
  48. void print_storm_rational_number(storm_rational_number_ptr a);
  49. void print_storm_rational_number_to_file(storm_rational_number_ptr a, FILE* out);
  50. /***************************************************
  51. Function-wrappers for storm::RationalFunction
  52. ****************************************************/
  53. typedef void* storm_rational_function_ptr;
  54. // Functions that are registered to sylvan for the rational function type.
  55. void storm_rational_function_init(storm_rational_function_ptr* a);
  56. void storm_rational_function_destroy(storm_rational_function_ptr a);
  57. int storm_rational_function_equals(storm_rational_function_ptr a, storm_rational_function_ptr b);
  58. char* storm_rational_function_to_str(storm_rational_function_ptr val, char *buf, size_t buflen);
  59. // Fundamental functions.
  60. storm_rational_function_ptr storm_rational_function_clone(storm_rational_function_ptr a);
  61. storm_rational_function_ptr storm_rational_function_get_zero();
  62. storm_rational_function_ptr storm_rational_function_get_one();
  63. storm_rational_number_ptr storm_rational_function_get_infinity();
  64. int storm_rational_function_is_zero(storm_rational_function_ptr a);
  65. uint64_t storm_rational_function_hash(storm_rational_function_ptr const a, uint64_t const seed);
  66. double storm_rational_function_get_value_double(storm_rational_function_ptr a);
  67. // Binary operations.
  68. storm_rational_function_ptr storm_rational_function_plus(storm_rational_function_ptr a, storm_rational_function_ptr b);
  69. storm_rational_function_ptr storm_rational_function_minus(storm_rational_function_ptr a, storm_rational_function_ptr b);
  70. storm_rational_function_ptr storm_rational_function_times(storm_rational_function_ptr a, storm_rational_function_ptr b);
  71. storm_rational_function_ptr storm_rational_function_divide(storm_rational_function_ptr a, storm_rational_function_ptr b);
  72. storm_rational_function_ptr storm_rational_function_pow(storm_rational_function_ptr a, storm_rational_function_ptr b);
  73. storm_rational_function_ptr storm_rational_function_mod(storm_rational_function_ptr a, storm_rational_function_ptr b);
  74. storm_rational_function_ptr storm_rational_function_min(storm_rational_function_ptr a, storm_rational_function_ptr b);
  75. storm_rational_function_ptr storm_rational_function_max(storm_rational_function_ptr a, storm_rational_function_ptr b);
  76. // Binary relations.
  77. int storm_rational_function_less(storm_rational_function_ptr a, storm_rational_function_ptr b);
  78. int storm_rational_function_less_or_equal(storm_rational_function_ptr a, storm_rational_function_ptr b);
  79. // Unary operations.
  80. storm_rational_function_ptr storm_rational_function_negate(storm_rational_function_ptr a);
  81. storm_rational_function_ptr storm_rational_function_floor(storm_rational_function_ptr a);
  82. storm_rational_function_ptr storm_rational_function_ceil(storm_rational_function_ptr a);
  83. // Other operations.
  84. int storm_rational_function_equal_modulo_precision(int relative, storm_rational_function_ptr a, storm_rational_function_ptr b, storm_rational_function_ptr precision);
  85. // Printing functions.
  86. void print_storm_rational_function(storm_rational_function_ptr a);
  87. void print_storm_rational_function_to_file(storm_rational_function_ptr a, FILE* out);
  88. #ifdef __cplusplus
  89. }
  90. #endif
  91. #endif // SYLVAN_STORM_FUNCTION_WRAPPER_H