.. _program_listing_file_src_flamegpu_model_SubEnvironmentData.cpp: Program Listing for File SubEnvironmentData.cpp =============================================== |exhale_lsh| :ref:`Return to documentation for file ` (``src/flamegpu/model/SubEnvironmentData.cpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #include "flamegpu/model/SubEnvironmentData.h" #include "flamegpu/model/SubEnvironmentDescription.h" #include "flamegpu/model/ModelData.h" #include "flamegpu/model/SubModelData.h" namespace flamegpu { SubEnvironmentData::SubEnvironmentData(std::shared_ptr _model, const std::shared_ptr &_parent, const SubEnvironmentData &other) : model(std::move(_model)) , subEnvironment(_parent->submodel->environment) // These two can only fail if the submodeldesc is cloned before the submodel , masterEnvironment(_model->environment) , parent(_parent) { properties.insert(other.properties.begin(), other.properties.end()); macro_properties.insert(other.macro_properties.begin(), other.macro_properties.end()); directed_graphs.insert(other.directed_graphs.begin(), other.directed_graphs.end()); } SubEnvironmentData::SubEnvironmentData( std::shared_ptr _model, const std::shared_ptr &_parent, const std::shared_ptr &_subEnvironment) : model(std::move(_model)) , subEnvironment(_parent->submodel->environment) , masterEnvironment(_model->environment) , parent(_parent) { } bool SubEnvironmentData::operator==(const SubEnvironmentData& rhs) const { if (this == &rhs) // They point to same object return true; // Compare members if (properties == rhs.properties && macro_properties == rhs.macro_properties && directed_graphs == rhs.directed_graphs // && model.lock() == rhs.model.lock() // Don't check weak pointers // && masterEnvironment.lock() == rhs.masterEnvironment.lock() // Skipping any equality here feels unsafe ) { return true; } return false; } bool SubEnvironmentData::operator!=(const SubEnvironmentData& rhs) const { return !(*this == rhs); } } // namespace flamegpu