GDCM 2.2.1

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

- File List
- File Members

gdcmAAssociateRQPDU.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 GDCMAASSOCIATERQPDU_H
15 #define GDCMAASSOCIATERQPDU_H
16
17 #include "gdcmTypes.h"
18 #include "gdcmVR.h" // AEComp
19 #include "gdcmApplicationContext.h"
20 #include "gdcmPresentationContextRQ.h"
21 #include "gdcmUserInformation.h"
22 #include "gdcmBasePDU.h"
23
24 namespace gdcm
25 {
26
27 namespace network
28 {
29
30 class AAssociateACPDU;
35 class AAssociateRQPDU : public BasePDU
36 {
37 public:
38 AAssociateRQPDU();
39 std::istream &Read(std::istream &is);
40 const std::ostream &Write(std::ostream &os) const;
41 size_t Size() const;
42 void AddPresentationContext( PresentationContextRQ const &pc );
43
45 void SetCalledAETitle(const char calledaetitle[16]);
46 std::string GetCalledAETitle() const { return std::string(CalledAETitle,16); }
47
49 void SetCallingAETitle(const char callingaetitle[16]);
50 std::string GetCallingAETitle() const { return std::string(CallingAETitle,16); }
51
53 static bool IsAETitleValid(const char title[16]);
54
57 //void InitFromRQ( AAssociateACPDU & acpdu );
58
59 void Print(std::ostream &os) const;
60
61 AAssociateRQPDU(const AAssociateRQPDU &pdu):BasePDU(pdu)
62 {
63 assert( 0 );
64 }
65 //this function fails to compile on windows.
66 // AAssociateRQPDU &operator=(const AAssociateRQPDU &_val)
67 // {
68 // assert( 0 );
69 // }
70
71 typedef std::vector<PresentationContextRQ>::size_type SizeType;
72 SizeType GetNumberOfPresentationContext() const {
73 return PresContext.size();
74 }
75 PresentationContextRQ const &GetPresentationContext(SizeType i) const {
76 assert( !PresContext.empty() && i < PresContext.size() );
77 return PresContext[i];
78 }
79 typedef std::vector<PresentationContextRQ> PresentationContextArrayType;
80 PresentationContextArrayType const &GetPresentationContexts() { return PresContext; }
81
82 const PresentationContextRQ *GetPresentationContextByID(uint8_t i) const;
83 const PresentationContextRQ *GetPresentationContextByAbstractSyntax(AbstractSyntax const & as ) const;
84 bool IsLastFragment() const { return true; }
85
86 private:
87 // 1 PDU-type 01H
88 static const uint8_t ItemType; // PDUType ?
89 // 2 Reserved This reserved field shall be sent with a value 00H but not tested to this value when received.
90 static const uint8_t Reserved2;
91 /* 3-6 PDU-length This PDU-length shall be the number of bytes from the first byte of the
92 following field to the last byte of the variable field. It shall be encoded as
93 an unsigned binary number
94 */
95 uint32_t ItemLength; // PDU Length
96 /*
97 7-8 Protocol-version This two byte field shall use one bit to identify each version of the
98 DICOM UL protocol supported by the calling end-system. This is
99 Version 1 and shall be identified with bit 0 set. A receiver of this PDU
100 implementing only this version of the DICOM UL protocol shall only test
101 that bit 0 is set.
102 */
103 static const uint16_t ProtocolVersion;
104 /*
105 9-10 Reserved This reserved field shall be sent with a value 0000H but not tested to
106 this value when received.
107 */
108 static const uint16_t Reserved9_10;
109 /*
110 11-26 Called-AE-title Destination DICOM Application Name. It shall be encoded as 16
111 characters as defined by the ISO 646:1990-Basic G0 Set with leading
112 and trailing spaces (20H) being non-significant. The value made of 16
113 spaces (20H) meaning "no Application Name specified" shall not be
114 used. For a complete description of the use of this field, see Section
115 7.1.1.4.
116 */
117 char CalledAETitle[16];
118 /*
119 27-42 Calling-AE-title Source DICOM Application Name. It shall be encoded as 16
120 characters as defined by the ISO 646:1990-Basic G0 Set with leading
121 and trailing spaces (20H) being non-significant. The value made of 16
122 spaces (20H) meaning "no Application Name specified" shall not be
123 used. For a complete description of the use of this field, see Section
124 7.1.1.3.
125 */
126 char CallingAETitle[16];
127 /*
128 43-74 Reserved This reserved field shall be sent with a value 00H for all bytes but not
129 tested to this value when received
130 */
131 static const uint8_t Reserved43_74[32]; // { 0 }
132 /*
133 75-xxx Variable items This variable field shall contain the following items: one Application
134 Context Item, one or more Presentation Context Items and one User
135 Information Item. For a complete description of the use of these items
136 see Sections 7.1.1.2, 7.1.1.13, and 7.1.1.6.
137 */
138 ApplicationContext AppContext;
139 std::vector<PresentationContextRQ> PresContext;
140 UserInformation UserInfo;
141 };
142
143 } // end namespace network
144 } // end namespace gdcm
145
146 #endif //GDCMAASSOCIATERQPDU_H