Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | Related Pages

dcbytstr.h

00001 /*
00002  *
00003  *  Copyright (C) 1994-2003, 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:  dcmdata
00019  *
00020  *  Author:  Gerd Ehlers, Andreas Barth
00021  *
00022  *  Purpose: Interface of class DcmByteString
00023  *
00024  *  Last Update:      $Author: meichel $
00025  *  Update Date:      $Date: 2003/07/04 13:25:35 $
00026  *  Source File:      $Source: /share/dicom/cvs-depot/dcmtk/dcmdata/include/dcbytstr.h,v $
00027  *  CVS/RCS Revision: $Revision: 1.28 $
00028  *  Status:           $State: Exp $
00029  *
00030  *  CVS/RCS Log at end of file
00031  *
00032  */
00033 
00034 
00035 #ifndef DCBYTSTR_H
00036 #define DCBYTSTR_H
00037 
00038 #include "osconfig.h"    /* make sure OS specific configuration is included first */
00039 
00040 #include "ofconsol.h"
00041 #include "dcerror.h"
00042 #include "dctypes.h"
00043 #include "dcelem.h"
00044 #include "ofstring.h"
00045 
00046 
00049 class DcmByteString
00050   : public DcmElement
00051 {
00052 
00054     enum E_StringMode
00055     {
00057         DCM_MachineString,
00059         DCM_DicomString,
00061         DCM_UnknownString
00062     };
00063 
00064 
00065  public:
00066 
00072     DcmByteString(const DcmTag &tag,
00073                   const Uint32 len = 0);
00074 
00078     DcmByteString(const DcmByteString &old);
00079 
00082     virtual ~DcmByteString();
00083 
00088     DcmByteString& operator=(const DcmByteString& obj);
00089 
00093     virtual DcmEVR ident() const;
00094 
00098     virtual OFCondition clear();
00099 
00103     virtual unsigned long getVM();
00104 
00109     Uint32 getRealLength();
00110 
00118     virtual Uint32 getLength(const E_TransferSyntax xfer = EXS_LittleEndianImplicit,
00119                              const E_EncodingType enctype = EET_UndefinedLength);
00120 
00130     virtual void print(ostream &out,
00131                        const size_t flags = 0,
00132                        const int level = 0,
00133                        const char *pixelFileName = NULL,
00134                        size_t *pixelCounter = NULL);
00135 
00141     virtual OFCondition write(DcmOutputStream &outStream,
00142                               const E_TransferSyntax writeXfer,
00143                               const E_EncodingType encodingType = EET_UndefinedLength);
00144 
00150     virtual OFCondition writeSignatureFormat(DcmOutputStream &outStream,
00151                                              const E_TransferSyntax writeXfer,
00152                                              const E_EncodingType encodingType = EET_UndefinedLength);
00153 
00160     virtual OFCondition getOFString(OFString &stringVal,
00161                                     const unsigned long pos,
00162                                     OFBool normalize = OFTrue);
00163 
00170     virtual OFCondition getString(char *&stringVal);
00171 
00176     virtual OFCondition putString(const char *stringVal);
00177 
00182     virtual OFCondition putOFStringArray(const OFString &stringVal);
00183 
00190     virtual OFCondition verify(const OFBool autocorrect = OFFalse);
00191 
00192 
00193  protected:
00194 
00201     virtual Uint8 *newValueField();
00202 
00206     virtual void postLoadValue();
00207 
00212     virtual OFCondition makeMachineByteString();
00213 
00219     OFCondition makeDicomByteString();
00220 
00226     OFCondition getStringValue(OFString &stringVal);
00227 
00229     char paddingChar;
00231     Uint32 maxLength;
00232 
00233 
00234  private:
00235 
00237     Uint32 realLength;
00239     E_StringMode fStringMode;
00240 };
00241 
00242 
00247 
00249 const OFBool DELETE_TRAILING = OFTrue;
00251 const OFBool DELETE_LEADING = OFTrue;
00253 const OFBool MULTIPART = OFTrue;
00254 
00256 
00257 
00258 /* Function to get part out of a String for VM > 1 */
00259 
00267 OFCondition getStringPart(OFString &result,
00268                           const char *orgStr,
00269                           const unsigned long pos);
00270 
00271 
00278 void normalizeString(OFString &string,
00279                      const OFBool multiPart,
00280                      const OFBool leading,
00281                      const OFBool trailing);
00282 
00283 
00284 #endif // DCBYTSTR_H
00285 
00286 
00287 /*
00288 ** CVS/RCS Log:
00289 ** $Log: dcbytstr.h,v $
00290 ** Revision 1.28  2003/07/04 13:25:35  meichel
00291 ** Replaced forward declarations for OFString with explicit includes,
00292 **   needed when compiling with HAVE_STD_STRING
00293 **
00294 ** Revision 1.27  2003/06/12 13:35:54  joergr
00295 ** Fixed inconsistent API documentation reported by Doxygen.
00296 **
00297 ** Revision 1.26  2002/12/10 17:41:22  meichel
00298 ** Removed typedef to avoid warnings on various compilers
00299 **
00300 ** Revision 1.25  2002/12/06 12:49:07  joergr
00301 ** Enhanced "print()" function by re-working the implementation and replacing
00302 ** the boolean "showFullData" parameter by a more general integer flag.
00303 ** Added doc++ documentation.
00304 ** Made source code formatting more consistent with other modules/files.
00305 **
00306 ** Revision 1.24  2002/08/27 16:55:30  meichel
00307 ** Initial release of new DICOM I/O stream classes that add support for stream
00308 **   compression (deflated little endian explicit VR transfer syntax)
00309 **
00310 ** Revision 1.23  2002/04/25 10:05:14  joergr
00311 ** Removed getOFStringArray() implementation.
00312 ** Made makeMachineByteString() virtual to avoid ambiguities.
00313 **
00314 ** Revision 1.22  2001/09/25 17:19:24  meichel
00315 ** Adapted dcmdata to class OFCondition
00316 **
00317 ** Revision 1.21  2001/06/01 15:48:33  meichel
00318 ** Updated copyright header
00319 **
00320 ** Revision 1.20  2000/11/07 16:56:05  meichel
00321 ** Initial release of dcmsign module for DICOM Digital Signatures
00322 **
00323 ** Revision 1.19  2000/04/14 15:31:31  meichel
00324 ** Removed default value from output stream passed to print() method.
00325 **   Required for use in multi-thread environments.
00326 **
00327 ** Revision 1.18  2000/03/08 16:26:11  meichel
00328 ** Updated copyright header.
00329 **
00330 ** Revision 1.17  2000/03/03 14:05:22  meichel
00331 ** Implemented library support for redirecting error messages into memory
00332 **   instead of printing them to stdout/stderr for GUI applications.
00333 **
00334 ** Revision 1.16  2000/02/10 10:50:49  joergr
00335 ** Added new feature to dcmdump (enhanced print method of dcmdata): write
00336 ** pixel data/item value fields to raw files.
00337 **
00338 ** Revision 1.15  1999/03/31 09:24:30  meichel
00339 ** Updated copyright header in module dcmdata
00340 **
00341 ** Revision 1.14  1998/11/12 16:47:36  meichel
00342 ** Implemented operator= for all classes derived from DcmObject.
00343 **
00344 ** Revision 1.13  1997/09/11 15:13:09  hewett
00345 ** Modified getOFString method arguments by removing a default value
00346 ** for the pos argument.  By requiring the pos argument to be provided
00347 ** ensures that callers realise getOFString only gets one component of
00348 ** a multi-valued string.
00349 **
00350 ** Revision 1.12  1997/08/29 13:11:38  andreas
00351 ** Corrected Bug in getOFStringArray Implementation
00352 **
00353 ** Revision 1.11  1997/08/29 08:32:37  andreas
00354 ** - Added methods getOFString and getOFStringArray for all
00355 **   string VRs. These methods are able to normalise the value, i. e.
00356 **   to remove leading and trailing spaces. This will be done only if
00357 **   it is described in the standard that these spaces are not relevant.
00358 **   These methods do not test the strings for conformance, this means
00359 **   especially that they do not delete spaces where they are not allowed!
00360 **   getOFStringArray returns the string with all its parts separated by \
00361 **   and getOFString returns only one value of the string.
00362 **   CAUTION: Currently getString returns a string with trailing
00363 **   spaces removed (if dcmEnableAutomaticInputDataCorrection == OFTrue) and
00364 **   truncates the original string (since it is not copied!). If you rely on this
00365 **   behaviour please change your application now.
00366 **   Future changes will ensure that getString returns the original
00367 **   string from the DICOM object (NULL terminated) inclusive padding.
00368 **   Currently, if you call getOF... before calling getString without
00369 **   normalisation, you can get the original string read from the DICOM object.
00370 **
00371 ** Revision 1.10  1997/07/21 08:25:05  andreas
00372 ** - Replace all boolean types (BOOLEAN, CTNBOOLEAN, DICOM_BOOL, BOOL)
00373 **   with one unique boolean type OFBool.
00374 **
00375 ** Revision 1.9  1997/05/16 08:31:19  andreas
00376 ** - Revised handling of GroupLength elements and support of
00377 **   DataSetTrailingPadding elements. The enumeratio E_GrpLenEncoding
00378 **   got additional enumeration values (for a description see dctypes.h).
00379 **   addGroupLength and removeGroupLength methods are replaced by
00380 **   computeGroupLengthAndPadding. To support Padding, the parameters of
00381 **   element and sequence write functions changed.
00382 **
00383 ** Revision 1.8  1997/04/18 08:13:28  andreas
00384 ** - The put/get-methods for all VRs did not conform to the C++-Standard
00385 **   draft. Some Compilers (e.g. SUN-C++ Compiler, Metroworks
00386 **   CodeWarrier, etc.) create many warnings concerning the hiding of
00387 **   overloaded get methods in all derived classes of DcmElement.
00388 **   So the interface of all value representation classes in the
00389 **   library are changed rapidly, e.g.
00390 **   OFCondition get(Uint16 & value, const unsigned long pos);
00391 **   becomes
00392 **   OFCondition getUint16(Uint16 & value, const unsigned long pos);
00393 **   All (retired) "returntype get(...)" methods are deleted.
00394 **   For more information see dcmdata/include/dcelem.h
00395 **
00396 ** Revision 1.7  1996/08/05 08:45:15  andreas
00397 ** new print routine with additional parameters:
00398 **         - print into files
00399 **         - fix output length for elements
00400 ** corrected error in search routine with parameter ESM_fromStackTop
00401 **
00402 ** Revision 1.6  1996/03/12 15:26:52  hewett
00403 ** Removed get method for unsigned char*
00404 **
00405 ** Revision 1.5  1996/01/29 13:38:11  andreas
00406 ** - new put method for every VR to put value as a string
00407 ** - better and unique print methods
00408 **
00409 ** Revision 1.4  1996/01/09 11:06:13  andreas
00410 ** New Support for Visual C++
00411 ** Correct problems with inconsistent const declarations
00412 **
00413 ** Revision 1.3  1996/01/05 13:22:52  andreas
00414 ** - changed to support new streaming facilities
00415 ** - more cleanups
00416 ** - merged read / write methods for block and file transfer
00417 **
00418 */


Generated on 26 Apr 2005 for OFFIS DCMTK Version 3.5.3 by Doxygen 1.4.2