DdsSubscriberRepository::~DdsSubscriberRepository() throw() { // just to make sure, the repository should actually be empty at this point. InstanceMap::iterator first, last = instances_.end(); for (first = instances_.begin(); first != last; ++first) { // delete first->second; DDS::Subscriber * sub = dynamic_cast<DDS::Subscriber *>(first->second); DDS::DomainParticipant * participant = sub->get_participant(); DDS::ReturnCode_t rc = participant->delete_subscriber(sub); if (rc != DDS_RETCODE_OK) { MIRO_LOG_OSTR(LL_ERROR, "Error deleting DDS subscriber: " << DdsSupport::getError(rc)); } } instances_.clear(); }
void DdsSubscriberRepository::remove(std::string const& name) throw(ENotRegistered) { InstanceMap::iterator i = instances_.find(name); if (i != instances_.end()) { //delete i->second; DDS::Subscriber * sub = dynamic_cast<DDS::Subscriber *>(i->second); DDS::DomainParticipant * participant = sub->get_participant(); DDS::ReturnCode_t rc = participant->delete_subscriber(sub); if (rc != DDS_RETCODE_OK) { MIRO_LOG_OSTR(LL_ERROR, "Error deleting DDS subscriber: " << DdsSupport::getError(rc)); } instances_.erase(i); if (instances_.size() == 0) SingletonType::ACE_Singleton_Type::close(); return; } throw ENotRegistered(name); }