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
29namespace 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 */
42{
43 rrd_manager_ = rrd_manager;
44}
45
46void
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
61void
63{
64}
65
66} // end namespace fawkes
Aspect initializer/finalizer base class.
Definition: inifin.h:34
virtual void finalize(Thread *thread)
Finalize thread.
Definition: rrd_inifin.cpp:62
RRDAspectIniFin(RRDManager *rrd_manager)
Constructor.
Definition: rrd_inifin.cpp:41
virtual void init(Thread *thread)
Initialize thread.
Definition: rrd_inifin.cpp:47
Thread aspect create, update, and graph round-robin databases (RRD).
Definition: rrd.h:36
Interface for a RRD connection creator.
Definition: rrd_manager.h:37
Thread class encapsulation of pthreads.
Definition: thread.h:46
const char * name() const
Get name of thread.
Definition: thread.h:100
Fawkes library namespace.