Fawkes API
Fawkes Development Version
time_source.cpp
1
2
/***************************************************************************
3
* time_source.cpp - Time source aspect for Fawkes
4
*
5
* Created: Sun Feb 24 13:34:37 2008
6
* Copyright 2008-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 <aspect/aspect.h>
25
#include <aspect/time_source.h>
26
27
namespace
fawkes
{
28
29
/** @class TimeSourceAspect <aspect/time_source.h>
30
* Thread aspect that allows to provide a time source to the Fawkes clock.
31
* There may be at most one external time source provided by a thread with
32
* the TimeSourceAspect at any given time. This is ensured by aspect
33
* initializer.
34
* This aspect can be used for example to attach Fawkes to a simulator and
35
* provide the simulated time to the system.
36
*
37
* @ingroup Aspects
38
* @author Tim Niemueller
39
*/
40
41
/** Constructor.
42
* @param timesource the time source to provide to Fawkes
43
*/
44
TimeSourceAspect::TimeSourceAspect
(
TimeSource
*timesource)
45
{
46
add_aspect
(
"TimeSourceAspect"
);
47
time_source_ = timesource;
48
}
49
50
/** Virtual empty destructor. */
51
TimeSourceAspect::~TimeSourceAspect
()
52
{
53
}
54
55
/** Get time source.
56
* This method is called by the aspect initializer to get the time source
57
* the thread with this aspect provides.
58
* @return time source provided by the thread with this aspect
59
*/
60
TimeSource
*
61
TimeSourceAspect::get_timesource
()
const
62
{
63
return
time_source_;
64
}
65
66
}
// end namespace fawkes
fawkes::Aspect::add_aspect
void add_aspect(const char *name)
Add an aspect to a thread.
Definition:
aspect.cpp:49
fawkes
Fawkes library namespace.
fawkes::TimeSourceAspect::get_timesource
TimeSource * get_timesource() const
Get time source.
Definition:
time_source.cpp:61
fawkes::TimeSourceAspect::~TimeSourceAspect
virtual ~TimeSourceAspect()
Virtual empty destructor.
Definition:
time_source.cpp:51
fawkes::TimeSource
TimeSource interface.
Definition:
timesource.h:37
fawkes::TimeSourceAspect::TimeSourceAspect
TimeSourceAspect(TimeSource *timesource) __attribute__((nonnull))
Constructor.
Definition:
time_source.cpp:44
src
libs
aspect
time_source.cpp
Generated by
1.8.20