File: gdcmServiceClassUser.h

package info (click to toggle)
gdcm 2.4.4-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 32,868 kB
  • sloc: cpp: 188,481; ansic: 124,526; xml: 41,799; sh: 7,162; python: 3,667; cs: 2,128; java: 1,344; lex: 1,290; tcl: 677; php: 128; makefile: 116
file content (124 lines) | stat: -rw-r--r-- 4,031 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
/*=========================================================================

  Program: GDCM (Grassroots DICOM). A DICOM library

  Copyright (c) 2006-2011 Mathieu Malaterre
  All rights reserved.
  See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef GDCMSERVICECLASSUSER_H
#define GDCMSERVICECLASSUSER_H

#include "gdcmSubject.h"

#include "gdcmPresentationContext.h"
#include "gdcmFile.h"

#include "gdcmNetworkStateID.h" // EStateID

namespace gdcm
{
class ServiceClassUserInternals;
class BaseRootQuery;
namespace network{
class ULEvent;
class ULConnection;
class ULConnectionCallback;
}
/**
 * \brief ServiceClassUser
 */
class GDCM_EXPORT ServiceClassUser : public Subject
{
public:
  /// Construct a SCU with default:
  /// - hostname = localhost
  /// - port = 104
  ServiceClassUser();
  ~ServiceClassUser();

  /// Set the name of the called hostname (hostname or IP address)
  void SetHostname( const char *hostname );

  /// Set port of remote host (called application)
  void SetPort( uint16_t port );

  /// Set the port for any incoming C-STORE-SCP operation (typically in a return of C-MOVE)
  void SetPortSCP( uint16_t portscp );

  /// set calling ae title
  void SetAETitle(const char *aetitle);
  const char *GetAETitle() const;

  /// set called ae title
  void SetCalledAETitle(const char *aetitle);
  const char *GetCalledAETitle() const;

  /// set/get Timeout
  void SetTimeout(double t);
  double GetTimeout() const;

  /// Will try to connect
  /// This will setup the actual timeout used during the whole connection time. Need to call
  /// SetTimeout first
  bool InitializeConnection();

  /// Set the Presentation Context used for the Association
  void SetPresentationContexts(std::vector<PresentationContext> const & pcs);

  /// Return if the passed in presentation was accepted during association negotiation.
  bool IsPresentationContextAccepted(const PresentationContext& pc) const;

  /// Start the association. Need to call SetPresentationContexts before
  bool StartAssociation();

  /// Stop the running association
  bool StopAssociation();

  /// C-ECHO
  bool SendEcho();

  /// Execute a C-STORE on file on disk, named filename
  bool SendStore(const char *filename);
  /// Execute a C-STORE on a File, the transfer syntax used for the query is based on the
  /// file.
  bool SendStore(File const &file);
  /// Execute a C-STORE on a DataSet, the transfer syntax used will be Implicit
  bool SendStore(DataSet const &ds);

  /// C-FIND a query, return result are in retDatasets
  bool SendFind(const BaseRootQuery* query, std::vector<DataSet> &retDatasets);

  /// Execute a C-MOVE, based on query, return files are written in outputdir
  bool SendMove(const BaseRootQuery* query, const char *outputdir);
  /// Execute a C-MOVE, based on query, returned dataset are Implicit
  bool SendMove(const BaseRootQuery* query, std::vector<DataSet> &retDatasets);
  /// Execute a C-MOVE, based on query, returned Files are stored in vector
  bool SendMove(const BaseRootQuery* query, std::vector<File> &retFile);

  /// for wrapped language: instanciate a reference counted object
  static SmartPointer<ServiceClassUser> New() { return new ServiceClassUser; }

private:
  network::EStateID RunEventLoop(network::ULEvent& inEvent,
    network::ULConnection* inWhichConnection,
    network::ULConnectionCallback* inCallback, const bool& startWaiting);
  network::EStateID RunMoveEventLoop(network::ULEvent& inEvent,
    network::ULConnectionCallback* inCallback);

private:
  ServiceClassUser(const ServiceClassUser&);
  void operator=(const ServiceClassUser &);

private:
  ServiceClassUserInternals *Internals;
};

} // end namespace gdcm

#endif // GDCMSERVICECLASSUSER_H