Medical Imaging Interaction Toolkit
2018.4.99-389bf124
Medical Imaging Interaction Toolkit
|
Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of the property persistence service or the property relation service.
Following assumptions are made /preconditions are defined:
More...
#include <mitkPropertyKeyPath.h>
Classes | |
struct | NodeInfo |
Public Types | |
using | ItemSelectionIndex = std::vcl_size_t |
using | ElementNameType = std::string |
using | NodeInfoVectorType = std::vector< NodeInfo > |
using | PathIndexType = NodeInfoVectorType::size_type |
Static Protected Member Functions | |
static bool | PropertyKeyPathsMatch (const PropertyKeyPath &left, const PropertyKeyPath &right) |
Protected Attributes | |
NodeInfoVectorType | m_NodeInfos |
Class that can be used to specify nested or wild carded property keys. E.g. for the use in context of the property persistence service or the property relation service.
Following assumptions are made /preconditions are defined:
Selections are used to indicate that the preceding element has multiple occurences and which occurence is meant. Example property keys would be:
To build a path one may use the Add* method to build up the PropertyKeyPath element by element.
"first.*.third.[3]" would be equivalent to propKeyPath.AddElement("first"); propKeyPath.AddAnyElement(); propKeyPath.AddSelection("third",3);
or the inline version propKeyPath.AddElement("first").AddAnyElement().AddSelection("third",3);
Definition at line 51 of file mitkPropertyKeyPath.h.
using mitk::PropertyKeyPath::ElementNameType = std::string |
Definition at line 55 of file mitkPropertyKeyPath.h.
using mitk::PropertyKeyPath::ItemSelectionIndex = std::vcl_size_t |
Definition at line 54 of file mitkPropertyKeyPath.h.
using mitk::PropertyKeyPath::NodeInfoVectorType = std::vector<NodeInfo> |
Definition at line 79 of file mitkPropertyKeyPath.h.
using mitk::PropertyKeyPath::PathIndexType = NodeInfoVectorType::size_type |
Definition at line 80 of file mitkPropertyKeyPath.h.
mitk::PropertyKeyPath::PropertyKeyPath | ( | ) |
Definition at line 277 of file mitkPropertyKeyPath.cpp.
References Reset().
Referenced by mitk::PropertyNameToPropertyKeyPath().
mitk::PropertyKeyPath::PropertyKeyPath | ( | const PropertyKeyPath & | path | ) |
Definition at line 279 of file mitkPropertyKeyPath.cpp.
mitk::PropertyKeyPath::~PropertyKeyPath | ( | ) |
Definition at line 281 of file mitkPropertyKeyPath.cpp.
PropertyKeyPath & mitk::PropertyKeyPath::AddAnyElement | ( | ) |
Appends an "any element" to the path instance.
Definition at line 253 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::AnyElement, and m_NodeInfos.
Referenced by mitk::SourceImageRelationRule::Disconnect_datalayer(), and mitk::PropertyNameToPropertyKeyPath().
PropertyKeyPath & mitk::PropertyKeyPath::AddAnySelection | ( | const ElementNameType & | name | ) |
Appends an element with the passed name and any selection to the path instance.
Definition at line 265 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::AnySelection, and m_NodeInfos.
Referenced by mitk::SourceImageRelationRule::CreateNewSourceImageSequenceItem(), mitk::SourceImageRelationRule::GetReferenceSequenceIndices(), and mitk::PropertyNameToPropertyKeyPath().
PropertyKeyPath & mitk::PropertyKeyPath::AddElement | ( | const ElementNameType & | name | ) |
Appends an element with the passed name to the path instance.
Definition at line 259 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::Element, and m_NodeInfos.
Referenced by mitk::SourceImageRelationRule::Connect_datalayer(), mitk::SourceImageRelationRule::CreateNewSourceImageSequenceItem(), mitk::SourceImageRelationRule::Disconnect_datalayer(), mitk::SourceImageRelationRule::GetReferenceSequenceIndices(), mitk::PropertyRelationRuleBase::GetRootKeyPath(), mitk::PropertyRelationRuleBase::GetRuleIDByInstanceID(), mitk::SourceImageRelationRule::HasImplicitDataRelation(), and mitk::PropertyNameToPropertyKeyPath().
PropertyKeyPath::PathIndexType mitk::PropertyKeyPath::AddNode | ( | const NodeInfo & | newNode | ) |
Adds a new node to the end of the path.
[in] | newNode | Reference to the node that should be added. |
Definition at line 96 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
PropertyKeyPath & mitk::PropertyKeyPath::AddSelection | ( | const ElementNameType & | name, |
ItemSelectionIndex | index | ||
) |
Appends an element with the passed name and selection index to the path instance.
Definition at line 271 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::ElementSelection, and m_NodeInfos.
Referenced by mitk::SourceImageRelationRule::Connect_datalayer(), mitk::SourceImageRelationRule::CreateNewSourceImageSequenceItem(), mitk::SourceImageRelationRule::Disconnect_datalayer(), mitk::SourceImageRelationRule::GetReferenceSequenceIndices(), mitk::SourceImageRelationRule::HasImplicitDataRelation(), and mitk::PropertyNameToPropertyKeyPath().
bool mitk::PropertyKeyPath::Equals | ( | const PropertyKeyPath & | path | ) | const |
Checks if two PropertyKeyPaths specify the same node. Hence all wildcards will be processed.
E.G.: "item1.child1.grandChild2" == "item1.*.grandChild2" is true.
Definition at line 241 of file mitkPropertyKeyPath.cpp.
References PropertyKeyPathsMatch().
PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetFirstNode | ( | ) |
Function returns the node info of the first path node within the PropertyKeyPath.
Definition at line 135 of file mitkPropertyKeyPath.cpp.
References GetNode(), m_NodeInfos, and mitkThrowException.
const PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetFirstNode | ( | ) | const |
Function returns the node info of the first path node within the PropertyKeyPath.
Definition at line 126 of file mitkPropertyKeyPath.cpp.
References GetNode(), m_NodeInfos, and mitkThrowException.
PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetLastNode | ( | ) |
Function returns the node info of the last path node within the PropertyKeyPath.
Definition at line 153 of file mitkPropertyKeyPath.cpp.
References GetNode(), GetSize(), m_NodeInfos, and mitkThrowException.
const PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetLastNode | ( | ) | const |
Function returns the node info of the last path node within the PropertyKeyPath.
Definition at line 144 of file mitkPropertyKeyPath.cpp.
References GetNode(), GetSize(), m_NodeInfos, and mitkThrowException.
const PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetNode | ( | const PathIndexType & | index | ) | const |
Function returns the node info of a path node specified by the index within the PropertyKeyPath.
[in] | index | Index of the node whose info should be retrieved. |
Definition at line 102 of file mitkPropertyKeyPath.cpp.
References GetSize(), m_NodeInfos, mitkThrowException, and mitk::PropertyKeyPathToPropertyName().
Referenced by GetFirstNode(), and GetLastNode().
PropertyKeyPath::NodeInfo & mitk::PropertyKeyPath::GetNode | ( | const PathIndexType & | index | ) |
Function returns the node info of a path node specified by the index within the PropertyKeyPath.
[in] | index | Index of the node whose info should be retrieved. |
Definition at line 114 of file mitkPropertyKeyPath.cpp.
References GetSize(), m_NodeInfos, mitkThrowException, and mitk::PropertyKeyPathToPropertyName().
const PropertyKeyPath::NodeInfoVectorType & mitk::PropertyKeyPath::GetNodes | ( | ) | const |
Definition at line 162 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
Referenced by PropertyKeyPathsMatch(), mitk::PropertyKeyPathToPersistenceKeyRegEx(), mitk::PropertyKeyPathToPersistenceKeyTemplate(), mitk::PropertyKeyPathToPersistenceNameTemplate(), mitk::PropertyKeyPathToPropertyName(), and mitk::PropertyKeyPathToPropertyRegEx().
PropertyKeyPath::PathIndexType mitk::PropertyKeyPath::GetSize | ( | ) | const |
Number of path nodes the PropertyKeyPath contains.
Definition at line 94 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
Referenced by GetLastNode(), and GetNode().
bool mitk::PropertyKeyPath::HasItemSelectionWildcardsOnly | ( | ) | const |
Returns if the path has any nodes with item selection wild cards ([*]).
Definition at line 79 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::AnyElement, mitk::PropertyKeyPath::NodeInfo::AnySelection, and m_NodeInfos.
bool mitk::PropertyKeyPath::IsEmpty | ( | ) | const |
Returns if the PropertyKeyPath is empty.
Definition at line 64 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
bool mitk::PropertyKeyPath::IsExplicit | ( | ) | const |
Returns if the path is explicit (has no wildcards).
Definition at line 66 of file mitkPropertyKeyPath.cpp.
References mitk::PropertyKeyPath::NodeInfo::AnyElement, mitk::PropertyKeyPath::NodeInfo::AnySelection, and m_NodeInfos.
bool mitk::PropertyKeyPath::operator< | ( | const PropertyKeyPath & | right | ) | const |
Operation equals like comparing the ToStr() results with operator <.
Definition at line 166 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
bool mitk::PropertyKeyPath::operator<= | ( | const PropertyKeyPath & | right | ) | const |
Operation equals like comparing the ToStr() results with operator <=.
Definition at line 239 of file mitkPropertyKeyPath.cpp.
PropertyKeyPath & mitk::PropertyKeyPath::operator= | ( | const PropertyKeyPath & | path | ) |
Definition at line 243 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
bool mitk::PropertyKeyPath::operator== | ( | const PropertyKeyPath & | path | ) | const |
Compares two PropertyKeyPaths for real equality. So it is a string comparison of their string conversion.
Definition at line 164 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
bool mitk::PropertyKeyPath::operator> | ( | const PropertyKeyPath & | right | ) | const |
Operation equals like comparing the ToStr() results with operator >.
Definition at line 209 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
bool mitk::PropertyKeyPath::operator>= | ( | const PropertyKeyPath & | right | ) | const |
Operation equals like comparing the ToStr() results with operator >=.
Definition at line 237 of file mitkPropertyKeyPath.cpp.
|
staticprotected |
Definition at line 285 of file mitkPropertyKeyPath.cpp.
References GetNodes().
Referenced by Equals().
void mitk::PropertyKeyPath::Reset | ( | ) |
Definition at line 283 of file mitkPropertyKeyPath.cpp.
References m_NodeInfos.
Referenced by PropertyKeyPath().
|
protected |
Definition at line 177 of file mitkPropertyKeyPath.h.
Referenced by AddAnyElement(), AddAnySelection(), AddElement(), AddNode(), AddSelection(), GetFirstNode(), GetLastNode(), GetNode(), GetNodes(), GetSize(), HasItemSelectionWildcardsOnly(), IsEmpty(), IsExplicit(), operator<(), operator=(), operator==(), operator>(), and Reset().