GDCM: gdcmPresentationDataValue.h Source File

GDCM 3.2.7

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
21namespace gdcm
22{
23class DataSet;
24namespace network
25{
26
32 class GDCM_EXPORT PresentationDataValue
33{
34public:
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 gdcm_assert( id );
53 PresentationContextID = id;
54 }
55 uint8_t GetMessageHeader() const {
56 gdcm_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 gdcm_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 static DataSet ConcatenatePDVBlobsAsExplicit(const std::vector<PresentationDataValue>& inPDVs);
81
82private:
83 uint32_t ItemLength;
84 uint8_t PresentationContextID;
85 uint8_t MessageHeader;
86 std::string Blob;
87};
88} // end namespace network
89
90} // end namespace gdcm
91
92#endif //GDCMPRESENTATIONDATAVALUE_H
gdcm::DataSet
Class to represent a Data Set (which contains Data Elements).
Definition gdcmDataSet.h:56
gdcm::network::PresentationDataValue::GetIsCommand
bool GetIsCommand() const
gdcm::network::PresentationDataValue::GetBlob
const std::string & GetBlob() const
gdcm::network::PresentationDataValue::Print
void Print(std::ostream &os) const
gdcm::network::PresentationDataValue::ReadInto
std::istream & ReadInto(std::istream &is, std::ostream &os)
gdcm::network::PresentationDataValue::GetPresentationContextID
uint8_t GetPresentationContextID() const
Definition gdcmPresentationDataValue.h:50
gdcm::network::PresentationDataValue::GetIsLastFragment
bool GetIsLastFragment() const
gdcm::network::PresentationDataValue::GetMessageHeader
uint8_t GetMessageHeader() const
Definition gdcmPresentationDataValue.h:55
gdcm::network::PresentationDataValue::SetBlob
void SetBlob(const std::string &partialblob)
gdcm::network::PresentationDataValue::Size
size_t Size() const
gdcm::network::PresentationDataValue::ConcatenatePDVBlobs
static DataSet ConcatenatePDVBlobs(const std::vector< PresentationDataValue > &inPDVs)
gdcm::network::PresentationDataValue::Write
const std::ostream & Write(std::ostream &os) const
gdcm::network::PresentationDataValue::SetMessageHeader
void SetMessageHeader(uint8_t messageheader)
Definition gdcmPresentationDataValue.h:61
gdcm::network::PresentationDataValue::SetPresentationContextID
void SetPresentationContextID(uint8_t id)
Definition gdcmPresentationDataValue.h:51
gdcm::network::PresentationDataValue::SetCommand
void SetCommand(bool inCommand)
gdcm::network::PresentationDataValue::ConcatenatePDVBlobsAsExplicit
static DataSet ConcatenatePDVBlobsAsExplicit(const std::vector< PresentationDataValue > &inPDVs)
gdcm::network::PresentationDataValue::Read
std::istream & Read(std::istream &is)
gdcm::network::PresentationDataValue::SetLastFragment
void SetLastFragment(bool inLast)
gdcm::network::PresentationDataValue::PresentationDataValue
PresentationDataValue()
gdcm::network::PresentationDataValue::SetDataSet
void SetDataSet(const DataSet &ds)
gdcm_assert
#define gdcm_assert(cond)
Definition gdcmException.h:104
gdcmTypes.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm::network
Definition gdcmAAbortPDU.h:24
gdcm
Definition gdcmASN1.h:21