/****************************************************************************** * * Copyright (C) 2021 by * The Salk Institute for Biological Studies * * Use of this source code is governed by an MIT-style * license that can be found in the LICENSE file or at * https://opensource.org/licenses/MIT. * ******************************************************************************/ #ifndef API_GEN_OBSERVABLES_H #define API_GEN_OBSERVABLES_H #include "api/api_common.h" #include "api/base_export_class.h" namespace MCell { namespace API { class Observables; class Count; class VizOutput; class PythonExportContext; #define OBSERVABLES_CTOR() \ Observables( \ const std::vector> viz_outputs_ = std::vector>(), \ const std::vector> counts_ = std::vector>() \ ) { \ viz_outputs = viz_outputs_; \ counts = counts_; \ } \ Observables(DefaultCtorArgType){ \ } class GenObservables: public BaseExportClass { public: GenObservables() { } GenObservables(DefaultCtorArgType) { } virtual ~GenObservables() {} std::shared_ptr copy_observables() const; std::shared_ptr deepcopy_observables(py::dict = py::dict()) const; virtual bool __eq__(const Observables& other) const; virtual bool eq_nonarray_attributes(const Observables& other, const bool ignore_name = false) const; bool operator == (const Observables& other) const { return __eq__(other);} bool operator != (const Observables& other) const { return !__eq__(other);} std::string to_str(const bool all_details=false, const std::string ind="") const ; virtual std::string export_to_python(std::ostream& out, PythonExportContext& ctx); virtual std::string export_vec_viz_outputs(std::ostream& out, PythonExportContext& ctx, const std::string& parent_name); virtual std::string export_vec_counts(std::ostream& out, PythonExportContext& ctx, const std::string& parent_name); // --- attributes --- std::vector> viz_outputs; virtual void set_viz_outputs(const std::vector> new_viz_outputs_) { viz_outputs = new_viz_outputs_; } virtual std::vector>& get_viz_outputs() { return viz_outputs; } std::vector> counts; virtual void set_counts(const std::vector> new_counts_) { counts = new_counts_; } virtual std::vector>& get_counts() { return counts; } // --- methods --- virtual void add_viz_output(std::shared_ptr viz_output) = 0; virtual void add_count(std::shared_ptr count) = 0; virtual std::shared_ptr find_count(const std::string& name) = 0; virtual void load_bngl_observables(const std::string& file_name, const std::string& observables_path_or_file = STR_UNSET, const std::map& parameter_overrides = std::map(), const CountOutputFormat observables_output_format = CountOutputFormat::AUTOMATIC_FROM_EXTENSION) = 0; }; // GenObservables class Observables; py::class_ define_pybinding_Observables(py::module& m); } // namespace API } // namespace MCell #endif // API_GEN_OBSERVABLES_H