GDCM  2.2.0
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 
33 {
34 public:
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  assert( id % 2 == 1 );
54  PresentationContextID = id;
55  }
56  uint8_t GetMessageHeader() const {
57  assert( MessageHeader <= 0x3 );
58  return MessageHeader;
59  }
60  // E.2 MESSAGE CONTROL HEADER ENCODING
61  // Only the first two bits are considered
62  void SetMessageHeader(uint8_t messageheader) {
63  MessageHeader = messageheader;
64  assert( MessageHeader <= 0x3 );
65  }
66  //flip the least significant bit of the message header to 1
67  //if this is a command, else set it to 0.
68  void SetCommand(bool inCommand);
69  void SetLastFragment(bool inLast);//set to true if this is the last PDV of a set
70 
71  bool GetIsCommand() const;
72  bool GetIsLastFragment() const;
73 
74  void Print(std::ostream &os) const;
75 
76  //NOTE that the PDVs have to be given in the order in which they were received!
77  //also note that a dataset may be across multiple PDVs
79  static DataSet ConcatenatePDVBlobs(const std::vector<PresentationDataValue>& inPDVs);
80 
81 private:
82  uint32_t ItemLength;
83  uint8_t PresentationContextID;
84  uint8_t MessageHeader;
85  std::string Blob;
86 };
87 } // end namespace network
88 
89 } // end namespace gdcm
90 
91 #endif //GDCMPRESENTATIONDATAVALUE_H

Generated on Wed Jun 13 2012 20:40:37 for GDCM by doxygen 1.8.1
SourceForge.net Logo