gen_notifications.h 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2021 by
  4. * The Salk Institute for Biological Studies
  5. *
  6. * Use of this source code is governed by an MIT-style
  7. * license that can be found in the LICENSE file or at
  8. * https://opensource.org/licenses/MIT.
  9. *
  10. ******************************************************************************/
  11. #ifndef API_GEN_NOTIFICATIONS_H
  12. #define API_GEN_NOTIFICATIONS_H
  13. #include "api/api_common.h"
  14. #include "api/base_data_class.h"
  15. namespace MCell {
  16. namespace API {
  17. class Notifications;
  18. class PythonExportContext;
  19. #define NOTIFICATIONS_CTOR() \
  20. Notifications( \
  21. const int bng_verbosity_level_ = 0, \
  22. const bool rxn_and_species_report_ = false, \
  23. const int simulation_stats_every_n_iterations_ = 0, \
  24. const bool rxn_probability_changed_ = true, \
  25. const bool iteration_report_ = true, \
  26. const bool wall_overlap_report_ = false \
  27. ) { \
  28. class_name = "Notifications"; \
  29. bng_verbosity_level = bng_verbosity_level_; \
  30. rxn_and_species_report = rxn_and_species_report_; \
  31. simulation_stats_every_n_iterations = simulation_stats_every_n_iterations_; \
  32. rxn_probability_changed = rxn_probability_changed_; \
  33. iteration_report = iteration_report_; \
  34. wall_overlap_report = wall_overlap_report_; \
  35. postprocess_in_ctor(); \
  36. check_semantics(); \
  37. } \
  38. Notifications(DefaultCtorArgType) : \
  39. GenNotifications(DefaultCtorArgType()) { \
  40. set_all_attributes_as_default_or_unset(); \
  41. set_all_custom_attributes_to_default(); \
  42. }
  43. class GenNotifications: public BaseDataClass {
  44. public:
  45. GenNotifications() {
  46. }
  47. GenNotifications(DefaultCtorArgType) {
  48. }
  49. void postprocess_in_ctor() override {}
  50. void check_semantics() const override;
  51. void set_initialized() override;
  52. void set_all_attributes_as_default_or_unset() override;
  53. std::shared_ptr<Notifications> copy_notifications() const;
  54. std::shared_ptr<Notifications> deepcopy_notifications(py::dict = py::dict()) const;
  55. virtual bool __eq__(const Notifications& other) const;
  56. virtual bool eq_nonarray_attributes(const Notifications& other, const bool ignore_name = false) const;
  57. bool operator == (const Notifications& other) const { return __eq__(other);}
  58. bool operator != (const Notifications& other) const { return !__eq__(other);}
  59. std::string to_str(const bool all_details=false, const std::string ind="") const override;
  60. std::string export_to_python(std::ostream& out, PythonExportContext& ctx) override;
  61. // --- attributes ---
  62. int bng_verbosity_level;
  63. virtual void set_bng_verbosity_level(const int new_bng_verbosity_level_) {
  64. if (initialized) {
  65. throw RuntimeError("Value 'bng_verbosity_level' of object with name " + name + " (class " + class_name + ") "
  66. "cannot be set after model was initialized.");
  67. }
  68. cached_data_are_uptodate = false;
  69. bng_verbosity_level = new_bng_verbosity_level_;
  70. }
  71. virtual int get_bng_verbosity_level() const {
  72. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  73. return bng_verbosity_level;
  74. }
  75. bool rxn_and_species_report;
  76. virtual void set_rxn_and_species_report(const bool new_rxn_and_species_report_) {
  77. if (initialized) {
  78. throw RuntimeError("Value 'rxn_and_species_report' of object with name " + name + " (class " + class_name + ") "
  79. "cannot be set after model was initialized.");
  80. }
  81. cached_data_are_uptodate = false;
  82. rxn_and_species_report = new_rxn_and_species_report_;
  83. }
  84. virtual bool get_rxn_and_species_report() const {
  85. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  86. return rxn_and_species_report;
  87. }
  88. int simulation_stats_every_n_iterations;
  89. virtual void set_simulation_stats_every_n_iterations(const int new_simulation_stats_every_n_iterations_) {
  90. if (initialized) {
  91. throw RuntimeError("Value 'simulation_stats_every_n_iterations' of object with name " + name + " (class " + class_name + ") "
  92. "cannot be set after model was initialized.");
  93. }
  94. cached_data_are_uptodate = false;
  95. simulation_stats_every_n_iterations = new_simulation_stats_every_n_iterations_;
  96. }
  97. virtual int get_simulation_stats_every_n_iterations() const {
  98. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  99. return simulation_stats_every_n_iterations;
  100. }
  101. bool rxn_probability_changed;
  102. virtual void set_rxn_probability_changed(const bool new_rxn_probability_changed_) {
  103. if (initialized) {
  104. throw RuntimeError("Value 'rxn_probability_changed' of object with name " + name + " (class " + class_name + ") "
  105. "cannot be set after model was initialized.");
  106. }
  107. cached_data_are_uptodate = false;
  108. rxn_probability_changed = new_rxn_probability_changed_;
  109. }
  110. virtual bool get_rxn_probability_changed() const {
  111. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  112. return rxn_probability_changed;
  113. }
  114. bool iteration_report;
  115. virtual void set_iteration_report(const bool new_iteration_report_) {
  116. if (initialized) {
  117. throw RuntimeError("Value 'iteration_report' of object with name " + name + " (class " + class_name + ") "
  118. "cannot be set after model was initialized.");
  119. }
  120. cached_data_are_uptodate = false;
  121. iteration_report = new_iteration_report_;
  122. }
  123. virtual bool get_iteration_report() const {
  124. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  125. return iteration_report;
  126. }
  127. bool wall_overlap_report;
  128. virtual void set_wall_overlap_report(const bool new_wall_overlap_report_) {
  129. if (initialized) {
  130. throw RuntimeError("Value 'wall_overlap_report' of object with name " + name + " (class " + class_name + ") "
  131. "cannot be set after model was initialized.");
  132. }
  133. cached_data_are_uptodate = false;
  134. wall_overlap_report = new_wall_overlap_report_;
  135. }
  136. virtual bool get_wall_overlap_report() const {
  137. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  138. return wall_overlap_report;
  139. }
  140. // --- methods ---
  141. }; // GenNotifications
  142. class Notifications;
  143. py::class_<Notifications> define_pybinding_Notifications(py::module& m);
  144. } // namespace API
  145. } // namespace MCell
  146. #endif // API_GEN_NOTIFICATIONS_H