gdcmULConnectionManager.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright NumFOCUS
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef GDCMULCONNECTIONMANAGER_H
#define GDCMULCONNECTIONMANAGER_H
#include "gdcmULTransitionTable.h"
#include "gdcmULConnection.h"
#include "gdcmULConnectionInfo.h"
#include "gdcmPresentationDataValue.h"
#include "gdcmULConnectionCallback.h"
#include "gdcmSubject.h"
#include "gdcmPresentationContext.h"
namespace gdcm {
class File;
class BaseRootQuery;
class BaseQuery;
namespace network {
class GDCM_EXPORT ULConnectionManager : public Subject
{
protected:
ULConnection* mConnection;
ULConnection* mSecondaryConnection;
ULTransitionTable mTransitions;
//no copying
ULConnectionManager(const ULConnectionManager& inCM);
//event handler loop.
//will just keep running until the current event is nonexistent.
//at which point, it will return the current state of the connection
//this starts by initiating an action, but can be put into a passive mode
//for a cmove/cstore combination by setting startWaiting to true
EStateID RunEventLoop(ULEvent& inEvent, ULConnection* inWhichConnection,
ULConnectionCallback* inCallback, const bool& startWaiting);
//like the above, but will manage the event loop for a move event (which
//is basically two simultaneous connections interwoven, one inbound and
//the other outbound. Note, for instance, that cmoversp's can be sent back
//during the other connection's operation.
EStateID RunMoveEventLoop(ULEvent& inEvent, ULConnectionCallback* inCallback);
public:
ULConnectionManager();
~ULConnectionManager() override;
// NOTE: (MM) The following two functions are difficult to use, therefore marking
// them as internal for now.
// \internal
bool EstablishConnection(const std::string& inAETitle,
const std::string& inConnectAETitle,
const std::string& inComputerName, long inIPAddress,
uint16_t inConnectPort, double inTimeout,
std::vector<PresentationContext> const & pcVector );
bool EstablishConnectionMove(const std::string& inAETitle,
const std::string& inConnectAETitle,
const std::string& inComputerName, long inIPAddress,
uint16_t inConnectPort, double inTimeout,
uint16_t inReturnPort,
std::vector<PresentationContext> const & pcVector);
// \endinternal
//bool ReestablishConnection(const EConnectionType& inConnectionType,
// const DataSet& inDS);
//allows for a connection to be broken, but waits for an acknowledgement
//of the breaking for a certain amount of time. Returns true of the
//other side acknowledges the break
bool BreakConnection(const double& inTimeout);
//severs the connection, if it's open, without waiting for any kind of response.
//typically done if the program is going down.
void BreakConnectionNow();
//This function will send a given piece of data
//across the network connection. It will return true if the
//sending worked, false otherwise.
//note that sending is asynchronous; as such, there's
//also a 'receive' option, but that requires a callback function.
//bool SendData();
//send the Data PDU associated with Echo (ie, a default DataPDU)
//this lets the user confirm that the connection is alive.
//the user should look to cout to see the response of the echo command
//returns the PresentationDataValue that was returned by the remote
//host. Note that the PDV can be uninitialized, which would indicate failure.
//Echo does not use a callback for results.
std::vector<PresentationDataValue> SendEcho();
// \internal
// API will change...
std::vector<DataSet> SendStore(const File &file, std::istream * pStream = nullptr, std::streampos dataSetOffset = 0 );
std::vector<DataSet> SendFind(const BaseRootQuery* inRootQuery);
std::vector<DataSet> SendMove(const BaseRootQuery* inRootQuery);
std::vector<DataSet> SendNEventReport (const BaseQuery* inQuery);
std::vector<DataSet> SendNGet (const BaseQuery* inQuery);
std::vector<DataSet> SendNSet (const BaseQuery* inQuery);
std::vector<DataSet> SendNAction (const BaseQuery* inQuery);
std::vector<DataSet> SendNCreate (const BaseQuery* inQuery);
std::vector<DataSet> SendNDelete (const BaseQuery* inQuery);
// \endinternal
void SendStore(const File & file, ULConnectionCallback* inCallback, std::istream * pStream = nullptr , std::streampos dataSetOffset = 0 );
void SendFind(const BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback);
bool SendMove(const BaseRootQuery* inRootQuery, ULConnectionCallback* inCallback);
void SendNEventReport (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
void SendNGet (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
void SendNSet (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
void SendNAction (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
void SendNCreate (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
void SendNDelete (const BaseQuery* inQuery, ULConnectionCallback* inCallback);
};
}
}
#endif // GDCMULCONNECTIONMANAGER_H
gdcm::BaseQuery
BaseQuery.
Definition gdcmBaseQuery.h:42
gdcm::BaseRootQuery
BaseRootQuery.
Definition gdcmBaseRootQuery.h:67
gdcm::File
a DICOM File
Definition gdcmFile.h:34
gdcm::Subject::Subject
Subject()
gdcm::network::ULConnectionCallback
Definition gdcmULConnectionCallback.h:39
gdcm::network::ULConnectionManager::RunMoveEventLoop
EStateID RunMoveEventLoop(ULEvent &inEvent, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::ULConnectionManager
ULConnectionManager()
gdcm::network::ULConnectionManager::SendNSet
std::vector< DataSet > SendNSet(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::EstablishConnection
bool EstablishConnection(const std::string &inAETitle, const std::string &inConnectAETitle, const std::string &inComputerName, long inIPAddress, uint16_t inConnectPort, double inTimeout, std::vector< PresentationContext > const &pcVector)
gdcm::network::ULConnectionManager::mSecondaryConnection
ULConnection * mSecondaryConnection
Definition gdcmULConnectionManager.h:49
gdcm::network::ULConnectionManager::SendEcho
std::vector< PresentationDataValue > SendEcho()
gdcm::network::ULConnectionManager::SendFind
void SendFind(const BaseRootQuery *inRootQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::BreakConnectionNow
void BreakConnectionNow()
gdcm::network::ULConnectionManager::SendNSet
void SendNSet(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::SendNEventReport
std::vector< DataSet > SendNEventReport(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::~ULConnectionManager
~ULConnectionManager() override
gdcm::network::ULConnectionManager::BreakConnection
bool BreakConnection(const double &inTimeout)
gdcm::network::ULConnectionManager::SendNCreate
std::vector< DataSet > SendNCreate(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::SendNDelete
void SendNDelete(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::SendNCreate
void SendNCreate(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::EstablishConnectionMove
bool EstablishConnectionMove(const std::string &inAETitle, const std::string &inConnectAETitle, const std::string &inComputerName, long inIPAddress, uint16_t inConnectPort, double inTimeout, uint16_t inReturnPort, std::vector< PresentationContext > const &pcVector)
gdcm::network::ULConnectionManager::mConnection
ULConnection * mConnection
Definition gdcmULConnectionManager.h:48
gdcm::network::ULConnectionManager::ULConnectionManager
ULConnectionManager(const ULConnectionManager &inCM)
gdcm::network::ULConnectionManager::SendNGet
void SendNGet(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::SendMove
std::vector< DataSet > SendMove(const BaseRootQuery *inRootQuery)
gdcm::network::ULConnectionManager::SendNAction
void SendNAction(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::SendFind
std::vector< DataSet > SendFind(const BaseRootQuery *inRootQuery)
gdcm::network::ULConnectionManager::SendNAction
std::vector< DataSet > SendNAction(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::SendStore
void SendStore(const File &file, ULConnectionCallback *inCallback, std::istream *pStream=nullptr, std::streampos dataSetOffset=0)
callback based API
gdcm::network::ULConnectionManager::SendNGet
std::vector< DataSet > SendNGet(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::SendMove
bool SendMove(const BaseRootQuery *inRootQuery, ULConnectionCallback *inCallback)
return false upon error
gdcm::network::ULConnectionManager::SendNEventReport
void SendNEventReport(const BaseQuery *inQuery, ULConnectionCallback *inCallback)
gdcm::network::ULConnectionManager::RunEventLoop
EStateID RunEventLoop(ULEvent &inEvent, ULConnection *inWhichConnection, ULConnectionCallback *inCallback, const bool &startWaiting)
gdcm::network::ULConnectionManager::SendStore
std::vector< DataSet > SendStore(const File &file, std::istream *pStream=nullptr, std::streampos dataSetOffset=0)
gdcm::network::ULConnectionManager::SendNDelete
std::vector< DataSet > SendNDelete(const BaseQuery *inQuery)
gdcm::network::ULConnectionManager::mTransitions
ULTransitionTable mTransitions
Definition gdcmULConnectionManager.h:50
gdcm::network::ULConnection
ULConnection.
Definition gdcmULConnection.h:58
gdcm::network::ULEvent
ULEvent.
Definition gdcmULEvent.h:37
gdcm::network::ULTransitionTable
ULTransitionTable The transition table of all the ULEvents, new ULActions, and ULStates.
Definition gdcmULTransitionTable.h:99
gdcmPresentationContext.h
gdcmPresentationDataValue.h
gdcmSubject.h
gdcmULConnectionCallback.h
gdcmULConnectionInfo.h
gdcmULConnection.h
gdcmULTransitionTable.h
GDCM_EXPORT
#define GDCM_EXPORT
Definition gdcmWin32.h:34
gdcm::network
Definition gdcmAAbortPDU.h:24
gdcm::network::EStateID
EStateID
Definition gdcmNetworkStateID.h:32
gdcm
Definition gdcmASN1.h:21