GDCM 2.2.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files
- Directories
- Examples

- File List
- File Members

gdcmPresentationDataValue.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004
    00005   Copyright (c) 2006-2011 Mathieu Malaterre
    00006   All rights reserved.
    00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00008
    00009      This software is distributed WITHOUT ANY WARRANTY; without even
    00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00011      PURPOSE.  See the above copyright notice for more information.
    00012
    00013 =========================================================================*/
    00014 #ifndef GDCMPRESENTATIONDATAVALUE_H
    00015 #define GDCMPRESENTATIONDATAVALUE_H
    00016
    00017 #include "gdcmTypes.h"
    00018
    00019 #include <vector>
    00020
    00021 namespace gdcm
    00022 {
    00023 class DataSet;
    00024 namespace network
    00025 {
    00026
    00032 class GDCM_EXPORT PresentationDataValue
    00033 {
    00034 public:
    00035   PresentationDataValue();
    00036   std::istream &Read(std::istream &is);
    00037   std::istream &ReadInto(std::istream &is, std::ostream &os);
    00038
    00039   const std::ostream &Write(std::ostream &os) const;
    00040
    00042   size_t Size() const;
    00043
    00046   void SetDataSet(const DataSet & ds);
    00047   void SetBlob(const std::string & partialblob);
    00048   const std::string &GetBlob() const;
    00049
    00050   uint8_t GetPresentationContextID() const { return PresentationContextID; }
    00051   void SetPresentationContextID(uint8_t id) {
    00052     assert( id );
    00053     assert( id % 2 == 1 );
    00054     PresentationContextID = id;
    00055   }
    00056   uint8_t GetMessageHeader() const {
    00057     assert( MessageHeader <= 0x3 );
    00058     return MessageHeader;
    00059   }
    00060   // E.2 MESSAGE CONTROL HEADER ENCODING
    00061   // Only the first two bits are considered
    00062   void SetMessageHeader(uint8_t messageheader) {
    00063     MessageHeader = messageheader;
    00064     assert( MessageHeader <= 0x3 );
    00065   }
    00066   //flip the least significant bit of the message header to 1
    00067   //if this is a command, else set it to 0.
    00068   void SetCommand(bool inCommand);
    00069   void SetLastFragment(bool inLast);//set to true if this is the last PDV of a set
    00070
    00071   bool GetIsCommand() const;
    00072   bool GetIsLastFragment() const;
    00073
    00074   void Print(std::ostream &os) const;
    00075
    00076   //NOTE that the PDVs have to be given in the order in which they were received!
    00077   //also note that a dataset may be across multiple PDVs
    00079   static DataSet ConcatenatePDVBlobs(const std::vector<PresentationDataValue>& inPDVs);
    00080
    00081 private:
    00082   uint32_t ItemLength;
    00083   uint8_t PresentationContextID;
    00084   uint8_t MessageHeader;
    00085   std::string Blob;
    00086 };
    00087 } // end namespace network
    00088
    00089 } // end namespace gdcm
    00090
    00091 #endif //GDCMPRESENTATIONDATAVALUE_H