39 auto ruleFinding = m_RuleMap.find(rule->
GetRuleID());
42 if (ruleFinding == m_RuleMap.end())
44 m_RuleMap.insert(std::make_pair(rule->
GetRuleID(), rule));
62 for (
const auto rule : m_RuleMap)
64 if (rule.second->IsSource(source))
66 result.push_back(rule.second);
78 for (
const auto rule : m_RuleMap)
80 if (rule.second->IsSourceCandidate(sourceCandidate))
82 result.push_back(rule.second);
93 for (
const auto rule : m_RuleMap)
95 if (rule.second->IsDestinationCandidate(destCandidate))
97 result.push_back(rule.second);
108 auto ruleFinding = m_RuleMap.find(ruleID);
110 if (ruleFinding != m_RuleMap.end())
112 result = ruleFinding->second;
122 for (
const auto& rule : m_RuleMap)
124 result.push_back(rule.first);
144 m_RuleMap.erase(ruleID);
virtual RuleIDType GetRuleID() const =0
Interface of property relations service.
IPropertyRelations::RuleIDVectorType RuleIDVectorType
bool HasRuleForSource(const IPropertyProvider *source) const override
Check if a passed instance has defined relation covered by the registered rules.
std::list< PropertyRelationRuleBase::ConstPointer > RuleResultVectorType
MITKCORE_EXPORT IPropertyRelations * CreateTestInstancePropertyRelations()
IPropertyRelations::RuleResultVectorType RuleResultVectorType
RuleResultVectorType GetRulesForSource(const IPropertyProvider *source) const override
Get all relation rules the passed source is really a source of. (PropertyRelationRuleBase::IsSource()...
bool AddRule(const PropertyRelationRuleBase *rule, bool overwrite=false) override
Add rule for a specific relation. If there is already a property rule instance it won't be added...
PropertyRelationRuleBase::RuleIDType RuleIDType
void RemoveRule(const RuleIDType &ruleID) override
Remove relation rule instance with the passed ID. If rule does not exist nothing happens.
RuleIDVectorType GetRuleIDs() const override
Get all IDs of registered rules.
void RemoveAllRules() override
Remove all relation rules.
RuleResultVectorType GetRulesForDestinationCandidate(const IPropertyProvider *destCandidate) const override
Get all relation rules that would accept the passed IPropertOwner as destination. ...
PropertyRelationRuleBase::ConstPointer GetRule(const RuleIDType &ruleID) const override
Get the relation rule that has the specfied ruleID.
~PropertyRelations() override
std::vector< RuleIDType > RuleIDVectorType
RuleResultVectorType GetRulesForSourceCandidate(const IPropertyProvider *sourceCandidate) const override
Get all relation rules that would accept the passed IPropertOwner as source.