GDCM
2.2.3
|
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 PresentationContextID = id; 00054 } 00055 uint8_t GetMessageHeader() const { 00056 assert( MessageHeader <= 0x3 ); 00057 return MessageHeader; 00058 } 00059 // E.2 MESSAGE CONTROL HEADER ENCODING 00060 // Only the first two bits are considered 00061 void SetMessageHeader(uint8_t messageheader) { 00062 MessageHeader = messageheader; 00063 assert( MessageHeader <= 0x3 ); 00064 } 00065 //flip the least significant bit of the message header to 1 00066 //if this is a command, else set it to 0. 00067 void SetCommand(bool inCommand); 00068 void SetLastFragment(bool inLast);//set to true if this is the last PDV of a set 00069 00070 bool GetIsCommand() const; 00071 bool GetIsLastFragment() const; 00072 00073 void Print(std::ostream &os) const; 00074 00075 //NOTE that the PDVs have to be given in the order in which they were received! 00076 //also note that a dataset may be across multiple PDVs 00078 static DataSet ConcatenatePDVBlobs(const std::vector<PresentationDataValue>& inPDVs); 00079 00080 private: 00081 uint32_t ItemLength; 00082 uint8_t PresentationContextID; 00083 uint8_t MessageHeader; 00084 std::string Blob; 00085 }; 00086 } // end namespace network 00087 00088 } // end namespace gdcm 00089 00090 #endif //GDCMPRESENTATIONDATAVALUE_H