Fawkes API
Fawkes Development Version
|
00001 00002 /*************************************************************************** 00003 * logging.cpp - Fawkes Logging Aspect initializer/finalizer 00004 * 00005 * Created: Tue Nov 23 23:06:13 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 <aspect/inifins/logging.h> 00025 #include <aspect/logging.h> 00026 00027 namespace fawkes { 00028 #if 0 /* just to make Emacs auto-indent happy */ 00029 } 00030 #endif 00031 00032 /** @class LoggingAspectIniFin <aspect/inifins/logging.h> 00033 * Initializer/finalizer for the LoggingAspect. 00034 * @author Tim Niemueller 00035 */ 00036 00037 /** Constructor. 00038 * @param logger logger instance to pass to threads 00039 */ 00040 LoggingAspectIniFin::LoggingAspectIniFin(Logger *logger) 00041 : AspectIniFin("LoggingAspect") 00042 { 00043 __logger = logger; 00044 } 00045 00046 00047 void 00048 LoggingAspectIniFin::init(Thread *thread) 00049 { 00050 LoggingAspect *logging_thread; 00051 logging_thread = dynamic_cast<LoggingAspect *>(thread); 00052 if (logging_thread == 0) { 00053 throw CannotInitializeThreadException("Thread '%s' claims to have the " 00054 "LoggingAspect, but RTTI says it " 00055 "has not. ", thread->name()); 00056 } 00057 00058 logging_thread->init_LoggingAspect(__logger); 00059 } 00060 00061 00062 void 00063 LoggingAspectIniFin::finalize(Thread *thread) 00064 { 00065 } 00066 00067 00068 } // end namespace fawkes