std::map<std::string, unsigned int> OutputWarehouse::getFileNumbers() { std::map<std::string, unsigned int> output; for (std::vector<Output *>::const_iterator it = _all_objects.begin(); it != _all_objects.end(); ++it) { FileOutput * ptr = dynamic_cast<FileOutput *>(*it); if (ptr != NULL) output[ptr->name()] = ptr->getFileNumber(); } return output; }
std::map<std::string, unsigned int> OutputWarehouse::getFileNumbers() { std::map<std::string, unsigned int> output; for (const auto & obj : _all_objects) { FileOutput * ptr = dynamic_cast<FileOutput *>(obj); if (ptr != NULL) output[ptr->name()] = ptr->getFileNumber(); } return output; }
void OutputWarehouse::setFileNumbers(std::map<std::string, unsigned int> input, unsigned int offset) { for (std::vector<Output *>::const_iterator it = _all_objects.begin(); it != _all_objects.end(); ++it) { FileOutput * ptr = dynamic_cast<FileOutput *>(*it); if (ptr != NULL) { std::map<std::string, unsigned int>::const_iterator it = input.find(ptr->name()); if (it != input.end()) { int value = it->second + offset; if (value < 0) ptr->setFileNumber(0); else ptr->setFileNumber(it->second + offset); } } } }