GDCM  2.4.5
gdcmULConnectionManager.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef GDCMULCONNECTIONMANAGER_H
19 #define GDCMULCONNECTIONMANAGER_H
20 
21 #include "gdcmULTransitionTable.h"
22 #include "gdcmULConnection.h"
23 #include "gdcmULConnectionInfo.h"
26 #include "gdcmSubject.h"
28 
29 namespace gdcm {
30  class File;
31  class BaseRootQuery;
32 
33  namespace network {
34 
45  {
46  private:
47  ULConnection* mConnection;
48  ULConnection* mSecondaryConnection;
49  ULTransitionTable mTransitions;
50 
51  //no copying
53 
54  //event handler loop.
55  //will just keep running until the current event is nonexistent.
56  //at which point, it will return the current state of the connection
57  //this starts by initiating an action, but can be put into a passive mode
58  //for a cmove/cstore combination by setting startWaiting to true
59  EStateID RunEventLoop(ULEvent& inEvent, ULConnection* inWhichConnection,
60  ULConnectionCallback* inCallback, const bool& startWaiting);
61 
62  //like the above, but will manage the event loop for a move event (which
63  //is basically two simultaneous connections interwoven, one inbound and
64  //the other outbound. Note, for instance, that cmoversp's can be sent back
65  //during the other connection's operation.
66  EStateID RunMoveEventLoop(ULEvent& inEvent, ULConnectionCallback* inCallback);
67 
68  public:
71 
72  // NOTE: (MM) The following two functions are difficults to use, therefore marking
73  // them as internal for now.
74 
75  // \internal
83  bool EstablishConnection(const std::string& inAETitle,
84  const std::string& inConnectAETitle,
85  const std::string& inComputerName, long inIPAddress,
86  uint16_t inConnectPort, double inTimeout,
87  std::vector<PresentationContext> const & pcVector );
88 
91  bool EstablishConnectionMove(const std::string& inAETitle,
92  const std::string& inConnectAETitle,
93  const std::string& inComputerName, long inIPAddress,
94  uint16_t inConnectPort, double inTimeout,
95  uint16_t inReturnPort,
96  std::vector<PresentationContext> const & pcVector);
97  // \endinternal
98 
99 
100  //bool ReestablishConnection(const EConnectionType& inConnectionType,
101  // const DataSet& inDS);
102 
103  //allows for a connection to be broken, but waits for an acknowledgement
104  //of the breaking for a certain amount of time. Returns true of the
105  //other side acknowledges the break
106  bool BreakConnection(const double& inTimeout);
107 
108  //severs the connection, if it's open, without waiting for any kind of response.
109  //typically done if the program is going down.
110  void BreakConnectionNow();
111 
112  //This function will send a given piece of data
113  //across the network connection. It will return true if the
114  //sending worked, false otherwise.
115  //note that sending is asynchronous; as such, there's
116  //also a 'receive' option, but that requires a callback function.
117  //bool SendData();
118 
119  //send the Data PDU associated with Echo (ie, a default DataPDU)
120  //this lets the user confirm that the connection is alive.
121  //the user should look to cout to see the response of the echo command
122  //returns the PresentationDataValue that was returned by the remote
123  //host. Note that the PDV can be uninitialized, which would indicate failure.
124  //Echo does not use a callback for results.
125  std::vector<PresentationDataValue> SendEcho();
126 
127  // \internal
128  // API will change...
129  std::vector<DataSet> SendStore(const File &file);
130  std::vector<DataSet> SendFind(const BaseRootQuery* inRootQuery);
131  std::vector<DataSet> SendMove(const BaseRootQuery* inRootQuery);
132  // \endinternal
133 
135  void SendStore(const File & file, ULConnectionCallback* inCallback);
136  void SendFind(const BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback);
138  bool SendMove(const BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback);
139 
140  };
141  }
142 }
143 
144 #endif // GDCMULCONNECTIONMANAGER_H
BaseRootQuery contains: a baseclass which will produce a dataset for c-find and c-move with patient/s...
Definition: gdcmBaseRootQuery.h:65
ULConnection This is the class that contains the socket to another machine, and passes data through i...
Definition: gdcmULConnection.h:57
ULConnectionManager The ULConnectionManager performs actions on the ULConnection given inputs from th...
Definition: gdcmULConnectionManager.h:44
EStateID
Definition: gdcmNetworkStateID.h:32
Definition: gdcmULConnectionCallback.h:39
#define GDCM_EXPORT
Definition: gdcmWin32.h:34
Subject.
Definition: gdcmSubject.h:28
ULEvent base class for network events.
Definition: gdcmULEvent.h:37
a DICOM File See PS 3.10 File: A File is an ordered string of zero or more bytes, where the first byt...
Definition: gdcmFile.h:33
ULTransitionTable The transition table of all the ULEvents, new ULActions, and ULStates.
Definition: gdcmULTransitionTable.h:98
Definition: gdcmASN1.h:20

Generated on Fri Sep 25 2015 17:58:24 for GDCM by doxygen 1.8.9.1
SourceForge.net Logo