Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 7e1f1e13 authored by Hossain Mahmud's avatar Hossain Mahmud
Browse files

iteration for the reader is replace with a functor

parent 153431d2
......@@ -58,8 +58,13 @@ namespace campvis {
**/
virtual ~AbstractImageReader();
/// \see AbstractProcessor::acceptsExtension()
virtual bool acceptsExtension(const std::string& extenstion);
/**
* Checks whether an extension is handled by the current reader.
* returns true is the extension is handled, false otherwise
*
* \param extension The extension to be checked
**/
virtual bool acceptsExtension(const std::string& extension);
/// functions to set the property of the readers
virtual void setURL(StringProperty p_url);
......
......@@ -69,16 +69,14 @@ namespace campvis {
}
}
void GenericImageReader::process(DataContainer& data) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->acceptsExtension(this->_ext)) {
if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false);
}
(it->second)->setVisible(true);
this->_currentlyVisible = it->second;
(it->first)->process(data);
break;
std::map<AbstractImageReader*, MetaProperty*>::iterator it = std::find_if(this->_readers.begin(), this->_readers.end(), checkExt(this->_ext));
if(it != this->_readers.end()) {
if(nullptr != this->_currentlyVisible) {
this->_currentlyVisible->setVisible(false);
}
(it->second)->setVisible(true);
this->_currentlyVisible = it->second;
(it->first)->process(data);
}
return;
}
......@@ -91,11 +89,9 @@ namespace campvis {
this->_ext = url.substr(extPos);
}
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_url.setValue(this->p_url.getValue());
break;
}
std::map<AbstractImageReader*, MetaProperty*>::iterator it = std::find_if(this->_readers.begin(), this->_readers.end(), checkExt(this->_ext));
if(it != this->_readers.end()) {
(it->first)->p_url.setValue(this->p_url.getValue());
}
return;
}
......@@ -109,14 +105,12 @@ namespace campvis {
}
void GenericImageReader::setTargetImageId(DataNameProperty& targetImageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.setValue(targetImageId.getValue());
std::set<AbstractProperty*> sharedProperties = targetImageId.getSharedProperties();
for(std::set<AbstractProperty*>::iterator jt = sharedProperties.begin(); jt != sharedProperties.end(); jt++) {
(it->first)->p_targetImageID.addSharedProperty(*jt);
}
break;
std::map<AbstractImageReader*, MetaProperty*>::iterator it = std::find_if(this->_readers.begin(), this->_readers.end(), checkExt(this->_ext));
if(it != this->_readers.end()) {
(it->first)->p_targetImageID.setValue(targetImageId.getValue());
std::set<AbstractProperty*> sharedProperties = targetImageId.getSharedProperties();
for(std::set<AbstractProperty*>::iterator jt = sharedProperties.begin(); jt != sharedProperties.end(); jt++) {
(it->first)->p_targetImageID.addSharedProperty(*jt);
}
}
return;
......@@ -126,21 +120,17 @@ namespace campvis {
return this->setTargetImageId(std::string(imageId));
}
void GenericImageReader::setTargetImageId(std::string imageId) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.setValue(imageId);
break;
}
std::map<AbstractImageReader*, MetaProperty*>::iterator it = std::find_if(this->_readers.begin(), this->_readers.end(), checkExt(this->_ext));
if(it != this->_readers.end()) {
(it->first)->p_targetImageID.setValue(imageId);
}
return;
}
void GenericImageReader::setTargetImageIdSharedProperty(DataNameProperty* sharedProperty) {
for(std::map<AbstractImageReader*, MetaProperty*>::iterator it = this->_readers.begin(); it != this->_readers.end(); it++) {
if((it->first)->acceptsExtension(this->_ext)) {
(it->first)->p_targetImageID.addSharedProperty(sharedProperty);
break;
}
std::map<AbstractImageReader*, MetaProperty*>::iterator it = std::find_if(this->_readers.begin(), this->_readers.end(), checkExt(this->_ext));
if(it != this->_readers.end()) {
(it->first)->p_targetImageID.addSharedProperty(sharedProperty);
}
return;
}
......
......@@ -111,6 +111,15 @@ namespace campvis {
};
struct checkExt {
checkExt( std::string str ) : _str(str) {}
bool operator()( const std::pair<AbstractImageReader*, MetaProperty*>& v ) const {
return v.first->acceptsExtension(this->_str);
}
private:
std::string _str;
};
}
#endif // GENERICIMAGEREADER_H__
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment