Fawkes API Fawkes Development Version

time_source.cpp

00001 
00002 /***************************************************************************
00003  *  time_source.cpp - Time source aspect for Fawkes
00004  *
00005  *  Created: Sun Feb 24 13:34:37 2008
00006  *  Copyright  2008  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/time_source.h>
00025 
00026 namespace fawkes {
00027 
00028 /** @class TimeSourceAspect <aspect/time_source.h>
00029  * Thread aspect that allows to provide a time source to the Fawkes clock.
00030  * There may be at most one external time source provided by a thread with
00031  * the TimeSourceAspect at any given time. This is ensured by aspect
00032  * initializer.
00033  * This aspect can be used for example to attach Fawkes to a simulator and
00034  * provide the simulated time to the system.
00035  *
00036  * @ingroup Aspects
00037  * @author Tim Niemueller
00038  */
00039 
00040 
00041 /** Constructor.
00042  * @param timesource the time source to provide to Fawkes
00043  */
00044 TimeSourceAspect::TimeSourceAspect(TimeSource *timesource)
00045 {
00046   __time_source = timesource;
00047 }
00048 
00049 /** Virtual empty destructor. */
00050 TimeSourceAspect::~TimeSourceAspect()
00051 {
00052 }
00053 
00054 
00055 /** Get time source.
00056  * This method is called by the aspect initializer to get the time source
00057  * the thread with this aspect provides.
00058  * @return time source provided by the thread with this aspect
00059  */
00060 TimeSource *
00061 TimeSourceAspect::get_timesource() const
00062 {
00063   return __time_source;
00064 }
00065 
00066 } // end namespace fawkes
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends