Fawkes API  Fawkes Development Version
clock.cpp
00001 
00002 /***************************************************************************
00003  *  clock.cpp - Clock aspect for Fawkes
00004  *
00005  *  Created: Tue Jun 12 22:30:33 2007
00006  *  Copyright  2007       Daniel Beck
00007  *             2007-2010  Tim Niemueller [www.niemueller.de]
00008  *
00009  ****************************************************************************/
00010 
00011 /*  This program is free software; you can redistribute it and/or modify
00012  *  it under the terms of the GNU General Public License as published by
00013  *  the Free Software Foundation; either version 2 of the License, or
00014  *  (at your option) any later version. A runtime exception applies to
00015  *  this software (see LICENSE.GPL_WRE file mentioned below for details).
00016  *
00017  *  This program is distributed in the hope that it will be useful,
00018  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  *  GNU Library General Public License for more details.
00021  *
00022  *  Read the full text in the LICENSE.GPL_WRE file in the doc directory.
00023  */
00024 
00025 #include <aspect/clock.h>
00026 
00027 namespace fawkes {
00028 #if 0 /* just to make Emacs auto-indent happy */
00029 }
00030 #endif
00031 
00032 /** @class ClockAspect <aspect/clock.h>
00033  * Thread aspect that allows to obtain the current time from the clock.
00034  * Threads that need to deal with the current time should have this aspect
00035  * and not obtain the time by means of gettimeofday! 
00036  *
00037  * @ingroup Aspects
00038  * @author Daniel Beck
00039  */
00040 
00041 
00042 /** @var Clock ClockAspect::clock
00043  * By means of this member access to the clock is given.
00044  */
00045 
00046 /** Constructor. */
00047 ClockAspect::ClockAspect()
00048 {
00049   add_aspect("ClockAspect");
00050 }
00051 
00052 /** Virtual empty destructor. */
00053 ClockAspect::~ClockAspect()
00054 {
00055 }
00056 
00057 
00058 /** Set the clock.
00059  * It is guaranteed that this is called for a clock thread before
00060  * Thread::start() is called (when running regularly inside Fawkes).
00061  * @param clock Clock instance to use.
00062  */
00063 void
00064 ClockAspect::init_ClockAspect(Clock *clock)
00065 {
00066   this->clock = clock;
00067 }
00068 
00069 } // end namespace fawkes