gen_molecule_release_info.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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_MOLECULE_RELEASE_INFO_H
  12. #define API_GEN_MOLECULE_RELEASE_INFO_H
  13. #include "api/api_common.h"
  14. #include "api/base_data_class.h"
  15. namespace MCell {
  16. namespace API {
  17. class MoleculeReleaseInfo;
  18. class Complex;
  19. class PythonExportContext;
  20. #define MOLECULE_RELEASE_INFO_CTOR() \
  21. MoleculeReleaseInfo( \
  22. std::shared_ptr<Complex> complex_, \
  23. const std::vector<double> location_ \
  24. ) { \
  25. class_name = "MoleculeReleaseInfo"; \
  26. complex = complex_; \
  27. location = location_; \
  28. postprocess_in_ctor(); \
  29. check_semantics(); \
  30. } \
  31. MoleculeReleaseInfo(DefaultCtorArgType) : \
  32. GenMoleculeReleaseInfo(DefaultCtorArgType()) { \
  33. set_all_attributes_as_default_or_unset(); \
  34. set_all_custom_attributes_to_default(); \
  35. }
  36. class GenMoleculeReleaseInfo: public BaseDataClass {
  37. public:
  38. GenMoleculeReleaseInfo() {
  39. }
  40. GenMoleculeReleaseInfo(DefaultCtorArgType) {
  41. }
  42. void postprocess_in_ctor() override {}
  43. void check_semantics() const override;
  44. void set_initialized() override;
  45. void set_all_attributes_as_default_or_unset() override;
  46. std::shared_ptr<MoleculeReleaseInfo> copy_molecule_release_info() const;
  47. std::shared_ptr<MoleculeReleaseInfo> deepcopy_molecule_release_info(py::dict = py::dict()) const;
  48. virtual bool __eq__(const MoleculeReleaseInfo& other) const;
  49. virtual bool eq_nonarray_attributes(const MoleculeReleaseInfo& other, const bool ignore_name = false) const;
  50. bool operator == (const MoleculeReleaseInfo& other) const { return __eq__(other);}
  51. bool operator != (const MoleculeReleaseInfo& other) const { return !__eq__(other);}
  52. std::string to_str(const bool all_details=false, const std::string ind="") const override;
  53. std::string export_to_python(std::ostream& out, PythonExportContext& ctx) override;
  54. virtual std::string export_vec_location(std::ostream& out, PythonExportContext& ctx, const std::string& parent_name);
  55. // --- attributes ---
  56. std::shared_ptr<Complex> complex;
  57. virtual void set_complex(std::shared_ptr<Complex> new_complex_) {
  58. if (initialized) {
  59. throw RuntimeError("Value 'complex' of object with name " + name + " (class " + class_name + ") "
  60. "cannot be set after model was initialized.");
  61. }
  62. cached_data_are_uptodate = false;
  63. complex = new_complex_;
  64. }
  65. virtual std::shared_ptr<Complex> get_complex() const {
  66. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  67. return complex;
  68. }
  69. std::vector<double> location;
  70. virtual void set_location(const std::vector<double> new_location_) {
  71. if (initialized) {
  72. throw RuntimeError("Value 'location' of object with name " + name + " (class " + class_name + ") "
  73. "cannot be set after model was initialized.");
  74. }
  75. cached_data_are_uptodate = false;
  76. location = new_location_;
  77. }
  78. virtual std::vector<double>& get_location() {
  79. cached_data_are_uptodate = false; // arrays and other data can be modified through getters
  80. return location;
  81. }
  82. // --- methods ---
  83. }; // GenMoleculeReleaseInfo
  84. class MoleculeReleaseInfo;
  85. py::class_<MoleculeReleaseInfo> define_pybinding_MoleculeReleaseInfo(py::module& m);
  86. } // namespace API
  87. } // namespace MCell
  88. #endif // API_GEN_MOLECULE_RELEASE_INFO_H