dcmtkpp
Network.h
1 /*************************************************************************
2  * dcmtkpp - Copyright (C) Universite de Strasbourg
3  * Distributed under the terms of the CeCILL-B license, as published by
4  * the CEA-CNRS-INRIA. Refer to the LICENSE file or to
5  * http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
6  * for details.
7  ************************************************************************/
8 
9 #ifndef _fad49120_3f5c_447d_b0e9_72719087640c
10 #define _fad49120_3f5c_447d_b0e9_72719087640c
11 
12 #include <dcmtk/config/osconfig.h>
13 #include <dcmtk/dcmnet/assoc.h>
14 
15 namespace dcmtkpp
16 {
17 
23 class Network
24 {
25 public:
27  Network();
28 
30  Network(T_ASC_NetworkRole role, int port, int timeout, unsigned long options=0);
31 
33  Network(Network const & other);
34 
36  ~Network();
37 
39  Network & operator=(Network const & other);
40 
42  T_ASC_NetworkRole get_role() const;
43 
45  void set_role(T_ASC_NetworkRole role);
46 
48  int get_port() const;
49 
51  void set_port(int port);
52 
54  int get_timeout() const;
55 
57  void set_timeout(int timeout);
58 
60  unsigned long get_options() const;
61 
63  void set_options(unsigned long options);
64 
66  void initialize();
67 
69  T_ASC_Network * get_network();
70 
72  bool is_association_waiting(int const timeout);
73 
75  void drop();
76 
78  bool is_initialized() const;
79 
80 private:
81  T_ASC_NetworkRole _role;
82  int _port;
83  int _timeout;
84  unsigned long _options;
85 
86  T_ASC_Network * _network;
87 };
88 
89 }
90 
91 #endif // _fad49120_3f5c_447d_b0e9_72719087640c
Wrapper around the T_ASC_Network class.
Definition: Network.h:23
Definition: Association.cpp:22
T_ASC_NetworkRole get_role() const
Return the role of the network, defaults to NET_REQUESTOR.
Definition: Network.cpp:68
Network()
Create a default, un-initialized, network.
Definition: Network.cpp:21
bool is_initialized() const
Test whether the network is initialized.
Definition: Network.cpp:196
void initialize()
Initialize the network.
Definition: Network.cpp:144
void drop()
Drop (i.e. un-initialize) the network.
Definition: Network.cpp:177
void set_timeout(int timeout)
Set the timeout in seconds.
Definition: Network.cpp:113
bool is_association_waiting(int const timeout)
Test whether an association request is waiting.
Definition: Network.cpp:170
void set_options(unsigned long options)
the set options.
Definition: Network.cpp:132
Network & operator=(Network const &other)
Assing an un-initialized network; it remains un-initialized.
Definition: Network.cpp:53
unsigned long get_options() const
Return the options, defaults to 0.
Definition: Network.cpp:125
~Network()
Destroy the network, dropping it if necessary.
Definition: Network.cpp:43
void set_role(T_ASC_NetworkRole role)
Set the role of the network.
Definition: Network.cpp:75
int get_timeout() const
Return the timeout in seconds, defaults to 30.
Definition: Network.cpp:106
T_ASC_Network * get_network()
Return the underlying DCMTK object.
Definition: Network.cpp:163
int get_port() const
Return the port for acceptor role, defaults to 0.
Definition: Network.cpp:87
void set_port(int port)
Set the port for acceptor role.
Definition: Network.cpp:94