odil
C++11libraryfortheDICOMstandard
SCPDispatcher.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 _f0b69ac6_7d52_401d_a2f3_d5d3f7d69376
10 #define _f0b69ac6_7d52_401d_a2f3_d5d3f7d69376
11 
12 #include <map>
13 #include <memory>
14 
15 #include "odil/Association.h"
16 #include "odil/SCP.h"
17 #include "odil/Value.h"
18 
19 namespace odil
20 {
21 
24 {
25 public:
27  SCPDispatcher(Association & association);
28 
31 
33  bool has_scp(Value::Integer command) const;
34 
36  std::shared_ptr<SCP> const & get_scp(Value::Integer command) const;
37 
39  void set_scp(Value::Integer command, std::shared_ptr<SCP> const & scp);
40 
42  void dispatch();
43 private:
44  typedef std::shared_ptr<SCP> SCPPointer;
45 
46  Association & _association;
47  std::map<Value::Integer, std::shared_ptr<SCP>> _providers;
48 };
49 
50 }
51 
52 #endif // _f0b69ac6_7d52_401d_a2f3_d5d3f7d69376
~SCPDispatcher()
Destructor.
Definition: SCPDispatcher.cpp:30
void set_scp(Value::Integer command, std::shared_ptr< SCP > const &scp)
Registered an SCP with command.
Definition: SCPDispatcher.cpp:57
SCPDispatcher(Association &association)
Create a dispatcher with network and association.
Definition: SCPDispatcher.cpp:23
Definition: Association.cpp:39
std::shared_ptr< SCP > const & get_scp(Value::Integer command) const
Return the SCP registered with command.
Definition: SCPDispatcher.cpp:45
bool has_scp(Value::Integer command) const
Test whether command has an SCP registered.
Definition: SCPDispatcher.cpp:37
Dispatch an incoming message to one of the registered SCPs.
Definition: SCPDispatcher.h:23
Association.
Definition: Association.h:29
int64_t Integer
Integer type.
Definition: Value.h:40
void dispatch()
Receive and dispatch an incoming message.
Definition: SCPDispatcher.cpp:64