GDCM 2.2.1

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

- File List
- File Members

gdcmPresentationDataValue.h
Go to the documentation of this file.
1 /*=========================================================================
2
3 Program: GDCM (Grassroots DICOM). A DICOM library
4
5 Copyright (c) 2006-2011 Mathieu Malaterre
6 All rights reserved.
7 See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
8
9 This software is distributed WITHOUT ANY WARRANTY; without even
10 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
11 PURPOSE. See the above copyright notice for more information.
12
13 =========================================================================*/
14 #ifndef GDCMPRESENTATIONDATAVALUE_H
15 #define GDCMPRESENTATIONDATAVALUE_H
16
17 #include "gdcmTypes.h"
18
19 #include <vector>
20
21 namespace gdcm
22 {
23 class DataSet;
24 namespace network
25 {
26
32 class GDCM_EXPORT PresentationDataValue
33 {
34 public:
35 PresentationDataValue();
36 std::istream &Read(std::istream &is);
37 std::istream &ReadInto(std::istream &is, std::ostream &os);
38
39 const std::ostream &Write(std::ostream &os) const;
40
42 size_t Size() const;
43
46 void SetDataSet(const DataSet & ds);
47 void SetBlob(const std::string & partialblob);
48 const std::string &GetBlob() const;
49
50 uint8_t GetPresentationContextID() const { return PresentationContextID; }
51 void SetPresentationContextID(uint8_t id) {
52 assert( id );
53 PresentationContextID = id;
54 }
55 uint8_t GetMessageHeader() const {
56 assert( MessageHeader <= 0x3 );
57 return MessageHeader;
58 }
59 // E.2 MESSAGE CONTROL HEADER ENCODING
60 // Only the first two bits are considered
61 void SetMessageHeader(uint8_t messageheader) {
62 MessageHeader = messageheader;
63 assert( MessageHeader <= 0x3 );
64 }
65 //flip the least significant bit of the message header to 1
66 //if this is a command, else set it to 0.
67 void SetCommand(bool inCommand);
68 void SetLastFragment(bool inLast);//set to true if this is the last PDV of a set
69
70 bool GetIsCommand() const;
71 bool GetIsLastFragment() const;
72
73 void Print(std::ostream &os) const;
74
75 //NOTE that the PDVs have to be given in the order in which they were received!
76 //also note that a dataset may be across multiple PDVs
78 static DataSet ConcatenatePDVBlobs(const std::vector<PresentationDataValue>& inPDVs);
79
80 private:
81 uint32_t ItemLength;
82 uint8_t PresentationContextID;
83 uint8_t MessageHeader;
84 std::string Blob;
85 };
86 } // end namespace network
87
88 } // end namespace gdcm
89
90 #endif //GDCMPRESENTATIONDATAVALUE_H