Fawkes API  Fawkes Development Version
aspect.cpp
00001 
00002 /***************************************************************************
00003  *  aspect.cpp - Aspect base class
00004  *
00005  *  Created: Tue Nov 23 22:27:43 2010
00006  *  Copyright  2006-2010  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/aspect.h>
00025 
00026 namespace fawkes {
00027 #if 0 /* just to make Emacs auto-indent happy */
00028 }
00029 #endif
00030 
00031 /** @class Aspect <aspect/aspect.h>
00032  * Fawkes aspect base class.
00033  * This base class is the core for providing an extensible aspects system.
00034  * Aspects inherit from this base class via virtual inheritance. That means
00035  * that the constructor is only called once, and hence we can keep a list of
00036  * names of the aspects attached to a thread. This way we can easily
00037  * recognize all aspects of a thread, even though the aspect might currently
00038  * be unknown to the system, because it has not been registered.
00039  *
00040  * Do not use this class directly for anything other than creating a new
00041  * aspect.
00042  *
00043  * @author Tim Niemueller
00044  */
00045 
00046 /** Add an aspect to a thread.
00047  * This records the name of the threads added to a thread. This method may
00048  * must be used exactly once in constructors of aspects, and only there.
00049  * @param name aspect name that is added to the thread
00050  */
00051 void
00052 Aspect::add_aspect(const char *name)
00053 {
00054   __aspects.push_back(name);
00055 }
00056 
00057 
00058 /** Get list of aspect names attached to a aspected thread.
00059  * @return list of aspect names attached to an aspected thread
00060  */
00061 const std::list<const char *> &
00062 Aspect::get_aspects() const
00063 {
00064   return __aspects;
00065 }
00066 
00067 
00068 } // end namespace fawkes