Fawkes API
Fawkes Development Version
rrd_inifin.cpp
1
2
/***************************************************************************
3
* rrd_inifin.cpp - Fawkes RRDAspect initializer/finalizer
4
*
5
* Created: Mon Dec 06 22:33:03 2010
6
* Copyright 2006-2010 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version. A runtime exception applies to
14
* this software (see LICENSE.GPL_WRE file mentioned below for details).
15
*
16
* This program is distributed in the hope that it will be useful,
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
* GNU Library General Public License for more details.
20
*
21
* Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22
*/
23
24
#include <core/threading/thread_finalizer.h>
25
#include <plugins/rrd/aspect/rrd.h>
26
#include <plugins/rrd/aspect/rrd_inifin.h>
27
#include <plugins/rrd/aspect/rrd_manager.h>
28
29
namespace
fawkes
{
30
31
/** @class RRDAspectIniFin <plugins/rrd/aspect/rrd_inifin.h>
32
* RRDAspect initializer/finalizer.
33
* This initializer/finalizer will provide the RRDManager to threads with
34
* the RRDAspect.
35
* @author Tim Niemueller
36
*/
37
38
/** Constructor.
39
* @param rrd_manager RRD manager to pass on to threads
40
*/
41
RRDAspectIniFin::RRDAspectIniFin
(RRDManager *rrd_manager) : AspectIniFin(
"RRDAspect"
)
42
{
43
rrd_manager_ = rrd_manager;
44
}
45
46
void
47
RRDAspectIniFin::init
(
Thread
*thread)
48
{
49
RRDAspect
*rrd_thread;
50
rrd_thread =
dynamic_cast<
RRDAspect
*
>
(thread);
51
if
(rrd_thread == NULL) {
52
throw
CannotInitializeThreadException
(
"Thread '%s' claims to have the "
53
"RRDAspect, but RTTI says it "
54
"has not. "
,
55
thread->
name
());
56
}
57
58
rrd_thread->init_RRDAspect(rrd_manager_);
59
}
60
61
void
62
RRDAspectIniFin::finalize
(Thread *thread)
63
{
64
}
65
66
}
// end namespace fawkes
fawkes::RRDAspect
Definition:
rrd.h:41
fawkes::CannotInitializeThreadException
Definition:
thread_initializer.h:39
fawkes::Thread::name
const char * name() const
Definition:
thread.h:100
fawkes
fawkes::RRDAspectIniFin::init
virtual void init(Thread *thread)
Definition:
rrd_inifin.cpp:53
fawkes::RRDAspectIniFin::RRDAspectIniFin
RRDAspectIniFin(RRDManager *rrd_manager)
Constructor.
Definition:
rrd_inifin.cpp:47
fawkes::RRDAspectIniFin::finalize
virtual void finalize(Thread *thread)
Definition:
rrd_inifin.cpp:68
fawkes::Thread
Definition:
thread.h:45
src
plugins
rrd
aspect
rrd_inifin.cpp
Generated by
1.8.17