GDCM 2.2.0

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

- File List
- File Members

gdcmULConnection.h
Go to the documentation of this file.

    00001 /*=========================================================================
    00002  *
    00003  *  Copyright Insight Software Consortium
    00004  *
    00005  *  Licensed under the Apache License, Version 2.0 (the "License");
    00006  *  you may not use this file except in compliance with the License.
    00007  *  You may obtain a copy of the License at
    00008  *
    00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
    00010  *
    00011  *  Unless required by applicable law or agreed to in writing, software
    00012  *  distributed under the License is distributed on an "AS IS" BASIS,
    00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00014  *  See the License for the specific language governing permissions and
    00015  *  limitations under the License.
    00016  *
    00017  *=========================================================================*/
    00018 #ifndef GDCMULCONNECTION_H
    00019 #define GDCMULCONNECTION_H
    00020
    00021 #include "gdcmNetworkStateID.h"
    00022 #include "gdcmARTIMTimer.h"
    00023 #include "gdcmULConnectionInfo.h"
    00024 #include "gdcmPresentationContextRQ.h"
    00025 #include "gdcmDataElement.h"
    00026 #include "gdcmPresentationContextAC.h"
    00027 #include "gdcmPresentationContext.h"
    00028
    00029 #include "gdcmScanner.h" // FIXME
    00030
    00031 class iosockinet;
    00032 class echo;
    00033 namespace gdcm{
    00034   namespace network{
    00035
    00059 class ULConnection
    00060 {
    00061       ULConnectionInfo mInfo;
    00062       //this is a dirty dirty hack
    00063       //but to establish an outgoing connection (scu), we need the echo service
    00064       //to establish incoming, we just need a port and localhost, so an iosockinet works while an
    00065       //echo would fail (probably because one already exists)
    00066       echo* mEcho;
    00067       iosockinet* mSocket;//of the three protocols offered by socket++-- echo, smtp, and ftp--
    00068       //echo most closely matches what the DICOM standard describes as a network connection
    00069       ARTIMTimer mTimer;
    00070
    00071       ULConnection(ULConnection& inConnection); //no copy construction allowed
    00072
    00073       EStateID mCurrentState;
    00074
    00075       std::vector<PresentationContextRQ> mPresentationContexts;
    00076       //this is our list of presentation contexts of what we can send
    00077       uint32_t mMaxPDUSize;
    00078
    00079       std::vector<PresentationContextAC> mAcceptedPresentationContexts;//these come back from the server
    00080       //and tell us what can be sent over this connection
    00081
    00082     public:
    00083
    00084       ULConnection(const ULConnectionInfo& inUserInformation);
    00085       //destructors are virtual to prevent memory leaks by inherited classes
    00086       virtual ~ULConnection();
    00087
    00088       EStateID GetState() const;
    00089       void SetState(const EStateID& inState);//must be able to update state...
    00090
    00091       //echo* GetProtocol();
    00092       std::iostream* GetProtocol();
    00093       void StopProtocol();
    00094
    00095       ARTIMTimer& GetTimer();
    00096
    00097       const ULConnectionInfo &GetConnectionInfo() const;
    00098
    00099       //when the connection is first associated, the connection is told
    00100       //the max packet/PDU size and the way in which to present data
    00101       //(presentation contexts, etc). Store that here.
    00102       void SetMaxPDUSize(uint32_t inSize);
    00103       uint32_t GetMaxPDUSize() const;
    00104
    00105       const PresentationContextAC *GetPresentationContextACByID(uint8_t id) const;
    00106       const PresentationContextRQ *GetPresentationContextRQByID(uint8_t id) const;
    00107
    00109       uint8_t GetPresentationContextIDFromPresentationContext(PresentationContextRQ const & pc) const;
    00110
    00111       std::vector<PresentationContextRQ> const & GetPresentationContexts() const;
    00112       void SetPresentationContexts(const std::vector<PresentationContextRQ>& inContexts);
    00113
    00114       void SetPresentationContexts(const std::vector<PresentationContext>& inContexts);
    00115
    00116       //given a particular data element, presumably the SOP class,
    00117       //find the presentation context for that SOP
    00118       //NOT YET IMPLEMENTED
    00119       PresentationContextRQ FindContext(const DataElement& de) const;
    00120
    00121       std::vector<PresentationContextAC> const & GetAcceptedPresentationContexts() const;
    00122       std::vector<PresentationContextAC> & GetAcceptedPresentationContexts();
    00123       void AddAcceptedPresentationContext(const PresentationContextAC& inPC);
    00124
    00126       bool InitializeConnection();
    00127
    00129       bool InitializeIncomingConnection();
    00130     };
    00131   }
    00132 }
    00133
    00134 #endif // ULCONNECTION_H