FIFE  2008.0
 All Classes Namespaces Functions Variables Enumerations Enumerator
object.h
00001 /***************************************************************************
00002  *   Copyright (C) 2005-2008 by the FIFE team                              *
00003  *   http://www.fifengine.de                                               *
00004  *   This file is part of FIFE.                                            *
00005  *                                                                         *
00006  *   FIFE is free software; you can redistribute it and/or                 *
00007  *   modify it under the terms of the GNU Lesser General Public            *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2.1 of the License, or (at your option) any later version.    *
00010  *                                                                         *
00011  *   This library is distributed in the hope that it will be useful,       *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00014  *   Lesser General Public License for more details.                       *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Lesser General Public      *
00017  *   License along with this library; if not, write to the                 *
00018  *   Free Software Foundation, Inc.,                                       *
00019  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
00020  ***************************************************************************/
00021 
00022 #ifndef FIFE_PROTOTYPE_H
00023 #define FIFE_PROTOTYPE_H
00024 
00025 // Standard C++ library includes
00026 #include <string>
00027 #include <map>
00028 #include <list>
00029 
00030 // 3rd party library includes
00031 
00032 // FIFE includes
00033 // These includes are split up in two parts, separated by one empty line
00034 // First block: files included from the FIFE root src directory
00035 // Second block: files included from the same folder
00036 #include "util/base/resourceclass.h"
00037 #include "util/math/angles.h"
00038 
00039 namespace FIFE {
00040 
00041     class Action;
00042     class AbstractPather;
00043     class AbstractVisual;
00044 
00051     class Object : public ResourceClass {
00052     public:
00062         Object(const std::string& identifier, const std::string& name_space, Object* inherited=NULL);
00063 
00066         ~Object();
00067 
00068         const std::string& getId() const { return m_id; }
00069         const std::string& getNamespace() const { return m_namespace; }
00070 
00073         void setId(const std::string& id) { m_id = id; }
00074 
00084         Action* createAction(const std::string& identifier, bool is_default=false);
00085 
00088         Action* getAction(const std::string& identifier) const;
00089 
00092         std::list<std::string> getActionIds() const;
00093 
00096         Action* getDefaultAction() const { return m_defaultaction; }
00097         
00100         void setPather(AbstractPather* pather);
00101 
00104         AbstractPather* getPather() const { return m_pather; }
00105 
00109         Object* getInherited() const { return m_inherited; }
00110 
00113         void adoptVisual(AbstractVisual* visual) { m_visual = visual; }
00114         
00117         template<typename T> T* getVisual() const { return reinterpret_cast<T*>(m_visual); }
00118         
00121         void setBlocking(bool blocking) { m_blocking = blocking; }
00122 
00125         bool isBlocking() const;
00126     
00129         void setStatic(bool stat) { m_static = stat; }
00130 
00133         bool isStatic() const;
00134     
00135         bool operator==(const Object& obj) const;
00136         bool operator!=(const Object& obj) const;
00137         
00138     private:
00139         std::string m_id;
00140         std::string m_namespace;
00141         Object* m_inherited;
00142         std::map<std::string, Action*>* m_actions;
00143         bool m_blocking;
00144         bool m_static;
00145         AbstractPather* m_pather;
00146         AbstractVisual* m_visual;
00147         Action* m_defaultaction;
00148     };
00149 
00150 } //FIFE
00151 #endif
00152