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
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
15 \brief EventManager inline non-template implementation */
17 //#include "EventManager.ih"
21 #define prefix_ inline
22 //-/////////////////////////////////////////////////////////////////////////////////////////////////
24 //-/////////////////////////////////////////////////////////////////////////////////////////////////
25 // senf::scheduler::detail::Event
27 prefix_ senf::scheduler::detail::Event::Event(std::string const & name)
28 : name_ (name), runCount_ (0u)
30 if (EventManager::alive())
31 EventManager::instance().add(*this);
34 prefix_ senf::scheduler::detail::Event::~Event()
36 if (EventManager::alive())
37 EventManager::instance().remove(*this);
40 prefix_ void senf::scheduler::detail::EventManager::add(Event & event)
42 events_.push_back(event);
45 prefix_ void senf::scheduler::detail::EventManager::remove(Event & event)
47 events_.erase(EventList::s_iterator_to(event));
50 prefix_ std::string const & senf::scheduler::detail::Event::name()
56 prefix_ bool senf::scheduler::detail::Event::enabled()
62 prefix_ unsigned senf::scheduler::detail::Event::runCount()
68 prefix_ char const * senf::scheduler::detail::Event::type()
74 prefix_ std::string senf::scheduler::detail::Event::info()
80 prefix_ void senf::scheduler::detail::Event::countRun()
85 //-/////////////////////////////////////////////////////////////////////////////////////////////////
86 // senf::scheduler::detail::EventManager
88 prefix_ bool senf::scheduler::detail::EventManager::IteratorFilter::operator()(Event const & e)
90 return e.type() != nullptr;
93 prefix_ senf::scheduler::detail::EventManager::iterator
94 senf::scheduler::detail::EventManager::begin()
97 // We need to filter out elements with e.type() == 0 ... the NullTask temporarily added
98 // by the FIFORunner is such an element and must be skipped.
99 return boost::make_filter_iterator(
100 IteratorFilter(), events_.begin(), events_.end());
103 prefix_ senf::scheduler::detail::EventManager::iterator
104 senf::scheduler::detail::EventManager::end()
107 return boost::make_filter_iterator(
108 IteratorFilter(), events_.end(), events_.end());
111 //-/////////////////////////////////////////////////////////////////////////////////////////////////
118 // comment-column: 40
119 // c-file-style: "senf"
120 // indent-tabs-mode: nil
121 // ispell-local-dictionary: "american"
122 // compile-command: "scons -u test"