void PointCloudBase::onPluginUnloading(const PluginStatus& status) { boost::recursive_mutex::scoped_lock lock(transformers_mutex_); typedef std::set<std::string> S_string; S_string to_erase; bool xyz_unloaded = false; bool color_unloaded = false; M_TransformerInfo::iterator it = transformers_.begin(); M_TransformerInfo::iterator end = transformers_.end(); for (; it != end; ++it) { const std::string& name = it->first; TransformerInfo& info = it->second; if (info.plugin != status.plugin) { continue; } if (name == xyz_transformer_) { xyz_unloaded = true; } if (name == color_transformer_) { color_unloaded = true; } to_erase.insert(it->first); if (property_manager_) { deleteProperties(property_manager_, info.xyz_props); deleteProperties(property_manager_, info.color_props); } info.transformer.reset(); } { S_string::iterator it = to_erase.begin(); S_string::iterator end = to_erase.end(); for (; it != end; ++it) { transformers_.erase(*it); } } if (xyz_unloaded || color_unloaded) { boost::mutex::scoped_lock lock(clouds_mutex_); if (!clouds_.empty()) { updateTransformers((*clouds_.rbegin())->message_, true); } } }
PointCloudBase::~PointCloudBase() { spinner_.stop(); if (coll_handle_) { SelectionManager* sel_manager = vis_manager_->getSelectionManager(); sel_manager->removeObject(coll_handle_); } scene_manager_->destroySceneNode(scene_node_->getName()); delete cloud_; if (property_manager_) { M_TransformerInfo::iterator it = transformers_.begin(); M_TransformerInfo::iterator end = transformers_.end(); for (; it != end; ++it) { deleteProperties(property_manager_, it->second.xyz_props); deleteProperties(property_manager_, it->second.color_props); } } { M_PluginConns::iterator it = plugin_conns_.begin(); M_PluginConns::iterator end = plugin_conns_.end(); for (; it != end; ++it) { } } }
// ------------------ destructor --------------------- MultiComponent::~MultiComponent() { deleteProperties(); deleteAllSubComponents(); // tell all parents that I am going away to the paradise of pointers removeFromParents(); }
virtual void serialize(PropertyBase* v) { Property<PropertyBag>* bag = dynamic_cast< Property<PropertyBag>* >( v ); if ( bag ) this->serialize( *bag ); else { Property<char>* Pc = dynamic_cast< Property<char>* >( v ); if ( Pc ) { store(Pc); return; } Property<short>* Ps = dynamic_cast< Property<short>* >( v ); if (Ps) { store(Ps); return; } Property<int>* Pi = dynamic_cast< Property<int>* >( v ); if (Pi) { store(Pi); return; } Property<float>* Pf = dynamic_cast< Property<float>* >( v ); if (Pf) { store(Pf); return; } Property<double>* Pd = dynamic_cast< Property<double>* >( v ); if (Pd) { store(Pd); return; } Property<std::vector<double> >* Pv = dynamic_cast< Property<std::vector<double> >* >( v ); if (Pv) { store(Pv); return; } Property<PropertyBag> bag( v->getName(), ""); v->getTypeInfo()->decomposeType( v->getDataSource(), bag.value() ); this->serialize( bag ); deleteProperties( bag.value() ); } }
//----------------------- Destructor ----------------------- Cell::~Cell() { // delete the structural component properties deleteProperties(); // if (Structure::properties) delete (CellProperties*) Structure::properties; if (StructuralComponent::atomList) delete StructuralComponent::atomList; StructuralComponent::atomList = NULL; // delete all children deleteAllStructures(); // tell all parents that I am going away to the paradise of pointers removeFromParents(); }