DCMTK  Version 3.6.2
OFFIS DICOM Toolkit
Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | List of all members
DcmAttributeMatching Class Reference

A class that implements the different kinds attribute matching. More...

Public Member Functions

 DcmAttributeMatching ()
 Default construct an empty DcmAttributeMatching object.
 
 DcmAttributeMatching (const DcmVR vr)
 Construct an DcmAttributeMatching object that is appropriate for the given VR. More...
 
 operator OFBool () const
 Test whether this object may be used for matching, i.e. whether it is not empty. More...
 
OFBool operator! () const
 Test whether this object cannot be used for matching, i.e. whether it is empty. More...
 
OFBool operator() (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize) const
 Match the given query and candidate using the internally stored matching function. More...
 

Static Public Member Functions

static OFBool singleValueMatching (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query data and the candidate using Single Value Matching, as defined by the DICOM standard. More...
 
static OFBool wildCardMatching (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query and the candidate string using Wild Card Matching, as defined by the DICOM standard. More...
 
static OFBool rangeMatchingDate (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query date or date range and the candidate date. More...
 
static OFBool rangeMatchingTime (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query time or time range and the candidate time. More...
 
static OFBool rangeMatchingDateTime (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query date time or date time range and the candidate date time. More...
 
static OFBool rangeMatchingDateTime (const void *dateQueryData, const size_t dateQuerySize, const void *timeQueryData, const size_t timeQuerySize, const void *dateCandidateData, const size_t dateCandidateSize, const void *timeCandidateData, const size_t timeCandidateSize)
 Match the query date and time or date and time range and the candidate date and time using combined datetime matching. More...
 
static OFBool listOfUIDMatching (const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Match the query list of UIDs with the candidate UID. More...
 

Static Private Member Functions

template<typename T >
static OFBool rangeMatchingTemplate (OFCondition(*parse)(const char *, const size_t, T &), const void *queryData, const size_t querySize, const void *candidateData, const size_t candidateSize)
 Helper template function for generically implementing range matching. More...
 

Private Attributes

OFBool(* m_pMatch )(const void *, const size_t, const void *, const size_t)
 A pointer to one of the matching functions that is appropriate for the given VR.
 

Detailed Description

A class that implements the different kinds attribute matching.

DcmAttributeMatching may either be used by directly calling the appropriate matching function, e.g. wildCardMatching() or by creating a DcmAttributeMatching object for a specific VR. In the latter case, DcmAttributeMatching will choose the appropriate matching function for the VR in its constructor and remember the result during its lifetime.

Constructor & Destructor Documentation

◆ DcmAttributeMatching()

DcmAttributeMatching::DcmAttributeMatching ( const DcmVR  vr)

Construct an DcmAttributeMatching object that is appropriate for the given VR.

Parameters
vrthe DICOM Value Representation of the data that this object will be used on for matching.

Member Function Documentation

◆ listOfUIDMatching()

static OFBool DcmAttributeMatching::listOfUIDMatching ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query list of UIDs with the candidate UID.

Parameters
queryDataa pointer to a character string that contains a backslash separated list of UIDs.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string that contains an UID.
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if at least one of the UIDs from the query match the candidate, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching.

◆ operator OFBool()

DcmAttributeMatching::operator OFBool ( ) const

Test whether this object may be used for matching, i.e. whether it is not empty.

Returns
OFTrue if this object may be used for matching, OFFalse otherwise.

◆ operator!()

OFBool DcmAttributeMatching::operator! ( ) const

Test whether this object cannot be used for matching, i.e. whether it is empty.

Returns
OFTrue if this object cannot be used for matching, OFFalse otherwise.

◆ operator()()

OFBool DcmAttributeMatching::operator() ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
) const

Match the given query and candidate using the internally stored matching function.

Parameters
queryDataa pointer some DICOM data that uses the same VR that was given during construction of this object.
querySizethe size (in bytes) of the data queryData refers to.
candidateDataa pointer to some DICOM data that used the same VR that was given during construction of this object.
candidateSizethe size (in bytes) of the data candidateData refers to.
Returns
compares the query data with the candidate data using the appropriate matching function for the given VR, returns OFTrue if they match, OFFalse if not or if an error occured.
Precondition
(*this) must have been constructed for a specific VR that matches the one of the query and candidate data, i.e. !(*this) must evaluate to OFFalse.

Usage Example

match( "20160101-20181231", 17, "20170713", 8 ); // -> OFTrue
match( "-12", 3, "11", 2 ) // -> OFTrue
DcmAttributeMatching( EVR_PN )( "M?ller", 6, "^Martin", 7 ) // -> OFFalse

◆ rangeMatchingDate()

static OFBool DcmAttributeMatching::rangeMatchingDate ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query date or date range and the candidate date.

Parameters
queryDataa pointer to a character string that contains a DICOM Date (DA) or a date range.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string that contains a DICOM Date (DA).
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching. Otherwise query will be converted to an OFDate or a range defined by two OFDates and candidate will be converted to an OFDate. It will then be tested whether the candidate date lies within the range given by the query or is equal to the queried date as appropriate. If the conversion to OFDate is unsuccessful for any of the dates, the result will be OFFalse.

◆ rangeMatchingDateTime() [1/2]

static OFBool DcmAttributeMatching::rangeMatchingDateTime ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query date time or date time range and the candidate date time.

Parameters
queryDataa pointer to a character string that contains a DICOM Date Time (DT) or a date time range.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string that contains a DICOM Date Time (DT).
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching. Otherwise query will be converted to an OFDateTime or a range defined by two OFDateTimes and candidate will be converted to an OFDateTime. It will then be tested whether the candidate date time lies within the range given by the query or is equal to the queried date time as appropriate. If the conversion to OFDateTime is unsuccessful for any of the date times, the result will be OFFalse.

◆ rangeMatchingDateTime() [2/2]

static OFBool DcmAttributeMatching::rangeMatchingDateTime ( const void *  dateQueryData,
const size_t  dateQuerySize,
const void *  timeQueryData,
const size_t  timeQuerySize,
const void *  dateCandidateData,
const size_t  dateCandidateSize,
const void *  timeCandidateData,
const size_t  timeCandidateSize 
)
static

Match the query date and time or date and time range and the candidate date and time using combined datetime matching.

Parameters
dateQueryDataa pointer to a character string that contains a DICOM Date (DA) or a date range.
dateQuerySizethe size (in bytes) of the string dateQueryData refers to.
timeQueryDataa pointer to a character string that contains a DICOM Time (TM) or a time range.
timeQuerySizethe size (in bytes) of the string timeQueryData refers to.
dateCandidateDataa pointer to a character string that contains a DICOM Date (DA).
dateCandidateSizethe size (in bytes) of the string dateCandidateData refers to.
timeCandidateDataa pointer to a character string that contains a DICOM Time (TM).
timeCandidateSizethe size (in bytes) of the string timeCandidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If dateQuerySize and timeQuerySize equal zero, the result will be OFTrue, as appropriate for Universal Matching. Otherwise the query will be converted to an OFDateTime or a range defined by two OFDateTimes and candidate will be converted to an OFDateTime as defined by combined datetime matching. It will then be tested whether the candidate date time lies within the range given by the query or is equal to the queried date time as appropriate. If the conversion to OFDateTime is unsuccessful for any of the dates or times, the result will be OFFalse.

◆ rangeMatchingTemplate()

template<typename T >
static OFBool DcmAttributeMatching::rangeMatchingTemplate ( OFCondition(*)(const char *, const size_t, T &)  parse,
const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
staticprivate

Helper template function for generically implementing range matching.

Template Parameters
Tthe type to parse the data int (e.g. OFDate), deduced automatically.
Parameters
parsea pointer to a function that parses a string as a T.
queryDataa pointer to a character string that can be parsed as a T or a dash separated range of two Ts.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string that can be parsed as a T for comparing it with the query.
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if parsing of the query and the candidate as a T was successful and the T value represented by candidateData equals the one from the query or lies within the range defined by the query. OFFalse otherwise.

◆ rangeMatchingTime()

static OFBool DcmAttributeMatching::rangeMatchingTime ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query time or time range and the candidate time.

Parameters
queryDataa pointer to a character string that contains a DICOM Time (TM) or a time range.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string that contains a DICOM Time (TM).
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching. Otherwise query will be converted to an OFTime or a range defined by two OFTimes and candidate will be converted to an OFTime. It will then be tested whether the candidate time lies within the range given by the query or is equal to the queried time as appropriate. If the conversion to OFTime is unsuccessful for any of the times, the result will be OFFalse.

◆ singleValueMatching()

static OFBool DcmAttributeMatching::singleValueMatching ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query data and the candidate using Single Value Matching, as defined by the DICOM standard.

Parameters
queryDataa pointer to some data.
querySizethe size (in bytes) of the data queryData refers to.
candidateDataa pointer to some data.
candidateSizethe size (in bytes) of the data candidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching. Otherwise the result will only be OFTrue if both data pieces have the same size are bitwise equal.

◆ wildCardMatching()

static OFBool DcmAttributeMatching::wildCardMatching ( const void *  queryData,
const size_t  querySize,
const void *  candidateData,
const size_t  candidateSize 
)
static

Match the query and the candidate string using Wild Card Matching, as defined by the DICOM standard.

Parameters
queryDataa pointer to a character string potentially containing Wild Card characters.
querySizethe size (in bytes) of the string queryData refers to.
candidateDataa pointer to a character string.
candidateSizethe size (in bytes) of the string candidateData refers to.
Returns
OFTrue if the query and the candidate match, OFFalse otherwise.

If querySize equals zero, the result will be OFTrue, as appropriate for Universal Matching. If the query contains no Wild Card characters ('?' and '*') the result will be the same as if singleValueMatching() was called.

Note
It is therefore not necessary to check for Wild Card characters and manually decided whether to use wildCardMatching() or singleValueMatching(), simply use wildCardMatching() if the query may potentially contain Wild Card characters.

The documentation for this class was generated from the following file:


Generated on Mon Jul 17 2017 for DCMTK Version 3.6.2 by Doxygen 1.8.13