dcmwlm/include/dcmtk/dcmwlm/wlds.h

00001 /*
00002  *
00003  *  Copyright (C) 1996-2010, OFFIS e.V.
00004  *  All rights reserved.  See COPYRIGHT file for details.
00005  *
00006  *  This software and supporting documentation were developed by
00007  *
00008  *    OFFIS e.V.
00009  *    R&D Division Health
00010  *    Escherweg 2
00011  *    D-26121 Oldenburg, Germany
00012  *
00013  *
00014  *  Module:  dcmwlm
00015  *
00016  *  Author:  Thomas Wilkens
00017  *
00018  *  Purpose: (Partially) abstract class for connecting to an arbitrary data source.
00019  *
00020  *  Last Update:      $Author: joergr $
00021  *  Update Date:      $Date: 2010-10-14 13:16:38 $
00022  *  CVS/RCS Revision: $Revision: 1.28 $
00023  *  Status:           $State: Exp $
00024  *
00025  *  CVS/RCS Log at end of file
00026  *
00027  */
00028 
00029 #ifndef WlmDataSource_h
00030 #define WlmDataSource_h
00031 
00032 #include "dcmtk/config/osconfig.h"
00033 #include "dcmtk/dcmwlm/wltypdef.h"
00034 #include "dcmtk/dcmdata/dcdatset.h"
00035 #include "dcmtk/oflog/oflog.h"
00036 
00037 OFLogger DCM_dcmwlmGetLogger();
00038 
00039 #define DCMWLM_TRACE(msg) OFLOG_TRACE(DCM_dcmwlmGetLogger(), msg)
00040 #define DCMWLM_DEBUG(msg) OFLOG_DEBUG(DCM_dcmwlmGetLogger(), msg)
00041 #define DCMWLM_INFO(msg)  OFLOG_INFO(DCM_dcmwlmGetLogger(), msg)
00042 #define DCMWLM_WARN(msg)  OFLOG_WARN(DCM_dcmwlmGetLogger(), msg)
00043 #define DCMWLM_ERROR(msg) OFLOG_ERROR(DCM_dcmwlmGetLogger(), msg)
00044 #define DCMWLM_FATAL(msg) OFLOG_FATAL(DCM_dcmwlmGetLogger(), msg)
00045 
00046 class DcmAttributeTag;
00047 class DcmLongString;
00048 
00052 class WlmDataSource
00053 {
00054   protected:
00055 
00057     OFBool failOnInvalidQuery;
00059     OFString calledApplicationEntityTitle;
00061     DcmDataset *identifiers;
00063     DcmAttributeTag *errorElements;
00065     DcmAttributeTag *offendingElements;
00067     DcmLongString *errorComment;
00069     OFBool foundUnsupportedOptionalKey;
00071     OFBool readLockSetOnDataSource;
00073     OFBool noSequenceExpansion;
00075     WlmReturnedCharacterSetType returnedCharacterSet;
00077     OFList<DcmDataset*> matchingDatasets;
00079     OFString specificCharacterSet;
00081     WlmSuperiorSequenceInfoType *superiorSequenceArray;
00083     unsigned long numOfSuperiorSequences;
00084 
00090     OFBool CheckSearchMask( DcmDataset *searchMask );
00091 
00101     void CheckNonSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
00102 
00114     void CheckSequenceElementInSearchMask( DcmDataset *searchMask, int &invalidMatchingKeyAttributeCount, DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
00115 
00124     void ExpandEmptySequenceInSearchMask( DcmElement *&element );
00125 
00151     OFBool IsSupportedMatchingKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
00152 
00246     OFBool IsSupportedReturnKeyAttribute( DcmElement *element, DcmSequenceOfItems *supSequenceElement=NULL );
00247 
00251     void ClearDataset( DcmDataset *idents );
00252 
00258     void PutOffendingElements( const DcmTagKey &tag );
00259 
00265     void PutErrorElements( const DcmTagKey &tag );
00266 
00294     OFBool CheckMatchingKey( const DcmElement *elem );
00295 
00303     OFBool ContainsOnlyValidCharacters( const char *s, const char *charset );
00304 
00309     OFBool IsValidDateOrDateRange( const OFString& value );
00310 
00318     OFBool IsValidDate( const OFString& value );
00319 
00324     OFBool IsValidTimeOrTimeRange( const OFString& value );
00325 
00339     OFBool IsValidTime( const OFString& value );
00340 
00349     OFBool GetStringValue( const DcmElement *elem,
00350                            OFString& resultVal );
00351 
00356     OFString DeleteLeadingAndTrailingBlanks( const OFString& value );
00357 
00361     WlmDataSource( const WlmDataSource &Src );
00362 
00367     WlmDataSource &operator=( const WlmDataSource &Src );
00368 
00369 
00370   public:
00373     WlmDataSource();
00374 
00377     virtual ~WlmDataSource();
00378 
00382     virtual OFCondition ConnectToDataSource() = 0;
00383 
00387     virtual OFCondition DisconnectFromDataSource() = 0;
00388 
00392     void SetCalledApplicationEntityTitle( const OFString& value );
00393 
00397     void SetFailOnInvalidQuery( OFBool value );
00398 
00402     void SetNoSequenceExpansion( OFBool value );
00403 
00407     void SetReturnedCharacterSet( WlmReturnedCharacterSetType value );
00408 
00416     virtual OFBool IsCalledApplicationEntityTitleSupported() = 0;
00417 
00430     virtual WlmDataSourceStatusType StartFindRequest( const DcmDataset &findRequestIdentifiers ) = 0;
00431 
00442     virtual DcmDataset *NextFindResponse( WlmDataSourceStatusType &rStatus ) = 0;
00443 
00450     WlmDataSourceStatusType CancelFindRequest();
00451 
00455     DcmAttributeTag *GetOffendingElements();
00456 
00460     DcmLongString *GetErrorComments();
00461 
00464     virtual void SetDbDsn( const OFString& /*value*/ ) {}
00465 
00468     virtual void SetDbUserName( const OFString& /*value*/ ) {}
00469 
00472     virtual void SetDbUserPassword( const OFString& /*value*/ ) {}
00473 
00476     virtual void SetCfgFileMatchRecords( const OFString& /*value*/ ) {}
00477 
00480     virtual void SetCfgFileSelectValues( const OFString& /*value*/ ) {}
00481 
00484     virtual void SetDatabaseType( WlmDatabaseType /*value*/ ) {}
00485 
00489     virtual void SetSerialNumber( const int /*value*/ ) {}
00490 
00494     virtual void SetInstitutionId( const unsigned int /*value*/ ) {}
00495 
00498     virtual void SetDfPath( const OFString& /*value*/ ) {}
00499 
00502     virtual void SetEnableRejectionOfIncompleteWlFiles( OFBool /*value*/ ) {}
00503 
00506     virtual void SetCreateNullvalues( OFBool /*value*/ ) {}
00507 
00510     virtual void SetPfFileName( const OFString& /*value*/ ) {}
00511 
00514     virtual void SetModalityToReturn( const OFString& /*value*/ ) {}
00515 
00518     virtual void SetCommaSeparatePatientName( OFBool /*value*/ ) {}
00519 
00522     virtual void SetReturnPatientUidInAccessionNumber( OFBool /*value*/ ) {}
00523 };
00524 
00525 #endif
00526 
00527 /*
00528 ** CVS Log
00529 ** $Log: wlds.h,v $
00530 ** Revision 1.28  2010-10-14 13:16:38  joergr
00531 ** Updated copyright header. Added reference to COPYRIGHT file.
00532 **
00533 ** Revision 1.27  2010-08-09 13:29:38  joergr
00534 ** Updated data dictionary to 2009 edition of the DICOM standard. From now on,
00535 ** the official "keyword" is used for the attribute name which results in a
00536 ** number of minor changes (e.g. "PatientsName" is now called "PatientName").
00537 **
00538 ** Revision 1.26  2009-11-24 10:40:01  uli
00539 ** Switched to logging mechanism provided by the "new" oflog module.
00540 **
00541 ** Revision 1.25  2009-09-30 08:40:34  uli
00542 ** Make dcmwlm's include headers self-sufficient by including all
00543 ** needed headers directly.
00544 **
00545 ** Revision 1.24  2006-12-15 14:49:21  onken
00546 ** Removed excessive use char* and C-array in favour of OFString and
00547 ** OFList. Simplified some implementation details.
00548 **
00549 ** Revision 1.23  2005/12/08 16:05:40  meichel
00550 ** Changed include path schema for all DCMTK header files
00551 **
00552 ** Revision 1.22  2005/09/23 12:56:40  wilkens
00553 ** Added attribute PatientsBirthDate as a matching key attribute to wlmscpfs.
00554 ** Thanks to Andre M. Descombes <andre@descombes.info> for the code template.
00555 **
00556 ** Revision 1.21  2005/05/04 11:34:31  wilkens
00557 ** Added two command line options --enable-file-reject (default) and
00558 ** --disable-file-reject to wlmscpfs: these options can be used to enable or
00559 ** disable a file rejection mechanism which makes sure only complete worklist files
00560 ** will be used during the matching process. A worklist file is considered to be
00561 ** complete if it contains all necessary type 1 information which the SCP might
00562 ** have to return to an SCU in a C-Find response message.
00563 **
00564 ** Revision 1.20  2004/04/06 18:19:28  joergr
00565 ** Updated data dictionary, UIDs and transfer syntaxes for the latest Final Text
00566 ** Supplements (42 and 47) and Correction Proposals (CP 25).
00567 **
00568 ** Revision 1.19  2004/01/15 12:01:24  wilkens
00569 ** Added function to Worklist Management Data Source Base Class. This function
00570 ** is needed in the private part of this toolkit.
00571 **
00572 ** Revision 1.18  2004/01/07 09:52:18  wilkens
00573 ** Fixed typo in comment.
00574 **
00575 ** Revision 1.17  2004/01/07 08:32:28  wilkens
00576 ** Added new sequence type return key attributes to wlmscpfs. Fixed bug that for
00577 ** equally named attributes in sequences always the same value will be returned.
00578 ** Added functionality that also more than one item will be returned in sequence
00579 ** type return key attributes.
00580 **
00581 ** Revision 1.16  2004/01/02 13:56:14  wilkens
00582 ** Integrated new return key attributes into wlmscpfs and updated function that
00583 ** checks integrity of matching key attribute values (added support for new VR).
00584 **
00585 ** Revision 1.15  2003/12/23 13:04:36  wilkens
00586 ** Integrated new matching key attributes into wlmscpfs.
00587 **
00588 ** Revision 1.14  2003/12/11 10:45:33  wilkens
00589 ** Added function to Worklist Management Data Source Base Class. This function
00590 ** is needed in the private part of this toolkit.
00591 **
00592 ** Revision 1.13  2003/08/21 13:38:23  wilkens
00593 ** Moved declaration and initialization of member variables matchingDatasets and
00594 ** numOfMatchingDatasets to base class.
00595 ** Got rid of superfluous member variable objlist and of superfluous function
00596 ** ClearObjList().
00597 **
00598 ** Revision 1.12  2003/07/02 09:17:55  wilkens
00599 ** Updated documentation to get rid of doxygen warnings.
00600 **
00601 ** Revision 1.11  2003/02/17 12:02:03  wilkens
00602 ** Made some minor modifications to be able to modify a special variant of the
00603 ** worklist SCP implementation (wlmscpki).
00604 **
00605 ** Revision 1.10  2002/12/16 11:08:33  wilkens
00606 ** Added missing #include "osconfig.h" to certain files.
00607 **
00608 ** Revision 1.9  2002/08/12 10:56:07  wilkens
00609 ** Made some modifications in in order to be able to create a new application
00610 ** which contains both wlmscpdb and ppsscpdb and another application which
00611 ** contains both wlmscpfs and ppsscpfs.
00612 **
00613 ** Revision 1.8  2002/07/17 13:10:36  wilkens
00614 ** Corrected some minor logical errors in the wlmscpdb sources and completely
00615 ** updated the wlmscpfs so that it does not use the original wlistctn sources
00616 ** any more but standard wlm sources which are now used by all three variants
00617 ** of wlmscps.
00618 **
00619 ** Revision 1.7  2002/07/01 14:13:56  wilkens
00620 ** Some more corrections to get rid of msvc6's warnings.
00621 **
00622 ** Revision 1.6  2002/06/10 11:25:05  wilkens
00623 ** Made some corrections to keep gcc 2.95.3 quiet.
00624 **
00625 ** Revision 1.5  2002/05/08 13:20:51  wilkens
00626 ** Added new command line option -nse to wlmscpki and wlmscpdb.
00627 **
00628 ** Revision 1.4  2002/04/18 14:20:08  wilkens
00629 ** Modified Makefiles. Updated latest changes again. These are the latest
00630 ** sources. Added configure file.
00631 **
00632 ** Revision 1.3  2002/01/08 17:45:34  joergr
00633 ** Reformatted source files (replaced Windows newlines by Unix ones, replaced
00634 ** tabulator characters by spaces, etc.)
00635 **
00636 ** Revision 1.2  2002/01/08 16:50:12  joergr
00637 ** Added preliminary database support using OTL interface library (modified by
00638 ** MC/JR on 2001-12-21).
00639 **
00640 ** Revision 1.1  2002/01/08 16:30:59  joergr
00641 ** Added new module "dcmwlm" developed by Thomas Wilkens (initial release for
00642 ** Windows, dated 2001-12-20).
00643 **
00644 **
00645 */


Generated on 6 Jan 2011 for OFFIS DCMTK Version 3.6.0 by Doxygen 1.5.1