# 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  

object_unknown.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2000 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL 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, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_OBJECT_UNKNOWN_H
00027 #define NL_OBJECT_UNKNOWN_H
00028 
00029 #include "nel/ai/script/type_def.h"
00030 
00031 namespace NLAISCRIPT
00032 {
00045         class CObjectUnknown: public NLAIAGENT::IObjectIA       
00046         {
00047         
00048         private:
00050                 IOpType *_opType;
00052                 IOpType *_opBaseType;
00053 
00054         public:
00056                 CObjectUnknown(IOpType *opType)
00057                 {
00058                         _opType = opType;
00059                         _opBaseType = _opType;
00060                         _opBaseType->incRef();
00061                 }
00062 
00064                 CObjectUnknown(IOpType *opType,IOpType *opBaseType)
00065                 {
00066                         _opType = opType;
00067                         _opBaseType = opBaseType;
00068                 }
00069 
00071 
00072                 const NLAIC::CIdentType &getType() const
00073                 {
00074                         const NLAIC::CIdentType *id = _opType->getConstraintTypeOf();
00075                         if(id == NULL) throw NLAIE::CExceptionUnReference(std::string("object type is unreference"));
00076                         return *id;
00077                 }
00078 
00079                 const NLAIC::IBasicType *clone() const
00080                 {
00081                         _opType->incRef();
00082                         _opBaseType->incRef();
00083                         return new CObjectUnknown(_opType,_opBaseType);
00084                 }
00085 
00086                 const NLAIC::IBasicType *newInstance() const
00087                 {
00088                         return clone();                 
00089                 }
00090 
00091                 void getDebugString(std::string &txt) const
00092                 {
00093                         const NLAIC::CIdentType *id = _opType->getConstraintTypeOf();
00094                         if(id)
00095                         {
00096                                 txt += NLAIC::stringGetBuild("CObjectUnknown< _opType < %s > >", (const char *)*id);
00097                         }
00098                         else 
00099                                 txt += "CObjectUnknown< _opType < NULL > >";
00100                 }
00101 
00102                 void save(NLMISC::IStream &os)
00103                 {
00104                         
00105                 }
00106 
00107                 void load(NLMISC::IStream &is)
00108                 {
00109                 }
00110 
00111                 bool isEqual(const NLAIAGENT::IBasicObjectIA &a) const 
00112                 {
00113                         return true;
00114                 }               
00115 
00116                 const NLAIAGENT::IObjectIA::CProcessResult &run()
00117                 {
00118                         return NLAIAGENT::IObjectIA::ProcessRun;;
00119                 }
00121                 
00122 
00124 
00125                 const IOpType *getBaseType() const
00126                 {
00127                         return _opBaseType;
00128                 }
00129 
00130                 const IOpType *getClassType() const
00131                 {
00132                         return _opType;
00133 
00134                 }
00135 
00136                 void setClassType(IOpType *o)
00137                 {
00138                         _opType->release();
00139                         _opType = o;
00140                 }
00141 
00142                 void setBaseType(IOpType *o)
00143                 {
00144                         _opBaseType->release();
00145                         _opBaseType = o;
00146                 }
00147                 //@
00148 
00149                 ~CObjectUnknown()
00150                 {
00151                         _opType->release();
00152                         _opBaseType->release();
00153                 }
00154         };
00155 }
00156 
00157 
00158 #endif