#include <constraint_find_run.h>
Inheritance diagram for NLAISCRIPT::CConstraintFindRun:
This class is allow to find the run(msg) method. This method derive from CConstraintMethode, where the CConstraintMethode base class run with a CConstraintMethode::searchCall.
Note that this class is used after a send message to searche the offset of the run that can process the message.
Nevrax France
Definition at line 42 of file constraint_find_run.h.
NLMISC::IStreamable method. | |
virtual std::string | getClassName () |
virtual void | serial (NLMISC::IStream &) throw (NLMISC::EStream) |
Public Types | |
enum | ConstraintTypeEnum { constraintMethode, constraintChkMethodeType, operandSimple, operandSimpleListOr, operandAnyObject, operandVoid, operandUnknown, operationType, operationTypeGD, operandListType, constraintStackComp, constraintDebug, constraintFindRun } |
enum | TCallTypeOpCode { normalCall, stackCall, heapCall, newCall, searchCall } |
Public Member Functions | |
void | addConstraint (IConstraint *c) |
Add a constraint dependency. We add a constraint dependency when a given constraint want the result of an other constraint. | |
CConstraintFindRun (CConstraintMethode::TCallTypeOpCode,int posHeap, IConstraint *baseClass, NLAIAGENT::IBaseGroupType *methodName, CParam *param, int lin, int col) | |
const IConstraint * | clone () const |
Get a clone pointer memory. | |
sint32 | decRef () |
Decrement the reference of an object. | |
virtual void | getDebugString (std::string &t) const |
const sint32 & | getRef () const |
get the refence count. | |
ConstraintTypeEnum | getTypeOfClass () const |
get the type of class. the type must be in the ConstraintTypeEnum enumeration. | |
void | incRef () |
Inc a reference. We use this when we have to conserve a pointer memeory for exemple in a list. | |
void | popConstraint (IConstraint *c) |
pop the last constaint dependency. | |
virtual void | release () |
Release allow to release the pointer. The last release when the _Ref is nul delete the object. | |
virtual void | run (CCompilateur &) |
Run with a CCompilateur dependency. | |
void | runConnexcion () |
When a constraint is resoved,we call all dependency. | |
virtual void | setOpCode (IOpCode *x) |
virtual void | setOpCode (CCompilateur &comp, IOpCode *x, IConstraint *cType, bool del) |
virtual | ~CConstraintFindRun () |
IConstraint method. | |
void | addIndex (int i, CCodeBrancheRun *c) |
bool | dependOn (const IConstraint *c) const |
If this constraint depond on other constraint. | |
int | getColone () const |
get the colone of the expression that it have to be resolve by constraint in the code source. | |
const NLAIC::CIdentType * | getConstraintTypeOf () |
Type of the expression that it have to be resolve by constraint. | |
void | getError (char *) const |
get an error string when the constraint is'nt stisfied. | |
const CFunctionTag & | getfunctionTag () const |
const char * | getInfo () |
Get a string info. | |
int | getLine () const |
get the line of the expression that it have to be resolve by constraint in the code source. | |
bool | isEqual (const NLAIAGENT::IBaseGroupType &, const CParam &) const |
bool | operator== (const IConstraint &c) const |
virtual void | run (IConstraint *) |
Run with a IConstraint dependency. | |
bool | satisfied () |
If the constraint is resolved. | |
Protected Attributes | |
IConstraint * | _BaseClass |
Type of base class that constain method. A NULL value mean that method is in the last class parsed. | |
TCallTypeOpCode | _CallType |
Type of search. | |
std::list< std::pair< int, CCodeBrancheRun * > > | _Code |
int | _Col |
bool | _DelCType |
int | _Lin |
CFunctionTag | _M |
NLAIAGENT::IBaseGroupType * | _MethodName |
Hierarchy method name (a hierarchy name is some thing like classBaseName.className.methodName().). | |
CParam * | _Param |
Method argument. | |
int | _PosHeap |
bool | _Satisfied |
char * | _Txt |
char * | _TxtInfo |
IConstraint * | _Type |
Private Attributes | |
TCallTypeOpCode | _TypeOfCallType |
Type of class that contain the run method. |
|
This enum define all IConstraint class type defined. That is'nt very clean because it is'nt very objects way to do jobs but that make easy to make job with out make heavy the hisarchy class. Because the best way is to derive class form NLAIC::IBasicInterface but we have to register class in class factory, define a save an load ..., in short make a lot of work for an internal work. If later peopole need this kind of class we'll clean it.
Definition at line 138 of file constraint.h.
00139 { 00141 constraintMethode, 00143 constraintChkMethodeType, 00145 operandSimple, 00147 operandSimpleListOr, 00149 operandAnyObject, 00151 operandVoid, 00153 operandUnknown, 00155 operationType, 00157 operationTypeGD, 00159 operandListType, 00161 constraintStackComp, 00163 constraintDebug, 00165 constraintFindRun 00166 }; |
|
This enum allow to define the way to call the method that the class have to find. Later we use this enum to build the correct opcode.
Definition at line 249 of file constraint.h.
00249 { 00251 normalCall, 00253 stackCall, 00255 heapCall, 00257 newCall, 00259 searchCall 00260 }; |
|
Definition at line 32 of file constraint_find_run.cpp. References param. Referenced by clone().
00033 : 00034 CConstraintMethode(searchCall,posHeap,baseClass,methodName,param,lin,col),_TypeOfCallType(callType) 00035 { 00036 } |
|
Definition at line 147 of file constraint_find_run.cpp.
00148 { 00149 } |
|
Add a constraint dependency. We add a constraint dependency when a given constraint want the result of an other constraint.
Definition at line 207 of file constraint.h. References NLAISCRIPT::IConstraint::_ConstraintList. Referenced by NLAISCRIPT::COperandUnknown::COperandUnknown().
00208 { 00209 _ConstraintList.push_back(c); 00210 } |
|
Add a op-code dependency. the integer n is the index of the opcode in in the opcodePtr pointer. Implements NLAISCRIPT::IConstraint. Definition at line 334 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_Code.
00335 { 00336 _Code.push_back(std::pair<sint32, CCodeBrancheRun *>(i,c)); 00337 } |
|
Get a clone pointer memory.
Reimplemented from NLAISCRIPT::CConstraintMethode. Definition at line 38 of file constraint_find_run.cpp. References _TypeOfCallType, CConstraintFindRun(), NLAIC::IPointerGestion::incRef(), and x.
00039 { 00040 if(_BaseClass) _BaseClass->incRef(); 00041 _MethodName->incRef(); 00042 _Param->incRef(); 00043 IConstraint *x = new CConstraintFindRun(_TypeOfCallType,_PosHeap,_BaseClass,_MethodName,_Param,_Lin,_Col); 00044 return x; 00045 } |
|
Decrement the reference of an object.
Definition at line 93 of file abstract_interface.h. References NLAIC::IPointerGestion::_Ref, and sint32. Referenced by NLAIC::IPointerGestion::release(), and NLAIAGENT::CAgentTimerHandle::~CAgentTimerHandle().
00094 {
00095 return --_Ref;
00096 }
|
|
If this constraint depond on other constraint.
Implements NLAISCRIPT::IConstraint. Definition at line 316 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_BaseClass.
00317 { 00318 if( c == _Type || c == _BaseClass || c == this) return true; 00319 return false; 00320 } |
|
Implements NLMISC::IClassable. Reimplemented in NLAIC::CIdentType. Definition at line 116 of file abstract_interface.h. Referenced by NLAISCRIPT::CAgentClass::isClassInheritedFrom().
00117 { 00118 return std::string("<unnamed>"); 00119 } |
|
get the colone of the expression that it have to be resolve by constraint in the code source.
Implements NLAISCRIPT::IConstraint. Definition at line 366 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_Col.
00367 { 00368 return _Col; 00369 } |
|
Type of the expression that it have to be resolve by constraint.
Implements NLAISCRIPT::IConstraint. Definition at line 347 of file constraint.h. References NLAISCRIPT::IConstraint::getConstraintTypeOf().
|
|
|
get an error string when the constraint is'nt stisfied.
Implements NLAISCRIPT::IConstraint. Definition at line 317 of file constraint.cpp. References NLAISCRIPT::CConstraintMethode::_Txt.
00318 { 00319 strcpy(txt,_Txt); 00320 } |
|
Definition at line 357 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_M. Referenced by run(), and setOpCode().
00358 { 00359 return _M; 00360 } |
|
Get a string info.
Implements NLAISCRIPT::IConstraint. Definition at line 303 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_TxtInfo.
00304 { 00305 return _TxtInfo; 00306 } |
|
get the line of the expression that it have to be resolve by constraint in the code source.
Implements NLAISCRIPT::IConstraint. Definition at line 362 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_Lin.
00363 { 00364 return _Lin; 00365 } |
|
get the refence count.
Definition at line 99 of file abstract_interface.h. References NLAIC::IPointerGestion::_Ref, and sint32. Referenced by NLAIAGENT::CAgentTimerHandle::~CAgentTimerHandle().
00100 {
00101 return _Ref;
00102 }
|
|
get the type of class. the type must be in the ConstraintTypeEnum enumeration.
Reimplemented from NLAISCRIPT::CConstraintMethode. Definition at line 57 of file constraint_find_run.h.
00058 { 00059 return constraintFindRun; 00060 } |
|
|
Definition at line 322 of file constraint.cpp. Referenced by NLAISCRIPT::CCompilateur::getMethodConstraint().
00323 { 00324 if(((const NLAIAGENT::IBasicObjectIA &)*_MethodName) == ((const NLAIAGENT::IBasicObjectIA &)g) && *_Param == p) return true; 00325 return false; 00326 } |
|
Implements NLAISCRIPT::IConstraint. Definition at line 322 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_BaseClass, NLAISCRIPT::CConstraintMethode::_CallType, NLAISCRIPT::IConstraint::getTypeOfClass(), and NLAISCRIPT::CConstraintMethode::getTypeOfClass().
00323 { 00324 if(getTypeOfClass() == c.getTypeOfClass() && 00325 ((const CConstraintMethode &)c)._CallType == _CallType && 00326 ((const CConstraintMethode &)c)._BaseClass == _BaseClass && 00327 ((const CConstraintMethode &)c).isEqual(*_MethodName,*_Param)) 00328 { 00329 return true; 00330 } 00331 return false; 00332 } |
|
pop the last constaint dependency.
Definition at line 32 of file constraint.cpp. References NLAISCRIPT::IConstraint::_ConstraintList. Referenced by NLAISCRIPT::COperandUnknown::~COperandUnknown().
00033 { 00034 std::list<IConstraint *>::iterator it = _ConstraintList.begin(); 00035 while(it != _ConstraintList.end()) 00036 { 00037 if(*it == c) 00038 { 00039 _ConstraintList.erase(it); 00040 break; 00041 } 00042 it ++ ; 00043 } 00044 } |
|
|
Run with a IConstraint dependency.
Implements NLAISCRIPT::IConstraint. Definition at line 328 of file constraint.cpp.
00329 { 00330 } |
|
Run with a CCompilateur dependency.
Reimplemented from NLAISCRIPT::CConstraintMethode. Definition at line 47 of file constraint_find_run.cpp. References _TypeOfCallType, NLAIC::IBasicType::clone(), NLAISCRIPT::IConstraint::getConstraintTypeOf(), NLAISCRIPT::CParam::getDebugString(), NLAIC::IBasicType::getDebugString(), NLAIC::CIdentType::getFactory(), NLAISCRIPT::CConstraintMethode::getfunctionTag(), NLAIC::IBasicType::getType(), NLAIC::IPointerGestion::incRef(), NLAISCRIPT::CFunctionTag::Inheritance, NLAISCRIPT::CFunctionTag::Member, NLAIC::IPointerGestion::release(), NLAISCRIPT::IConstraint::run(), NLAISCRIPT::IConstraint::satisfied(), setOpCode(), NLAISCRIPT::CCompilateur::validateHierarchyMethode(), and x.
00048 { 00049 #ifdef NL_DEBUG 00050 std::string mtxt; 00051 std::string ptxt; 00052 std::string txt; 00053 00054 _MethodName->getDebugString(mtxt); 00055 _Param->getDebugString(ptxt); 00056 txt += mtxt + ptxt; 00057 #endif 00058 00059 if(_BaseClass) 00060 { 00061 if(!_BaseClass->satisfied()) _BaseClass->run(c); 00062 if(_BaseClass->satisfied()) 00063 { 00064 const NLAIAGENT::IObjectIA *cl = (const NLAIAGENT::IObjectIA *)(_BaseClass->getConstraintTypeOf()->getFactory())->getClass(); 00065 CFunctionTag method; 00066 NLAIAGENT::IBaseGroupType *m = (NLAIAGENT::IBaseGroupType *)_MethodName->clone(); 00067 const NLAIAGENT::IObjectIA *b = c.validateHierarchyMethode(method.Member,method.Inheritance,cl,*m); 00068 m->release(); 00069 //const NLAIAGENT::IObjectIA *b = c.validateHierarchyMethode(method.Member,method.Inheritance,cl,*_MethodName); 00070 if(b) 00071 { 00072 if(!(( (const NLAIC::CTypeOfObject &)b->getType() ) & NLAIC::CTypeOfObject::tInterpret)) 00073 { 00074 _Satisfied = true; 00075 _MethodName->incRef(); 00076 _Param->incRef(); 00077 _BaseClass->incRef(); 00078 const CFunctionTag &m = getfunctionTag(); 00079 ILoadObject *o=0; 00080 switch(_TypeOfCallType) 00081 { 00082 case normalCall: 00083 o = new CLoadSelfObject(method.Member); 00084 break; 00085 00086 case stackCall: 00087 o = new CLoadStackObject(m.Member); 00088 break; 00089 00090 case heapCall: 00091 o = new CLoadHeapObject(m.Member,_PosHeap); 00092 break; 00093 00094 case newCall: 00095 o = NULL; 00096 break; 00097 00098 case searchCall: 00099 o = NULL; 00100 break; 00101 00102 } 00103 IOpCode *x = new CFindRunMsg(_MethodName,_Param,(IOpType *)_BaseClass,o); 00104 setOpCode(x); 00105 return; 00106 } 00107 } 00108 } 00109 00110 } 00111 CConstraintMethode::run(c); 00112 } |
|
When a constraint is resoved,we call all dependency.
Definition at line 214 of file constraint.h. References NLAISCRIPT::IConstraint::_ConstraintList, and NLAISCRIPT::IConstraint::run(). Referenced by NLAISCRIPT::CConstraintChkMethodeType::run(), setOpCode(), and NLAISCRIPT::CConstraintMethode::setOpCode().
00215 { 00216 while(_ConstraintList.size()) 00217 { 00218 IConstraint *a = _ConstraintList.back(); 00219 _ConstraintList.pop_back(); 00220 a->run(this); 00221 } 00222 } |
|
If the constraint is resolved.
Implements NLAISCRIPT::IConstraint. Definition at line 311 of file constraint.h. References NLAISCRIPT::CConstraintMethode::_Satisfied.
00312 { 00313 return _Satisfied; 00314 } |
|
Implements NLMISC::IStreamable. Reimplemented in NLAIC::CIdentType, NLAIC::IBasicInterface, NLAISCRIPT::COperandVoid, NLAISCRIPT::COperandAnyObject, NLAISCRIPT::COperandSimple, NLAISCRIPT::COperandSimpleListOr, NLAISCRIPT::COperandUnknown, NLAISCRIPT::COperationType, NLAISCRIPT::COperationTypeGD, and NLAISCRIPT::COperandListType. Definition at line 120 of file abstract_interface.h. Referenced by NLAISCRIPT::CFindRunMsg::save().
00121 { 00122 } |
|
Definition at line 132 of file constraint_find_run.cpp. References NLAIC::IPointerGestion::release(), NLAISCRIPT::IConstraint::runConnexcion(), and x.
00133 { 00134 while(_Code.size()) 00135 { 00136 std::pair<int, CCodeBrancheRun *> &p = _Code.back(); 00137 IOpCode *op = (*p.second)[p.first]; 00138 op->release(); 00139 (*p.second)[p.first] = x; 00140 _Code.pop_back(); 00141 if(_Code.size()) x->incRef(); 00142 } 00143 _Type = _BaseClass; 00144 runConnexcion(); 00145 } |
|
Reimplemented from NLAISCRIPT::CConstraintMethode. Definition at line 114 of file constraint_find_run.cpp. References NLAISCRIPT::CConstraintMethode::getfunctionTag(), NLAISCRIPT::CFunctionTag::Inheritance, NLAISCRIPT::CFunctionTag::MethodNum, NLAIC::IPointerGestion::release(), NLAISCRIPT::IConstraint::run(), NLAISCRIPT::IConstraint::runConnexcion(), and x. Referenced by run().
00115 { 00116 const CFunctionTag &m = getfunctionTag(); 00117 IOpCode *x = new CMarkMsg(m.Inheritance, m.MethodNum); 00118 while(_Code.size()) 00119 { 00120 std::pair<int, CCodeBrancheRun *> &p = _Code.back(); 00121 IOpCode *op = (*p.second)[p.first]; 00122 op->release(); 00123 (*p.second)[p.first] = x; 00124 _Code.pop_back(); 00125 if(_Code.size()) x->incRef(); 00126 } 00127 _Type = cType; 00128 _Type->run(comp); 00129 _DelCType = del; 00130 runConnexcion(); 00131 } |
|
Type of base class that constain method. A NULL value mean that method is in the last class parsed.
Definition at line 265 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::clone(), NLAISCRIPT::CConstraintMethode::dependOn(), NLAISCRIPT::CConstraintMethode::operator==(), NLAISCRIPT::CConstraintMethode::run(), and NLAISCRIPT::CConstraintMethode::~CConstraintMethode(). |
|
Type of search.
Definition at line 263 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::clone(), NLAISCRIPT::CConstraintMethode::operator==(), and NLAISCRIPT::CConstraintMethode::run(). |
|
Definition at line 273 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::addIndex(), and NLAISCRIPT::CConstraintMethode::setOpCode(). |
|
Definition at line 272 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::clone(), and NLAISCRIPT::CConstraintMethode::getColone(). |
|
Definition at line 278 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::setOpCode(), and NLAISCRIPT::CConstraintMethode::~CConstraintMethode(). |
|
Definition at line 271 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::clone(), and NLAISCRIPT::CConstraintMethode::getLine(). |
|
Definition at line 279 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::getfunctionTag(), and NLAISCRIPT::CConstraintMethode::run(). |
|
Hierarchy method name (a hierarchy name is some thing like classBaseName.className.methodName().).
Definition at line 267 of file constraint.h. |
|
Method argument.
Definition at line 269 of file constraint.h. |
|
Definition at line 277 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::clone(), and NLAISCRIPT::CConstraintMethode::run(). |
|
Definition at line 270 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::run(), and NLAISCRIPT::CConstraintMethode::satisfied(). |
|
Definition at line 274 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::getError(), NLAISCRIPT::CConstraintMethode::run(), and NLAISCRIPT::CConstraintMethode::~CConstraintMethode(). |
|
Definition at line 276 of file constraint.h. Referenced by NLAISCRIPT::CConstraintMethode::CConstraintMethode(), NLAISCRIPT::CConstraintMethode::getInfo(), and NLAISCRIPT::CConstraintMethode::~CConstraintMethode(). |
|
Definition at line 275 of file constraint.h. |
|
Type of class that contain the run method.
Definition at line 47 of file constraint_find_run.h. |