Fawkes API  Fawkes Development Version
rrd_inifin.cpp
00001 
00002 /***************************************************************************
00003  *  rrd_inifin.cpp - Fawkes RRDAspect initializer/finalizer
00004  *
00005  *  Created: Mon Dec 06 22:33:03 2010
00006  *  Copyright  2006-2010  Tim Niemueller [www.niemueller.de]
00007  *
00008  ****************************************************************************/
00009 
00010 /*  This program is free software; you can redistribute it and/or modify
00011  *  it under the terms of the GNU General Public License as published by
00012  *  the Free Software Foundation; either version 2 of the License, or
00013  *  (at your option) any later version. A runtime exception applies to
00014  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00015  *
00016  *  This program is distributed in the hope that it will be useful,
00017  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *  GNU Library General Public License for more details.
00020  *
00021  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00022  */
00023 
00024 #include <plugins/rrd/aspect/rrd_inifin.h>
00025 #include <plugins/rrd/aspect/rrd.h>
00026 #include <plugins/rrd/aspect/rrd_manager.h>
00027 #include <core/threading/thread_finalizer.h>
00028 
00029 namespace fawkes {
00030 #if 0 /* just to make Emacs auto-indent happy */
00031 }
00032 #endif
00033 
00034 /** @class RRDAspectIniFin <plugins/rrd/aspect/rrd_inifin.h>
00035  * RRDAspect initializer/finalizer.
00036  * This initializer/finalizer will provide the RRDManager to threads with
00037  * the RRDAspect.
00038  * @author Tim Niemueller
00039  */
00040 
00041 /** Constructor.
00042  * @param rrd_manager RRD manager to pass on to threads
00043  */
00044 RRDAspectIniFin::RRDAspectIniFin(RRDManager *rrd_manager)
00045   : AspectIniFin("RRDAspect")
00046 {
00047   __rrd_manager = rrd_manager;
00048 }
00049 
00050 void
00051 RRDAspectIniFin::init(Thread *thread)
00052 {
00053   RRDAspect *rrd_thread;
00054   rrd_thread = dynamic_cast<RRDAspect *>(thread);
00055   if (rrd_thread == NULL) {
00056     throw CannotInitializeThreadException("Thread '%s' claims to have the "
00057                                           "RRDAspect, but RTTI says it "
00058                                           "has not. ", thread->name());
00059   }
00060 
00061   rrd_thread->init_RRDAspect(__rrd_manager);
00062 }
00063 
00064 void
00065 RRDAspectIniFin::finalize(Thread *thread)
00066 {
00067 }
00068 
00069 
00070 
00071 } // end namespace fawkes