Fawkes API Fawkes Development Version
aspect.cpp
1
2/***************************************************************************
3 * aspect.cpp - Aspect base class
4 *
5 * Created: Tue Nov 23 22:27:43 2010
6 * Copyright 2006-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
26namespace fawkes {
27
28/** @class Aspect <aspect/aspect.h>
29 * Fawkes aspect base class.
30 * This base class is the core for providing an extensible aspects system.
31 * Aspects inherit from this base class via virtual inheritance. That means
32 * that the constructor is only called once, and hence we can keep a list of
33 * names of the aspects attached to a thread. This way we can easily
34 * recognize all aspects of a thread, even though the aspect might currently
35 * be unknown to the system, because it has not been registered.
36 *
37 * Do not use this class directly for anything other than creating a new
38 * aspect.
39 *
40 * @author Tim Niemueller
41 */
42
43/** Add an aspect to a thread.
44 * This records the name of the threads added to a thread. This method may
45 * must be used exactly once in constructors of aspects, and only there.
46 * @param name aspect name that is added to the thread
47 */
48void
49Aspect::add_aspect(const char *name)
50{
51 aspects_.push_back(name);
52}
53
54/** Get list of aspect names attached to a aspected thread.
55 * @return list of aspect names attached to an aspected thread
56 */
57const std::list<const char *> &
59{
60 return aspects_;
61}
62
63} // end namespace fawkes
const std::list< const char * > & get_aspects() const
Get list of aspect names attached to a aspected thread.
Definition: aspect.cpp:58
void add_aspect(const char *name)
Add an aspect to a thread.
Definition: aspect.cpp:49
Fawkes library namespace.