GDCM 2.2.1

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

- File List
- File Members

gdcmPresentationContextRQ.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 GDCMPRESENTATIONCONTEXTRQ_H
15 #define GDCMPRESENTATIONCONTEXTRQ_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmAbstractSyntax.h"
19 #include "gdcmTransferSyntaxSub.h"
20 #include "gdcmDataSet.h"
21
22 namespace gdcm
23 {
24 class PresentationContext;
25 namespace network
26 {
27
34 class GDCM_EXPORT PresentationContextRQ
35 {
36 public:
37 PresentationContextRQ();
38
42 PresentationContextRQ( UIDs::TSName asname, UIDs::TSName tsname =
43 UIDs::ImplicitVRLittleEndianDefaultTransferSyntaxforDICOM );
44
45 std::istream &Read(std::istream &is);
46 const std::ostream &Write(std::ostream &os) const;
47 size_t Size() const;
48
49 void SetAbstractSyntax( AbstractSyntax const & as );
50 AbstractSyntax const &GetAbstractSyntax() const { return SubItems; }
51 AbstractSyntax &GetAbstractSyntax() { return SubItems; }
52
53 void AddTransferSyntax( TransferSyntaxSub const &ts );
54 typedef std::vector<TransferSyntaxSub>::size_type SizeType;
55 TransferSyntaxSub const & GetTransferSyntax(SizeType i) const { return TransferSyntaxes[i]; }
56 TransferSyntaxSub & GetTransferSyntax(SizeType i) { return TransferSyntaxes[i]; }
57 std::vector<TransferSyntaxSub> const & GetTransferSyntaxes() const {return TransferSyntaxes; }
58 SizeType GetNumberOfTransferSyntaxes() const { return TransferSyntaxes.size(); }
59
60 void SetPresentationContextID( uint8_t id );
61 uint8_t GetPresentationContextID() const;
62
63 void Print(std::ostream &os) const;
64
65 bool operator==(const PresentationContextRQ & pc) const
66 {
67 assert( TransferSyntaxes.size() == 1 ); // TODO
68 assert( pc.TransferSyntaxes.size() == 1 );
69 return SubItems == pc.SubItems && TransferSyntaxes == pc.TransferSyntaxes;
70 }
71
72 PresentationContextRQ(const PresentationContext & pc);
73
74 private:
75 static const uint8_t ItemType;
76 static const uint8_t Reserved2;
77 uint16_t ItemLength; // len of last transfer syntax
78 uint8_t /*PresentationContext*/ID;
79 static const uint8_t Reserved6;
80 static const uint8_t Reserved7;
81 static const uint8_t Reserved8;
82 /*
83 This variable field shall contain the following sub-items: one Abstract
84 Syntax and one or more Transfer Syntax(es). For a complete
85 description of the use and encoding of these sub-items see Sections
86 9.3.2.2.1 and 9.3.2.2.2.
87 */
88 AbstractSyntax SubItems;
89 std::vector<TransferSyntaxSub> TransferSyntaxes;
90 };
91
92 } // end namespace network
93
94 } // end namespace gdcm
95
96 #endif //GDCMPRESENTATIONCONTEXTRQ_H