# 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  

operation.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX D.T.C. SYSTEM.
00010  * NEVRAX D.T.C. SYSTEM 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 D.T.C. SYSTEM 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 D.T.C. SYSTEM; 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 OPERATION_H
00027 #define OPERATION_H
00028 
00029 #include "nel/ai/agent/agent_script.h"
00030 #include "nel/ai/agent/agent_operator.h"
00031 
00032 namespace NLAIAGENT
00033 {       
00034 
00035         class CAgentOperation: public CAgentScript, public virtual IObjetOp
00036         {
00037         public:
00038                 static const NLAIC::CIdentType *IdAgentOperation;
00039                 static const NLAIC::CIdentType *idMsgOnChangeMsg;
00040                 static const NLAIAGENT::IMessageBase *MsgOnChangeMsg;
00041 
00042         public:
00043                 enum{
00044                         TSetValue,
00045                         TGetValue,
00046                         TSetName,
00047                         TGetName,
00048                         TUpdate,
00049                         TIsChange,
00050                         TConnect,
00051                         TLastM
00052                 };
00053                 static CMethodCall **StaticMethod;
00054 
00055         protected:
00056                 IObjetOp *_Op;
00057 
00058         private:                
00059                 CStringType *_Name;
00060                 std::list < IConnectIA * >_Connection;
00061                 bool _Change;
00062 
00063         public:
00064                 CAgentOperation();
00065                 CAgentOperation(IObjetOp *o);
00066                 CAgentOperation(const CAgentOperation &);
00067 
00068                 virtual ~CAgentOperation();
00069 
00070                 virtual void setValue(IObjetOp *o)
00071                 {
00072                         if(_Op != NULL) 
00073                                         _Op->release();
00074                         _Op = o;
00075                 }
00076 
00077                 const IObjetOp *getsetValue() const
00078                 {
00079                         return _Op;
00080                 }
00081 
00082                 void setName(const CStringType &name)
00083                 {
00084                         if(_Name != NULL) 
00085                                         _Name->release();
00086                         _Name = new CStringType (CIndexedVarName(name.getStr().getString()));
00087                 }
00088 
00089                 const CStringType *getName() const
00090                 {
00091                         return _Name;
00092                 }
00093 
00094                 virtual bool isTrue() const;
00095 
00096                 virtual IObjetOp &neg();
00097                 virtual IObjetOp &operator += (const IObjetOp &);
00098                 virtual IObjetOp &operator -= (const IObjetOp &);
00099                 virtual IObjetOp &operator *= (const IObjetOp &);
00100                 virtual IObjetOp &operator /= (const IObjetOp &);
00101 
00102                 virtual IObjectIA &operator = (const IObjectIA &a)
00103                 {
00104                         std::string text;
00105                         text = NLAIC::stringGetBuild("IObjectIA &CAgentOperation::operator = (const IObjectIA &a) is very ambiguous don't use it");
00106                         throw NLAIE::CExceptionNotImplemented(text.c_str());
00107                 }
00108 
00109                 virtual CProcessResult runActivity();
00110                 virtual bool haveActivity() const
00111                 {
00112                         return true;
00113                 }
00114 
00115                 virtual IMessageBase *runTell(const IMessageBase &);
00116 
00117                 virtual void onKill(IConnectIA *A);
00118                 virtual const CProcessResult &run();
00119                 virtual bool isEqual(const IBasicObjectIA &a) const;
00120                 virtual void load(NLMISC::IStream &is);
00121                 virtual void save(NLMISC::IStream &os);
00122                 virtual const NLAIC::IBasicType *clone() const;
00123                 virtual const NLAIC::IBasicType *newInstance() const;
00124                 virtual void getDebugString(std::string &t) const;
00125 
00126                 virtual const NLAIC::CIdentType &getType() const
00127                 {
00128                         return  *IdAgentOperation;
00129                 }
00130 
00131                 virtual void update()
00132                 {
00133                         _Change = true;
00134                 }
00135 
00136                 virtual bool changed() const
00137                 {                       
00138                         return _Change;
00139                 }               
00140 
00141                 virtual void connectOnChange(IConnectIA *ref);          
00142 
00143                 virtual void changeIsDone()
00144                 {
00145                         _Change = false;
00146                 }
00147 
00148                 virtual int getBaseMethodCount() const;
00149                 virtual NLAIAGENT::tQueue isMember(const NLAIAGENT::IVarName *,const NLAIAGENT::IVarName *,const NLAIAGENT::IObjectIA &) const;
00150                 virtual sint32 getMethodIndexSize() const;
00151                 virtual CProcessResult runMethodBase(int, int, IObjectIA *);
00152                 virtual CProcessResult runMethodBase(int, IObjectIA *);
00153 
00154         protected:              
00155                 void update(IObjectIA *obj);
00156 
00157         public:
00158                 static void initClass();
00159                 static void releaseClass();
00160         };
00161 }
00162 #endif