QueueingAlgorithm.cti
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
14 /** \file
15  \brief QueueingAlgorithm inline template implementation */
16 
17 // Custom includes
18 
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
21 
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
23 // senf::ppi::QueueingAlgorithmRegistry::RegistrationProxy<QAlgorithm>
24 
25 template <class QAlgorithm>
26 prefix_ senf::ppi::QueueingAlgorithmRegistry::RegistrationProxy<QAlgorithm>::RegistrationProxy(std::string const & key)
27 {
28  QueueingAlgorithmRegistry::instance().registerQAlgorithm<QAlgorithm>( key);
29 };
30 
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32 // senf::ppi::QueueingAlgorithmRegistry
33 
34 template <class QAlgorithm>
35 prefix_ void senf::ppi::QueueingAlgorithmRegistry::registerQAlgorithm(std::string key)
36 {
37  if (qAlgoMap_.find( key) == qAlgoMap_.end() )
38  qAlgoMap_.insert(key, new detail::QueueingAlgorithmRegistry_Entry<QAlgorithm>() );
39  else
40  throw Exception("Duplicated QAlgorithm Registration ") << key;
41 }
42 
43 //-/////////////////////////////////////////////////////////////////////////////////////////////////
44 // senf::ppi::detail::QueueingAlgorithmRegistry_Entry<QAlgorithm>
45 
46 template <class QAlgorithm>
47 prefix_ senf::ppi::QueueingAlgorithm::ptr senf::ppi::detail::QueueingAlgorithmRegistry_Entry<QAlgorithm>::create()
48  const
49 {
50  return QAlgorithm::create();
51 }
52 
53 //-/////////////////////////////////////////////////////////////////////////////////////////////////
54 #undef prefix_
55 
56 
57 // Local Variables:
58 // mode: c++
59 // fill-column: 100
60 // comment-column: 40
61 // c-file-style: "senf"
62 // indent-tabs-mode: nil
63 // ispell-local-dictionary: "american"
64 // compile-command: "scons -u test"
65 // End: