odil
C++11libraryfortheDICOMstandard
EchoSCP.h
1 /*************************************************************************
2  * odil - 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 _1a61d976_ba12_4dba_af34_67f064d38506
10 #define _1a61d976_ba12_4dba_af34_67f064d38506
11 
12 #include <functional>
13 
14 #include "odil/Association.h"
15 #include "odil/SCP.h"
16 #include "odil/Value.h"
17 #include "odil/message/CEchoRequest.h"
18 #include "odil/message/Message.h"
19 
20 namespace odil
21 {
22 
24 class EchoSCP: public SCP
25 {
26 public:
31  typedef std::function<Value::Integer(message::CEchoRequest const &)> Callback;
32 
34  EchoSCP(Association & association);
35 
37  EchoSCP(Association & association, Callback const & callback);
38 
40  virtual ~EchoSCP();
41 
43  Callback const & get_callback() const;
44 
46  void set_callback(Callback const & callback);
47 
49  virtual void operator()(message::Message const & message);
50 
51 private:
52  Callback _callback;
53 };
54 
55 }
56 
57 #endif // _1a61d976_ba12_4dba_af34_67f064d38506
std::function< Value::Integer(message::CEchoRequest const &)> Callback
Callback called when a request is received, shall throw an SCP::Exception on error.
Definition: EchoSCP.h:31
EchoSCP(Association &association)
Constructor.
Definition: EchoSCP.cpp:24
SCP for C-Echo services.
Definition: EchoSCP.h:24
Definition: Association.cpp:39
Base class for all Service Class Providers.
Definition: SCP.h:23
void set_callback(Callback const &callback)
Set the callback.
Definition: EchoSCP.cpp:51
virtual void operator()(message::Message const &message)
Process a C-Echo request.
Definition: EchoSCP.cpp:58
virtual ~EchoSCP()
Destructor.
Definition: EchoSCP.cpp:38
Association.
Definition: Association.h:29
Callback const & get_callback() const
Return the callback.
Definition: EchoSCP.cpp:44