00001 /* 00002 * 00003 * Copyright (C) 1996-2005, OFFIS 00004 * 00005 * This software and supporting documentation were developed by 00006 * 00007 * Kuratorium OFFIS e.V. 00008 * Healthcare Information and Communication Systems 00009 * Escherweg 2 00010 * D-26121 Oldenburg, Germany 00011 * 00012 * THIS SOFTWARE IS MADE AVAILABLE, AS IS, AND OFFIS MAKES NO WARRANTY 00013 * REGARDING THE SOFTWARE, ITS PERFORMANCE, ITS MERCHANTABILITY OR 00014 * FITNESS FOR ANY PARTICULAR USE, FREEDOM FROM ANY COMPUTER DISEASES OR 00015 * ITS CONFORMITY TO ANY SPECIFICATION. THE ENTIRE RISK AS TO QUALITY AND 00016 * PERFORMANCE OF THE SOFTWARE IS WITH THE USER. 00017 * 00018 * Module: dcmwlm 00019 * 00020 * Author: Thomas Wilkens 00021 * 00022 * Purpose: (Partially) abstract class for connecting to an arbitrary data source. 00023 * 00024 * Last Update: $Author: meichel $ 00025 * Update Date: $Date: 2005/12/08 16:05:40 $ 00026 * Source File: $Source: /share/dicom/cvs-depot/dcmtk/dcmwlm/include/dcmtk/dcmwlm/wlds.h,v $ 00027 * CVS/RCS Revision: $Revision: 1.23 $ 00028 * Status: $State: Exp $ 00029 * 00030 * CVS/RCS Log at end of file 00031 * 00032 */ 00033 00034 #ifndef WlmDataSource_h 00035 #define WlmDataSource_h 00036 00037 #include "dcmtk/config/osconfig.h" 00038 00039 class DcmDataset; 00040 class DcmList; 00041 class DcmAttributeTag; 00042 class DcmLongString; 00043 class DcmTagKey; 00044 class DcmElement; 00045 class OFConsole; 00046 class OFCondition; 00047 class DcmSequenceOfItems; 00048 00052 class WlmDataSource 00053 { 00054 protected: 00056 OFBool failOnInvalidQuery; 00058 char *calledApplicationEntityTitle; 00060 OFBool verbose; 00062 OFBool debug; 00064 DcmDataset *identifiers; 00066 DcmAttributeTag *errorElements; 00068 DcmAttributeTag *offendingElements; 00070 DcmLongString *errorComment; 00072 OFBool foundUnsupportedOptionalKey; 00074 OFBool readLockSetOnDataSource; 00076 OFConsole *logStream; 00078 OFBool noSequenceExpansion; 00080 WlmReturnedCharacterSetType returnedCharacterSet; 00082 DcmDataset **matchingDatasets; 00084 unsigned long numOfMatchingDatasets; 00086 OFString specificCharacterSet; 00088 WlmSuperiorSequenceInfoType *superiorSequenceArray; 00090 unsigned long numOfSuperiorSequences; 00091 00097 OFBool CheckSearchMask( DcmDataset *searchMask ); 00098 00108 void CheckNonSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL ); 00109 00121 void CheckSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL ); 00122 00131 void ExpandEmptySequenceInSearchMask( DcmElement *&element ); 00132 00158 OFBool IsSupportedMatchingKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL ); 00159 00253 OFBool IsSupportedReturnKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL ); 00254 00258 void ClearDataset( DcmDataset *idents ); 00259 00265 void PutOffendingElements( DcmTagKey &tag ); 00266 00272 void PutErrorElements( DcmTagKey &tag ); 00273 00301 OFBool CheckMatchingKey( DcmElement *elem ); 00302 00310 OFBool ContainsOnlyValidCharacters( const char *s, const char *charset ); 00311 00316 OFBool IsValidDateOrDateRange( const char *value ); 00317 00325 OFBool IsValidDate( const char *value ); 00326 00331 OFBool IsValidTimeOrTimeRange( const char *value ); 00332 00346 OFBool IsValidTime( const char *value ); 00347 00353 char *GetStringValue( DcmElement *elem ); 00354 00359 void DumpMessage( const char *message ); 00360 00365 char *DeleteLeadingAndTrailingBlanks( const char *value ); 00366 00370 WlmDataSource( const WlmDataSource &Src ); 00371 00376 WlmDataSource &operator=( const WlmDataSource &Src ); 00377 00378 00379 public: 00382 WlmDataSource(); 00383 00386 virtual ~WlmDataSource(); 00387 00391 virtual OFCondition ConnectToDataSource() = 0; 00392 00396 virtual OFCondition DisconnectFromDataSource() = 0; 00397 00401 void SetCalledApplicationEntityTitle( char *value ); 00402 00406 void SetFailOnInvalidQuery( OFBool value ); 00407 00411 void SetLogStream( OFConsole *value ); 00412 00416 void SetVerbose( OFBool value ); 00417 00421 void SetDebug( OFBool value ); 00422 00426 void SetNoSequenceExpansion( OFBool value ); 00427 00431 void SetReturnedCharacterSet( WlmReturnedCharacterSetType value ); 00432 00440 virtual OFBool IsCalledApplicationEntityTitleSupported() = 0; 00441 00454 virtual WlmDataSourceStatusType StartFindRequest( DcmDataset &findRequestIdentifiers ) = 0; 00455 00466 virtual DcmDataset *NextFindResponse( WlmDataSourceStatusType &rStatus ) = 0; 00467 00474 WlmDataSourceStatusType CancelFindRequest(); 00475 00479 DcmAttributeTag *GetOffendingElements(); 00480 00484 DcmLongString *GetErrorComments(); 00485 00488 virtual void SetDbDsn( const char * /*value*/ ) {} 00489 00492 virtual void SetDbUserName( const char * /*value*/ ) {} 00493 00496 virtual void SetDbUserPassword( const char * /*value*/ ) {} 00497 00500 virtual void SetCfgFileMatchRecords( const char * /*value*/ ) {} 00501 00504 virtual void SetCfgFileSelectValues( const char * /*value*/ ) {} 00505 00508 virtual void SetDatabaseType( WlmDatabaseType /*value*/ ) {} 00509 00513 virtual void SetSerialNumber( const int /*value*/ ) {} 00514 00518 virtual void SetInstitutionId( const unsigned int /*value*/ ) {} 00519 00522 virtual void SetDfPath( const char * /*value*/ ) {} 00523 00526 virtual void SetEnableRejectionOfIncompleteWlFiles( OFBool /*value*/ ) {} 00527 00530 virtual void SetCreateNullvalues( OFBool /*value*/ ) {} 00531 00534 virtual void SetPfFileName( const char * /*value*/ ) {} 00535 00538 virtual void SetModalityToReturn( const char * /*value*/ ) {} 00539 00542 virtual void SetCommaSeparatePatientName( OFBool /*value*/ ) {} 00543 00546 virtual void SetReturnPatientUidInAccessionNumber( OFBool /*value*/ ) {} 00547 }; 00548 00549 #endif 00550 00551 /* 00552 ** CVS Log 00553 ** $Log: wlds.h,v $ 00554 ** Revision 1.23 2005/12/08 16:05:40 meichel 00555 ** Changed include path schema for all DCMTK header files 00556 ** 00557 ** Revision 1.22 2005/09/23 12:56:40 wilkens 00558 ** Added attribute PatientsBirthDate as a matching key attribute to wlmscpfs. 00559 ** Thanks to Andre M. Descombes <andre@descombes.info> for the code template. 00560 ** 00561 ** Revision 1.21 2005/05/04 11:34:31 wilkens 00562 ** Added two command line options --enable-file-reject (default) and 00563 ** --disable-file-reject to wlmscpfs: these options can be used to enable or 00564 ** disable a file rejection mechanism which makes sure only complete worklist files 00565 ** will be used during the matching process. A worklist file is considered to be 00566 ** complete if it contains all necessary type 1 information which the SCP might 00567 ** have to return to an SCU in a C-Find response message. 00568 ** 00569 ** Revision 1.20 2004/04/06 18:19:28 joergr 00570 ** Updated data dictionary, UIDs and transfer syntaxes for the latest Final Text 00571 ** Supplements (42 and 47) and Correction Proposals (CP 25). 00572 ** 00573 ** Revision 1.19 2004/01/15 12:01:24 wilkens 00574 ** Added function to Worklist Management Data Source Base Class. This function 00575 ** is needed in the private part of this toolkit. 00576 ** 00577 ** Revision 1.18 2004/01/07 09:52:18 wilkens 00578 ** Fixed typo in comment. 00579 ** 00580 ** Revision 1.17 2004/01/07 08:32:28 wilkens 00581 ** Added new sequence type return key attributes to wlmscpfs. Fixed bug that for 00582 ** equally named attributes in sequences always the same value will be returned. 00583 ** Added functionality that also more than one item will be returned in sequence 00584 ** type return key attributes. 00585 ** 00586 ** Revision 1.16 2004/01/02 13:56:14 wilkens 00587 ** Integrated new return key attributes into wlmscpfs and updated function that 00588 ** checks integrity of matching key attribute values (added support for new VR). 00589 ** 00590 ** Revision 1.15 2003/12/23 13:04:36 wilkens 00591 ** Integrated new matching key attributes into wlmscpfs. 00592 ** 00593 ** Revision 1.14 2003/12/11 10:45:33 wilkens 00594 ** Added function to Worklist Management Data Source Base Class. This function 00595 ** is needed in the private part of this toolkit. 00596 ** 00597 ** Revision 1.13 2003/08/21 13:38:23 wilkens 00598 ** Moved declaration and initialization of member variables matchingDatasets and 00599 ** numOfMatchingDatasets to base class. 00600 ** Got rid of superfluous member variable objlist and of superfluous function 00601 ** ClearObjList(). 00602 ** 00603 ** Revision 1.12 2003/07/02 09:17:55 wilkens 00604 ** Updated documentation to get rid of doxygen warnings. 00605 ** 00606 ** Revision 1.11 2003/02/17 12:02:03 wilkens 00607 ** Made some minor modifications to be able to modify a special variant of the 00608 ** worklist SCP implementation (wlmscpki). 00609 ** 00610 ** Revision 1.10 2002/12/16 11:08:33 wilkens 00611 ** Added missing #include "osconfig.h" to certain files. 00612 ** 00613 ** Revision 1.9 2002/08/12 10:56:07 wilkens 00614 ** Made some modifications in in order to be able to create a new application 00615 ** which contains both wlmscpdb and ppsscpdb and another application which 00616 ** contains both wlmscpfs and ppsscpfs. 00617 ** 00618 ** Revision 1.8 2002/07/17 13:10:36 wilkens 00619 ** Corrected some minor logical errors in the wlmscpdb sources and completely 00620 ** updated the wlmscpfs so that it does not use the original wlistctn sources 00621 ** any more but standard wlm sources which are now used by all three variants 00622 ** of wlmscps. 00623 ** 00624 ** Revision 1.7 2002/07/01 14:13:56 wilkens 00625 ** Some more corrections to get rid of msvc6's warnings. 00626 ** 00627 ** Revision 1.6 2002/06/10 11:25:05 wilkens 00628 ** Made some corrections to keep gcc 2.95.3 quiet. 00629 ** 00630 ** Revision 1.5 2002/05/08 13:20:51 wilkens 00631 ** Added new command line option -nse to wlmscpki and wlmscpdb. 00632 ** 00633 ** Revision 1.4 2002/04/18 14:20:08 wilkens 00634 ** Modified Makefiles. Updated latest changes again. These are the latest 00635 ** sources. Added configure file. 00636 ** 00637 ** Revision 1.3 2002/01/08 17:45:34 joergr 00638 ** Reformatted source files (replaced Windows newlines by Unix ones, replaced 00639 ** tabulator characters by spaces, etc.) 00640 ** 00641 ** Revision 1.2 2002/01/08 16:50:12 joergr 00642 ** Added preliminary database support using OTL interface library (modified by 00643 ** MC/JR on 2001-12-21). 00644 ** 00645 ** Revision 1.1 2002/01/08 16:30:59 joergr 00646 ** Added new module "dcmwlm" developed by Thomas Wilkens (initial release for 00647 ** Windows, dated 2001-12-20). 00648 ** 00649 ** 00650 */