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