gen_initial_surface_release.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_INITIAL_SURFACE_RELEASE_H
  12. #define API_GEN_INITIAL_SURFACE_RELEASE_H
  13. #include "api/api_common.h"
  14. #include "api/base_data_class.h"
  15. namespace MCell {
  16. namespace API {
  17. class InitialSurfaceRelease;
  18. class Complex;
  19. class PythonExportContext;
  20. #define INITIAL_SURFACE_RELEASE_CTOR() \
  21. InitialSurfaceRelease( \
  22. std::shared_ptr<Complex> complex_, \
  23. const int number_to_release_ = INT_UNSET, \
  24. const double density_ = FLT_UNSET \
  25. ) { \
  26. class_name = "InitialSurfaceRelease"; \
  27. complex = complex_; \
  28. number_to_release = number_to_release_; \
  29. density = density_; \
  30. postprocess_in_ctor(); \
  31. check_semantics(); \
  32. } \
  33. InitialSurfaceRelease(DefaultCtorArgType) : \
  34. GenInitialSurfaceRelease(DefaultCtorArgType()) { \
  35. set_all_attributes_as_default_or_unset(); \
  36. set_all_custom_attributes_to_default(); \
  37. }
  38. class GenInitialSurfaceRelease: public BaseDataClass {
  39. public:
  40. GenInitialSurfaceRelease() {
  41. }
  42. GenInitialSurfaceRelease(DefaultCtorArgType) {
  43. }
  44. void postprocess_in_ctor() override {}
  45. void check_semantics() const override;
  46. void set_initialized() override;
  47. void set_all_attributes_as_default_or_unset() override;
  48. std::shared_ptr<InitialSurfaceRelease> copy_initial_surface_release() const;
  49. std::shared_ptr<InitialSurfaceRelease> deepcopy_initial_surface_release(py::dict = py::dict()) const;
  50. virtual bool __eq__(const InitialSurfaceRelease& other) const;
  51. virtual bool eq_nonarray_attributes(const InitialSurfaceRelease& other, const bool ignore_name = false) const;
  52. bool operator == (const InitialSurfaceRelease& other) const { return __eq__(other);}
  53. bool operator != (const InitialSurfaceRelease& other) const { return !__eq__(other);}
  54. std::string to_str(const bool all_details=false, const std::string ind="") const override;
  55. std::string export_to_python(std::ostream& out, PythonExportContext& ctx) override;
  56. // --- attributes ---
  57. std::shared_ptr<Complex> complex;
  58. virtual void set_complex(std::shared_ptr<Complex> new_complex_) {
  59. if (initialized) {
  60. throw RuntimeError("Value 'complex' of object with name " + name + " (class " + class_name + ") "
  61. "cannot be set after model was initialized.");
  62. }
  63. cached_data_are_uptodate = false;
  64. complex = new_complex_;
  65. }
  66. virtual std::shared_ptr<Complex> get_complex() const {
  67. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  68. return complex;
  69. }
  70. int number_to_release;
  71. virtual void set_number_to_release(const int new_number_to_release_) {
  72. if (initialized) {
  73. throw RuntimeError("Value 'number_to_release' of object with name " + name + " (class " + class_name + ") "
  74. "cannot be set after model was initialized.");
  75. }
  76. cached_data_are_uptodate = false;
  77. number_to_release = new_number_to_release_;
  78. }
  79. virtual int get_number_to_release() const {
  80. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  81. return number_to_release;
  82. }
  83. double density;
  84. virtual void set_density(const double new_density_) {
  85. if (initialized) {
  86. throw RuntimeError("Value 'density' of object with name " + name + " (class " + class_name + ") "
  87. "cannot be set after model was initialized.");
  88. }
  89. cached_data_are_uptodate = false;
  90. density = new_density_;
  91. }
  92. virtual double get_density() const {
  93. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  94. return density;
  95. }
  96. // --- methods ---
  97. }; // GenInitialSurfaceRelease
  98. class InitialSurfaceRelease;
  99. py::class_<InitialSurfaceRelease> define_pybinding_InitialSurfaceRelease(py::module& m);
  100. } // namespace API
  101. } // namespace MCell
  102. #endif // API_GEN_INITIAL_SURFACE_RELEASE_H