GDCM 2.2.0

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

- File List
- File Members

gdcmAAssociateRQPDU.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004
    00005   Copyright (c) 2006-2011 Mathieu Malaterre
    00006   All rights reserved.
    00007   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00008
    00009      This software is distributed WITHOUT ANY WARRANTY; without even
    00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00011      PURPOSE.  See the above copyright notice for more information.
    00012
    00013 =========================================================================*/
    00014 #ifndef GDCMAASSOCIATERQPDU_H
    00015 #define GDCMAASSOCIATERQPDU_H
    00016
    00017 #include "gdcmTypes.h"
    00018 #include "gdcmVR.h" // AEComp
    00019 #include "gdcmApplicationContext.h"
    00020 #include "gdcmPresentationContextRQ.h"
    00021 #include "gdcmUserInformation.h"
    00022 #include "gdcmBasePDU.h"
    00023
    00024 namespace gdcm
    00025 {
    00026
    00027 namespace network
    00028 {
    00029
    00030 class AAssociateACPDU;
    00035 class AAssociateRQPDU : public BasePDU
    00036 {
    00037 public:
    00038   AAssociateRQPDU();
    00039   std::istream &Read(std::istream &is);
    00040   const std::ostream &Write(std::ostream &os) const;
    00041   size_t Size() const;
    00042   void AddPresentationContext( PresentationContextRQ const &pc );
    00043
    00045   void SetCalledAETitle(const char calledaetitle[16]);
    00046   std::string GetCalledAETitle() const { return std::string(CalledAETitle,16); }
    00047
    00049   void SetCallingAETitle(const char callingaetitle[16]);
    00050   std::string GetCallingAETitle() const { return std::string(CallingAETitle,16); }
    00051
    00053   static bool IsAETitleValid(const char title[16]);
    00054
    00057   //void InitFromRQ( AAssociateACPDU & acpdu );
    00058
    00059   void Print(std::ostream &os) const;
    00060
    00061   AAssociateRQPDU(const AAssociateRQPDU &)
    00062     {
    00063     assert( 0 );
    00064     }
    00065   //this function fails to compile on windows.
    00066 //  AAssociateRQPDU &operator=(const AAssociateRQPDU &_val)
    00067 //    {
    00068 //    assert( 0 );
    00069 //    }
    00070
    00071   typedef std::vector<PresentationContextRQ>::size_type SizeType;
    00072   SizeType GetNumberOfPresentationContext() const {
    00073     return PresContext.size();
    00074   }
    00075   PresentationContextRQ const &GetPresentationContext(SizeType i) const {
    00076     assert( !PresContext.empty() && i < PresContext.size() );
    00077     return PresContext[i];
    00078   }
    00079   typedef std::vector<PresentationContextRQ> PresentationContextArrayType;
    00080   PresentationContextArrayType const &GetPresentationContexts() { return PresContext; }
    00081
    00082   const PresentationContextRQ *GetPresentationContextByID(uint8_t i) const;
    00083   const PresentationContextRQ *GetPresentationContextByAbstractSyntax(AbstractSyntax const & as ) const;
    00084   bool IsLastFragment() const { return true; }
    00085
    00086 private:
    00087   // 1 PDU-type 01H
    00088   static const uint8_t ItemType; // PDUType ?
    00089   // 2 Reserved This reserved field shall be sent with a value 00H but not tested to this value when received.
    00090   static const uint8_t Reserved2;
    00091   /* 3-6 PDU-length This PDU-length shall be the number of bytes from the first byte of the
    00092      following field to the last byte of the variable field. It shall be encoded as
    00093      an unsigned binary number
    00094    */
    00095   uint32_t ItemLength; // PDU Length
    00096   /*
    00097   7-8 Protocol-version This two byte field shall use one bit to identify each version of the
    00098   DICOM UL protocol supported by the calling end-system. This is
    00099   Version 1 and shall be identified with bit 0 set. A receiver of this PDU
    00100   implementing only this version of the DICOM UL protocol shall only test
    00101   that bit 0 is set.
    00102    */
    00103   static const uint16_t ProtocolVersion;
    00104   /*
    00105   9-10 Reserved This reserved field shall be sent with a value 0000H but not tested to
    00106   this value when received.
    00107    */
    00108   static const uint16_t Reserved9_10;
    00109   /*
    00110   11-26 Called-AE-title Destination DICOM Application Name. It shall be encoded as 16
    00111   characters as defined by the ISO 646:1990-Basic G0 Set with leading
    00112   and trailing spaces (20H) being non-significant. The value made of 16
    00113   spaces (20H) meaning "no Application Name specified" shall not be
    00114   used. For a complete description of the use of this field, see Section
    00115   7.1.1.4.
    00116    */
    00117   char CalledAETitle[16];
    00118   /*
    00119   27-42 Calling-AE-title Source DICOM Application Name. It shall be encoded as 16
    00120   characters as defined by the ISO 646:1990-Basic G0 Set with leading
    00121   and trailing spaces (20H) being non-significant. The value made of 16
    00122   spaces (20H) meaning "no Application Name specified" shall not be
    00123   used. For a complete description of the use of this field, see Section
    00124   7.1.1.3.
    00125    */
    00126   char CallingAETitle[16];
    00127   /*
    00128   43-74 Reserved This reserved field shall be sent with a value 00H for all bytes but not
    00129   tested to this value when received
    00130    */
    00131   static const uint8_t Reserved43_74[32]; // { 0 }
    00132   /*
    00133   75-xxx Variable items This variable field shall contain the following items: one Application
    00134   Context Item, one or more Presentation Context Items and one User
    00135   Information Item. For a complete description of the use of these items
    00136   see Sections 7.1.1.2, 7.1.1.13, and 7.1.1.6.
    00137    */
    00138   ApplicationContext AppContext;
    00139   std::vector<PresentationContextRQ> PresContext;
    00140   UserInformation UserInfo;
    00141 };
    00142
    00143 } // end namespace network
    00144 } // end namespace gdcm
    00145
    00146 #endif //GDCMAASSOCIATERQPDU_H