This service interface allows to register manage rules that define releations based on properties (and ther values).
Draft for the interface:
lang=c++
class MITKCORE_EXPORT IPropertyRelations
{
public:
virtual ~IPropertyRelations();
using RuleResultType = std::list<PropertyRelationRuleBase::ConstPointer>;
/** \brief Add rule for a specific relation.
* If there is already a pusing RuleIDType = Property rule instance for the passedRelationRuleBase::RuleIDType;
* property name and the same rule, it won't be added
/** \brief Add rule for a specific relation.
* Rule instances are regarded equal, if the name, the source and* If there is already a property rule instance it won't be added.
* destination specification are* Rule instances are regarded equal, if the rule ID is equal.
* You may enforce to overwrite the old equal rule for a property name
* by the overwrite parameter.
*
* \param[in] rule Relation rule of the property.
* \param[in] overwrite Overwrite already existing relation rule.
* \return True if relation rule was added successfully.
*/
virtual bool AddRule(const PropertyRelationRuleBase *rule, bool overwrite = false) = 0;
/** \brief Get theall relation rule that fit fors where the passed property name assource is realy a source.
* \param[in] propertyName Name of the property. of. (PropertyRelationRuleBase::IsSource() would return true)
* \param[in] allowNameRegEx Indicates if also added rule instances with regexs are being checkedsource Pointer to the instance that should be checked as source for the searched rules.
* \return Property relation rules or null pointerempty list if no relation rule iss are available.
*/
virtual RuleResultType GetRuleForSource(const std::string &propertyName, bool allowNameRegEx = true) const = 0;
/** \overload
Allows to search for all rules that fit to a propertyOwner as source.*/
virtual RuleResultType GetRuleForSource(const IPropertyOwner* propertyOwner, bool allowNameRegEx = truIPropertyOwner* source) const = 0;
/** \brief Get theall relation rules that fit forwould accept the passed pIProperty nameOwner as destinationsource.
* \param[in] propertyName Name of the propertysourceCandidate Pointer to the instance that should be checked to be a suitable source.
* \param[in] allowNameRegEx Indicates if also added rule instances with regexs are being checked.
* \return Property relation rule or null pointer if no relation rule isreturn Property relation rules or empty list if no relation rules are available.
*/
virtual RuleResultType GetRuleForDestination(const std::string &propertyName, bool allowNameRegEx = true) const = 0;SourceCandidate(const IPropertyOwner* sourceCandidate) const = 0;
/** \brief Get all relation rules that would accept the passed IPropertOwner as destination.
/** \overload * \param[in] destCandidate Pointer to the instance that should be checked to be a suitable destination.
Allows to search for all * \return Property relation rules that fit to a propertyOwner as destination.or empty list if no relation rules are available.
*/
virtual RuleResultType GetRulesForDestination(const IPropertyOwner* pCandidate(const IPropertyOwner, bool allowNameRegEx = tru* destCandidate) const = 0;
/** \brief Get the relation rule that havehas the specified nameruleID.
*
* \return Property relation rule or null pointer, if no relation rule is available.
*/
virtual RuleResultType GetRuleByNamPropertyRelationRuleBase::ConstPointer GetRule(const std::stringRuleIDType &ruleNameID) const = 0;
/** \brief Check if a specific base data property has relationpassed instance has defined relation covered by the registered rules.
*
* \param[in] propertyName Name of the property.
* \param[in] allowNameRegEx Indicates if also added rule instances with regexs are being checkedsource Pointer to the instance that should be checked as source for the searched rules.
* \return True if the property has relations of registered rules, false otherwise.
*/
virtual bool HasRuleForSource(const std::string &propertyName, bool allowNameRegEx = true) const = 0;
virtual bool HasRuleForSource(const IPropertyOwner* propertyOwner, bool allowNameRegEx = true) const = 0;
virtual bool HasRuleForDestionation(const std::string &propertyName, bool allowNameRegEx = true) const = 0;
virtual bool HasRuleForDestionation(const IPropertyOwner* propertyOwner, bool allowNameRegEx = truIPropertyOwner* source) const = 0;
/** \brief Remove all relation rule.
*/
virtual void RemoveAllRules() = 0;
/** \brief Remove relation rule instances of a specific rule name/regex.
*
* \param[in] with the passed ID. If ruleName Registered name or regex that should be removede does not exist nothing happens.
*/
virtual void RemoveRule(const std::stringRuleIDType &ruleNameID) = 0;
};