Skip to content
Snippets Groups Projects
Commit bd061e7b authored by FBerendsen's avatar FBerendsen
Browse files

WIP: updated example components with proper specialization MeetsCriterum()

parent 0736c290
No related branches found
No related tags found
No related merge requests found
...@@ -30,6 +30,7 @@ public: ...@@ -30,6 +30,7 @@ public:
int GetTransformedImage(){ return 0; }; int GetTransformedImage(){ return 0; };
static const char * GetDescription(){ return "Example Transform Component 1"; }; static const char * GetDescription(){ return "Example Transform Component 1"; };
virtual bool MeetsCriterium(const CriteriumType &criterium);
protected: protected:
TransformComponent1(); TransformComponent1();
virtual ~TransformComponent1() virtual ~TransformComponent1()
...@@ -40,7 +41,8 @@ private: ...@@ -40,7 +41,8 @@ private:
TransformComponent1(const Self &); // purposely not implemented TransformComponent1(const Self &); // purposely not implemented
void operator=(const Self &); // purposely not implemented void operator=(const Self &); // purposely not implemented
virtual bool MeetsCriteria(const CriteriaType&); //virtual bool MeetsCriteria(const CriteriaType&);
}; };
} // end namespace selx } // end namespace selx
......
...@@ -43,6 +43,13 @@ int MetricComponent1::Set(TransformedImageInterface* providingInterface) ...@@ -43,6 +43,13 @@ int MetricComponent1::Set(TransformedImageInterface* providingInterface)
meetsCriteria = true; meetsCriteria = true;
} }
} }
else if (strcmp(criterium.first.c_str(), "ComponentInput") == 0)
{
if (strcmp(criterium.second.c_str(), "Transform") == 0) // e.g. "GradientDescent", "SupportsSparseSamples
{
meetsCriteria = true;
}
}
return meetsCriteria; return meetsCriteria;
} }
......
...@@ -27,48 +27,34 @@ namespace selx ...@@ -27,48 +27,34 @@ namespace selx
} }
bool bool
TransformComponent1 TransformComponent1::MeetsCriterium(const CriteriumType &criterium)
::MeetsCriteria(const CriteriaType &criteria)
{ {
bool hasUndefinedCriteria(false); bool hasUndefinedCriteria(false);
bool meetsCriteria(true); bool meetsCriteria(false);
if (strcmp(criterium.first.c_str(), "ComponentProperty") == 0)
for (CriteriaType::const_iterator it = criteria.begin(); it != criteria.end(); ++it)
{ {
if (strcmp(it->first.c_str(), "NameOfClass") == 0) if (strcmp(criterium.second.c_str(), "SomeProperty") == 0) // e.g. "GradientDescent", "SupportsSparseSamples
{ {
if (strcmp(it->second.c_str(), this->GetNameOfClass()) != 0) meetsCriteria = true;
{
meetsCriteria = false;
break;
}
} }
else if (strcmp(it->first.c_str(), "ComponentOutput") == 0) }
else if (strcmp(criterium.first.c_str(), "ComponentOutput") == 0)
{ {
if (strcmp(it->second.c_str(), "Transform") != 0) if (strcmp(criterium.second.c_str(), "Transform") != 0)
{ {
meetsCriteria = false; meetsCriteria = false;
break;
} }
} }
else if (strcmp(it->first.c_str(), "ComponentInput") == 0) else if (strcmp(criterium.first.c_str(), "ComponentInput") == 0)
{ {
if (strcmp(it->second.c_str(), "Sampler") != 0) if (strcmp(criterium.second.c_str(), "Sampler") != 0)
{ {
meetsCriteria = false; meetsCriteria = false;
break;
} }
} }
else
{
meetsCriteria = false;
hasUndefinedCriteria = true;
break;
}
}
return meetsCriteria; return meetsCriteria;
} }
} // end namespace selx } // end namespace selx
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment