OFFIS DCMTK  Version 3.6.0
wlds.h
1 /*
2  *
3  * Copyright (C) 1996-2010, OFFIS e.V.
4  * All rights reserved. See COPYRIGHT file for details.
5  *
6  * This software and supporting documentation were developed by
7  *
8  * OFFIS e.V.
9  * R&D Division Health
10  * Escherweg 2
11  * D-26121 Oldenburg, Germany
12  *
13  *
14  * Module: dcmwlm
15  *
16  * Author: Thomas Wilkens
17  *
18  * Purpose: (Partially) abstract class for connecting to an arbitrary data source.
19  *
20  * Last Update: $Author: joergr $
21  * Update Date: $Date: 2010-10-14 13:16:38 $
22  * CVS/RCS Revision: $Revision: 1.28 $
23  * Status: $State: Exp $
24  *
25  * CVS/RCS Log at end of file
26  *
27  */
28 
29 #ifndef WlmDataSource_h
30 #define WlmDataSource_h
31 
32 #include "dcmtk/config/osconfig.h"
33 #include "dcmtk/dcmwlm/wltypdef.h"
34 #include "dcmtk/dcmdata/dcdatset.h"
35 #include "dcmtk/oflog/oflog.h"
36 
37 OFLogger DCM_dcmwlmGetLogger();
38 
39 #define DCMWLM_TRACE(msg) OFLOG_TRACE(DCM_dcmwlmGetLogger(), msg)
40 #define DCMWLM_DEBUG(msg) OFLOG_DEBUG(DCM_dcmwlmGetLogger(), msg)
41 #define DCMWLM_INFO(msg) OFLOG_INFO(DCM_dcmwlmGetLogger(), msg)
42 #define DCMWLM_WARN(msg) OFLOG_WARN(DCM_dcmwlmGetLogger(), msg)
43 #define DCMWLM_ERROR(msg) OFLOG_ERROR(DCM_dcmwlmGetLogger(), msg)
44 #define DCMWLM_FATAL(msg) OFLOG_FATAL(DCM_dcmwlmGetLogger(), msg)
45 
46 class DcmAttributeTag;
47 class DcmLongString;
48 
53 {
54  protected:
55 
75  WlmReturnedCharacterSetType returnedCharacterSet;
83  unsigned long numOfSuperiorSequences;
84 
90  OFBool CheckSearchMask( DcmDataset *searchMask );
91 
101  void CheckNonSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
102 
114  void CheckSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
115 
125 
151  OFBool IsSupportedMatchingKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
152 
246  OFBool IsSupportedReturnKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
247 
251  void ClearDataset( DcmDataset *idents );
252 
258  void PutOffendingElements( const DcmTagKey &tag );
259 
265  void PutErrorElements( const DcmTagKey &tag );
266 
294  OFBool CheckMatchingKey( const DcmElement *elem );
295 
303  OFBool ContainsOnlyValidCharacters( const char *s, const char *charset );
304 
309  OFBool IsValidDateOrDateRange( const OFString& value );
310 
318  OFBool IsValidDate( const OFString& value );
319 
324  OFBool IsValidTimeOrTimeRange( const OFString& value );
325 
339  OFBool IsValidTime( const OFString& value );
340 
349  OFBool GetStringValue( const DcmElement *elem,
350  OFString& resultVal );
351 
357 
361  WlmDataSource( const WlmDataSource &Src );
362 
367  WlmDataSource &operator=( const WlmDataSource &Src );
368 
369 
370  public:
373  WlmDataSource();
374 
377  virtual ~WlmDataSource();
378 
382  virtual OFCondition ConnectToDataSource() = 0;
383 
388 
392  void SetCalledApplicationEntityTitle( const OFString& value );
393 
397  void SetFailOnInvalidQuery( OFBool value );
398 
402  void SetNoSequenceExpansion( OFBool value );
403 
407  void SetReturnedCharacterSet( WlmReturnedCharacterSetType value );
408 
416  virtual OFBool IsCalledApplicationEntityTitleSupported() = 0;
417 
430  virtual WlmDataSourceStatusType StartFindRequest( const DcmDataset &findRequestIdentifiers ) = 0;
431 
442  virtual DcmDataset *NextFindResponse( WlmDataSourceStatusType &rStatus ) = 0;
443 
450  WlmDataSourceStatusType CancelFindRequest();
451 
456 
461 
464  virtual void SetDbDsn( const OFString& /*value*/ ) {}
465 
468  virtual void SetDbUserName( const OFString& /*value*/ ) {}
469 
472  virtual void SetDbUserPassword( const OFString& /*value*/ ) {}
473 
476  virtual void SetCfgFileMatchRecords( const OFString& /*value*/ ) {}
477 
480  virtual void SetCfgFileSelectValues( const OFString& /*value*/ ) {}
481 
484  virtual void SetDatabaseType( WlmDatabaseType /*value*/ ) {}
485 
489  virtual void SetSerialNumber( const int /*value*/ ) {}
490 
494  virtual void SetInstitutionId( const unsigned int /*value*/ ) {}
495 
498  virtual void SetDfPath( const OFString& /*value*/ ) {}
499 
502  virtual void SetEnableRejectionOfIncompleteWlFiles( OFBool /*value*/ ) {}
503 
506  virtual void SetCreateNullvalues( OFBool /*value*/ ) {}
507 
510  virtual void SetPfFileName( const OFString& /*value*/ ) {}
511 
514  virtual void SetModalityToReturn( const OFString& /*value*/ ) {}
515 
518  virtual void SetCommaSeparatePatientName( OFBool /*value*/ ) {}
519 
522  virtual void SetReturnPatientUidInAccessionNumber( OFBool /*value*/ ) {}
523 };
524 
525 #endif
526 
527 /*
528 ** CVS Log
529 ** $Log: wlds.h,v $
530 ** Revision 1.28 2010-10-14 13:16:38 joergr
531 ** Updated copyright header. Added reference to COPYRIGHT file.
532 **
533 ** Revision 1.27 2010-08-09 13:29:38 joergr
534 ** Updated data dictionary to 2009 edition of the DICOM standard. From now on,
535 ** the official "keyword" is used for the attribute name which results in a
536 ** number of minor changes (e.g. "PatientsName" is now called "PatientName").
537 **
538 ** Revision 1.26 2009-11-24 10:40:01 uli
539 ** Switched to logging mechanism provided by the "new" oflog module.
540 **
541 ** Revision 1.25 2009-09-30 08:40:34 uli
542 ** Make dcmwlm's include headers self-sufficient by including all
543 ** needed headers directly.
544 **
545 ** Revision 1.24 2006-12-15 14:49:21 onken
546 ** Removed excessive use char* and C-array in favour of OFString and
547 ** OFList. Simplified some implementation details.
548 **
549 ** Revision 1.23 2005/12/08 16:05:40 meichel
550 ** Changed include path schema for all DCMTK header files
551 **
552 ** Revision 1.22 2005/09/23 12:56:40 wilkens
553 ** Added attribute PatientsBirthDate as a matching key attribute to wlmscpfs.
554 ** Thanks to Andre M. Descombes <andre@descombes.info> for the code template.
555 **
556 ** Revision 1.21 2005/05/04 11:34:31 wilkens
557 ** Added two command line options --enable-file-reject (default) and
558 ** --disable-file-reject to wlmscpfs: these options can be used to enable or
559 ** disable a file rejection mechanism which makes sure only complete worklist files
560 ** will be used during the matching process. A worklist file is considered to be
561 ** complete if it contains all necessary type 1 information which the SCP might
562 ** have to return to an SCU in a C-Find response message.
563 **
564 ** Revision 1.20 2004/04/06 18:19:28 joergr
565 ** Updated data dictionary, UIDs and transfer syntaxes for the latest Final Text
566 ** Supplements (42 and 47) and Correction Proposals (CP 25).
567 **
568 ** Revision 1.19 2004/01/15 12:01:24 wilkens
569 ** Added function to Worklist Management Data Source Base Class. This function
570 ** is needed in the private part of this toolkit.
571 **
572 ** Revision 1.18 2004/01/07 09:52:18 wilkens
573 ** Fixed typo in comment.
574 **
575 ** Revision 1.17 2004/01/07 08:32:28 wilkens
576 ** Added new sequence type return key attributes to wlmscpfs. Fixed bug that for
577 ** equally named attributes in sequences always the same value will be returned.
578 ** Added functionality that also more than one item will be returned in sequence
579 ** type return key attributes.
580 **
581 ** Revision 1.16 2004/01/02 13:56:14 wilkens
582 ** Integrated new return key attributes into wlmscpfs and updated function that
583 ** checks integrity of matching key attribute values (added support for new VR).
584 **
585 ** Revision 1.15 2003/12/23 13:04:36 wilkens
586 ** Integrated new matching key attributes into wlmscpfs.
587 **
588 ** Revision 1.14 2003/12/11 10:45:33 wilkens
589 ** Added function to Worklist Management Data Source Base Class. This function
590 ** is needed in the private part of this toolkit.
591 **
592 ** Revision 1.13 2003/08/21 13:38:23 wilkens
593 ** Moved declaration and initialization of member variables matchingDatasets and
594 ** numOfMatchingDatasets to base class.
595 ** Got rid of superfluous member variable objlist and of superfluous function
596 ** ClearObjList().
597 **
598 ** Revision 1.12 2003/07/02 09:17:55 wilkens
599 ** Updated documentation to get rid of doxygen warnings.
600 **
601 ** Revision 1.11 2003/02/17 12:02:03 wilkens
602 ** Made some minor modifications to be able to modify a special variant of the
603 ** worklist SCP implementation (wlmscpki).
604 **
605 ** Revision 1.10 2002/12/16 11:08:33 wilkens
606 ** Added missing #include "osconfig.h" to certain files.
607 **
608 ** Revision 1.9 2002/08/12 10:56:07 wilkens
609 ** Made some modifications in in order to be able to create a new application
610 ** which contains both wlmscpdb and ppsscpdb and another application which
611 ** contains both wlmscpfs and ppsscpfs.
612 **
613 ** Revision 1.8 2002/07/17 13:10:36 wilkens
614 ** Corrected some minor logical errors in the wlmscpdb sources and completely
615 ** updated the wlmscpfs so that it does not use the original wlistctn sources
616 ** any more but standard wlm sources which are now used by all three variants
617 ** of wlmscps.
618 **
619 ** Revision 1.7 2002/07/01 14:13:56 wilkens
620 ** Some more corrections to get rid of msvc6's warnings.
621 **
622 ** Revision 1.6 2002/06/10 11:25:05 wilkens
623 ** Made some corrections to keep gcc 2.95.3 quiet.
624 **
625 ** Revision 1.5 2002/05/08 13:20:51 wilkens
626 ** Added new command line option -nse to wlmscpki and wlmscpdb.
627 **
628 ** Revision 1.4 2002/04/18 14:20:08 wilkens
629 ** Modified Makefiles. Updated latest changes again. These are the latest
630 ** sources. Added configure file.
631 **
632 ** Revision 1.3 2002/01/08 17:45:34 joergr
633 ** Reformatted source files (replaced Windows newlines by Unix ones, replaced
634 ** tabulator characters by spaces, etc.)
635 **
636 ** Revision 1.2 2002/01/08 16:50:12 joergr
637 ** Added preliminary database support using OTL interface library (modified by
638 ** MC/JR on 2001-12-21).
639 **
640 ** Revision 1.1 2002/01/08 16:30:59 joergr
641 ** Added new module "dcmwlm" developed by Thomas Wilkens (initial release for
642 ** Windows, dated 2001-12-20).
643 **
644 **
645 */
virtual ~WlmDataSource()
destructor
WlmReturnedCharacterSetType returnedCharacterSet
returned character set type
Definition: wlds.h:75
class maintaining a attribute tag (group and element number)
Definition: dctagkey.h:46
virtual void SetCfgFileSelectValues(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:480
OFBool readLockSetOnDataSource
indicates if a read lock was set on the data source
Definition: wlds.h:71
virtual OFCondition DisconnectFromDataSource()=0
Disconnects from the data source.
void SetCalledApplicationEntityTitle(const OFString &value)
Set value in member variable.
void CheckNonSequenceElementInSearchMask(DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL)
This function checks if a non-sequence element in the search mask has a correct format.
virtual void SetCommaSeparatePatientName(OFBool)
Set value in a member variable in a derived class.
Definition: wlds.h:518
abstract base class for all DICOM elements
Definition: dcelem.h:45
void PutErrorElements(const DcmTagKey &tag)
This function inserts the tag of an error element into the corresponding member variable, without checking if it is already contained in this variable.
class representing a DICOM Sequence of Items (SQ).
Definition: dcsequen.h:47
void SetFailOnInvalidQuery(OFBool value)
Set value in member variable.
void PutOffendingElements(const DcmTagKey &tag)
This function inserts the tag of an offending element into the corresponding member variable...
WlmSuperiorSequenceInfoType * superiorSequenceArray
information about superior sequence elements; necessary for inserting values into resultDataset ...
Definition: wlds.h:81
OFBool noSequenceExpansion
indicates if the expansion of empty sequence attributes shall take place or not
Definition: wlds.h:73
OFBool IsSupportedReturnKeyAttribute(DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL)
This function checks if the given element refers to an attribute which is a supported return key attr...
virtual void SetDatabaseType(WlmDatabaseType)
Set value in a member variable in a derived class.
Definition: wlds.h:484
This class encapsulates data structures and operations for connecting to an arbitrary data source in ...
Definition: wlds.h:52
DcmAttributeTag * GetOffendingElements()
Get value from member variable.
virtual void SetDbUserName(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:468
OFString DeleteLeadingAndTrailingBlanks(const OFString &value)
This function makes a copy of value without leading and trailing blanks.
OFBool IsValidTimeOrTimeRange(const OFString &value)
This function checks if the given value is a valid time or time range.
OFBool foundUnsupportedOptionalKey
indicates if we encountered an unsupported optional key attribute in the search mask ...
Definition: wlds.h:69
OFBool CheckMatchingKey(const DcmElement *elem)
This function checks if the passed matching key&#39;s value only uses characters which are part of its da...
WlmDataSource()
default constructor.
virtual void SetSerialNumber(const int)
Set value in a member variable in a derived class.
Definition: wlds.h:489
DcmLongString * GetErrorComments()
Get value from member variable.
void SetReturnedCharacterSet(WlmReturnedCharacterSetType value)
Set value in member variable.
virtual void SetDfPath(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:498
virtual void SetDbUserPassword(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:472
OFBool IsValidTime(const OFString &value)
This function checks if the given time value is valid.
OFBool failOnInvalidQuery
indicates if the application shall fail on an invalid C-Find RQ message
Definition: wlds.h:57
virtual void SetReturnPatientUidInAccessionNumber(OFBool)
Set value in a member variable in a derived class.
Definition: wlds.h:522
void CheckSequenceElementInSearchMask(DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL)
This function checks if a sequence element in the search mask has a correct format.
virtual void SetCfgFileMatchRecords(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:476
virtual WlmDataSourceStatusType StartFindRequest(const DcmDataset &findRequestIdentifiers)=0
Based on the search mask which was passed, this function determines all the records in the database w...
unsigned long numOfSuperiorSequences
number of elements in above array
Definition: wlds.h:83
virtual void SetCreateNullvalues(OFBool)
Set value in a member variable in a derived class.
Definition: wlds.h:506
OFString specificCharacterSet
potentially specified specific character set (in search mask)
Definition: wlds.h:79
a class representing the DICOM value representation &#39;Long String&#39; (LO)
Definition: dcvrlo.h:40
OFBool GetStringValue(const DcmElement *elem, OFString &resultVal)
This function returns the value of the given DICOM string element (attribute) in the parameter result...
OFBool CheckSearchMask(DcmDataset *searchMask)
This function checks if the search mask has a correct format.
OFBool ContainsOnlyValidCharacters(const char *s, const char *charset)
This function returns OFTrue if all the characters of s can be found in the string charset...
WlmDataSourceStatusType CancelFindRequest()
This function handles a C-CANCEL Request during the processing of a C-FIND Request.
OFBool IsSupportedMatchingKeyAttribute(DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL)
This function checks if the given element refers to an attribute which is a supported matching key at...
virtual OFBool IsCalledApplicationEntityTitleSupported()=0
Checks if the called application entity title is supported.
virtual OFCondition ConnectToDataSource()=0
Connects to the data source.
OFString calledApplicationEntityTitle
called AE title
Definition: wlds.h:59
void ClearDataset(DcmDataset *idents)
This function removes all elements from the given DcmDataset object.
void SetNoSequenceExpansion(OFBool value)
Set value in a member variable.
WlmDataSource & operator=(const WlmDataSource &Src)
Protected undefined operator=.
virtual DcmDataset * NextFindResponse(WlmDataSourceStatusType &rStatus)=0
This function will return the next dataset that matches the given search mask, if there is one more r...
DcmAttributeTag * errorElements
list of error elements
Definition: wlds.h:63
a class handling the DICOM dataset format (files without meta header)
Definition: dcdatset.h:46
OFBool IsValidDateOrDateRange(const OFString &value)
This function checks if the given value is a valid date or date range.
structure for handling arbitrary types of superior sequences in query result datasets ...
Definition: wltypdef.h:128
virtual void SetPfFileName(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:510
virtual void SetDbDsn(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:464
OFBool IsValidDate(const OFString &value)
This function checks if the given date value is valid.
void ExpandEmptySequenceInSearchMask(DcmElement *&element)
According to the 2001 DICOM standard (part 4, section C.2.2.2.6), if a search mask contains a sequenc...
simple wrapper around the "low-level" Logger object to make it easier to switch to a different system...
Definition: oflog.h:49
virtual void SetEnableRejectionOfIncompleteWlFiles(OFBool)
Set value in a member variable in a derived class.
Definition: wlds.h:502
a simple string class that implements a subset of std::string.
Definition: ofstring.h:86
virtual void SetInstitutionId(const unsigned int)
Set value in a member variable in a derived class.
Definition: wlds.h:494
DcmAttributeTag * offendingElements
list of offending elements
Definition: wlds.h:65
DcmDataset * identifiers
the search mask which is contained in the C-Find RQ message
Definition: wlds.h:61
OFList< DcmDataset * > matchingDatasets
array of matching datasets
Definition: wlds.h:77
DcmLongString * errorComment
error comment
Definition: wlds.h:67
virtual void SetModalityToReturn(const OFString &)
Set value in a member variable in a derived class.
Definition: wlds.h:514
General purpose class for condition codes.
Definition: ofcond.h:305
a class representing the DICOM value representation &#39;Attribute Tag&#39; (AT)
Definition: dcvrat.h:40


Generated on Wed Dec 14 2016 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.8.11