Fawkes API Fawkes Development Version
execution_time_estimator_inifin.cpp
1/***************************************************************************
2 * execution_time_estimator_aspect_inifin.cpp - Aspect IniFin
3 *
4 * Created: Thu 12 Dec 2019 19:59:57 CET 19:59
5 * Copyright 2019 Till Hofmann <hofmann@kbsg.rwth-aachen.de>
6 ****************************************************************************/
7
8/* This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Library General Public License for more details.
17 *
18 * Read the full text in the LICENSE.GPL file in the doc directory.
19 */
20
21#include "execution_time_estimator_inifin.h"
22
23namespace fawkes {
24
25/** @class ExecutionTimeEstimatorsAspectIniFin
26 * The Aspect IniFin for the ExecutionTimeEstimatorsAspect.
27 */
28
29/** Constructor.
30 * @param manager The manager for the time estimators to use in the aspect */
33: AspectIniFin("SkillExecutionTimeEstimatorAspect")
34{
35 execution_time_estimator_manager_ = manager;
36}
37
38/** Destructor. */
40{
41}
42
44ExecutionTimeEstimatorsAspectIniFin::get_aspect(Thread *thread) const
45{
47 dynamic_cast<ExecutionTimeEstimatorsAspect *>(thread);
48 if (!exec_thread) {
50 "Thread '%s' claims to have the SkillExecutionTimeEstimatorAspect, but RRTI says it has not.",
51 thread->name());
52 }
53 return exec_thread;
54}
55
56/** Initialize the thread with the aspect.
57 * @param thread The thread to initialize.
58 */
59void
61{
62 get_aspect(thread)->init_ExecutionTimeEstimatorsAspect(execution_time_estimator_manager_);
63}
64
65/** Finalize the aspect of the given thread.
66 * @param thread The thread to finalize.
67 */
68void
70{
71 get_aspect(thread)->finalize_ExecutionTimeEstimatorsAspect();
72}
73
74} // namespace fawkes
Aspect initializer/finalizer base class.
Definition: inifin.h:34
A manager for execution time providers.
virtual void init(Thread *thread)
Initialize the thread with the aspect.
virtual void finalize(Thread *thread)
Finalize the aspect of the given thread.
ExecutionTimeEstimatorsAspectIniFin(ExecutionTimeEstimatorManager *manager)
Constructor.
An aspect to give access to the execution time estimator manager.
void finalize_ExecutionTimeEstimatorsAspect()
Finalize the aspect.
void init_ExecutionTimeEstimatorsAspect(ExecutionTimeEstimatorManager *provider_manager)
Initialize the aspect with a provider manager.
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Fawkes library namespace.