# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

character.h

Go to the documentation of this file.
00001 
00006 /* Copyright, 2001 Nevrax Ltd.
00007  *
00008  * This file is part of NEVRAX NEL.
00009  * NEVRAX NEL is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2, or (at your option)
00012  * any later version.
00013 
00014  * NEVRAX NEL is distributed in the hope that it will be useful, but
00015  * WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00017  * General Public License for more details.
00018 
00019  * You should have received a copy of the GNU General Public License
00020  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00021  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00022  * MA 02111-1307, USA.
00023  */
00024 
00025 #ifndef NL_CHARACTER_H
00026 #define NL_CHARACTER_H
00027 
00028 #include "nel/ai/agent/agent.h"
00029 
00030 namespace NLAICHARACTER
00031 {       
00032         class ICharacter: public NLAIAGENT::IRefrence
00033         {               
00034         public:         
00035                 ICharacter():IRefrence(){}
00036                 ICharacter(const ICharacter &m):IRefrence(m){}
00037                 virtual ~ICharacter() {}
00038 
00039                 virtual const std::string &getName() const = 0;         
00040 
00041                 virtual void setName(const std::string &) = 0;          
00042 
00043                 virtual const ICharacter *haveCharacter(const std::string &) const = 0;         
00044 
00045                 const ICharacter *haveCharacter(const ICharacter &c) const
00046                 {
00047                         return haveCharacter(c.getName());
00048                 }
00049 
00050                 virtual bool canAddCharacter() const = 0;               
00051 
00052                 virtual bool addCharacter(const ICharacter &) = 0;              
00053                 
00054         };
00055 
00056         class CCharacterChild: public ICharacter
00057         {
00058         private:
00059                 std::string _Name;
00060         public:
00061                 static const NLAIC::CIdentType *IDCharacterChild;
00062 
00063         public:
00064                 CCharacterChild(const std::string &name):_Name(name) {}
00065                 CCharacterChild(const CCharacterChild &name);
00066                 virtual ~CCharacterChild();
00067 
00068                 virtual void setName(const std::string &name)
00069                 {
00070                         _Name = name;
00071                 }
00072 
00073                 virtual const std::string &getName() const
00074                 {
00075                         return _Name;
00076                 }
00077                 virtual const ICharacter *haveCharacter(const std::string &) const;
00078                 virtual bool addCharacter(const ICharacter &);
00079                 virtual bool canAddCharacter() const;
00080 
00081                 virtual void save(NLMISC::IStream &os);
00082                 virtual void load(NLMISC::IStream &is);
00083                 virtual void getDebugString(std::string &) const;
00084                 virtual const NLAIC::IBasicType *clone() const;
00085                 virtual const NLAIC::IBasicType *newInstance() const;
00086 
00087                 virtual const NLAIC::CIdentType &getType() const
00088                 {
00089                         return *IDCharacterChild;
00090                 }
00091                 virtual bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const;
00092                 virtual const NLAIAGENT::IObjectIA::CProcessResult &run();
00093         public:
00094                 static void initClass();
00095                 static void releaseClass();
00096                 
00097         };
00098 
00099         class CCharacterNoeud: public CCharacterChild
00100         {
00101         private:                
00102                 std::list<ICharacter *> _Character;
00103 
00104         public:
00105                 static const NLAIC::CIdentType *IDCharacterNoeud;
00106 
00107         public:
00108                 CCharacterNoeud(const std::string &name):CCharacterChild(name) {}
00109                 CCharacterNoeud(const CCharacterNoeud &name);
00110                 virtual ~CCharacterNoeud();
00111 
00112                 virtual const ICharacter *haveCharacter(const std::string &) const;
00113                 virtual bool addCharacter(const ICharacter &);
00114                 //virtual void popCharacter(const std::string &);
00115                 virtual bool canAddCharacter() const;
00116 
00117                 virtual void save(NLMISC::IStream &os);
00118                 virtual void load(NLMISC::IStream &is);
00119                 virtual void getDebugString(char *text) const;
00120                 virtual const NLAIC::IBasicType *clone() const;
00121                 virtual const NLAIC::IBasicType *newInstance() const;
00122                 virtual const NLAIC::CIdentType &getType() const
00123                 {
00124                         return *IDCharacterChild;
00125                 }
00126                 virtual bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const;
00127         public:
00128                 static void initClass();
00129                 static void releaseClass();
00130         };      
00131 }
00132 #endif