#include <type_def.h>
Inheritance diagram for NLAISCRIPT::COperandUnknown:
This class define an unknow type. type is an IConstraint that we have to resolve it.
Nevrax France
Definition at line 459 of file type_def.h.
Public Types | |
enum | ConstraintTypeEnum { constraintMethode, constraintChkMethodeType, operandSimple, operandSimpleListOr, operandAnyObject, operandVoid, operandUnknown, operationType, operationTypeGD, operandListType, constraintStackComp, constraintDebug, constraintFindRun } |
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. | |
const IConstraint * | clone () const |
Get a clone pointer memory. | |
COperandUnknown (IConstraint *constraint) | |
sint32 | decRef () |
Decrement the reference of an object. | |
bool | dependOn (const IConstraint *c) const |
If this constraint depond on other constraint. | |
const NLAIC::CIdentType * | getConstraintTypeOf () |
Type of the expression that it have to be resolve by constraint. | |
virtual void | getDebugString (std::string &t) const |
const char * | getInfo () |
Get a string info. | |
const sint32 & | getRef () const |
get the refence count. | |
virtual 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. | |
bool | operator== (const IConstraint &c) const |
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. | |
void | run (IConstraint *c) |
Run with a IConstraint dependency. | |
void | run (CCompilateur &c) |
Run with a CCompilateur dependency. | |
void | runConnexcion () |
When a constraint is resoved,we call all dependency. | |
bool | satisfied () |
If the constraint is resolved. | |
virtual void | serial (NLMISC::IStream &f) throw (NLMISC::EStream) |
virtual | ~COperandUnknown () |
Static Public Member Functions | |
const IOpType * | loadIOpType (NLMISC::IStream &f) |
Loader for IOpType. Not that we save and load an know type. | |
Private Attributes | |
IConstraint * | _Constraint |
NLAIC::CIdentType * | _Id |
bool | _RunIsDone |
char * | _TxtInfo |
|
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 }; |
|
Definition at line 468 of file type_def.h. References NLAISCRIPT::IConstraint::addConstraint(), and NLAISCRIPT::IConstraint::getInfo(). Referenced by clone().
00468 :_Constraint(constraint),_Id(NULL) 00469 { 00470 char txt[1028*8]; 00471 sprintf(txt,"constraint<COperandUnknown> for %s",_Constraint->getInfo()); 00472 _TxtInfo = new char [strlen(txt) + 1]; 00473 strcpy(_TxtInfo,txt); 00474 _Constraint->addConstraint(this); 00475 _RunIsDone = false; 00476 } |
|
Definition at line 552 of file type_def.h. References NLAISCRIPT::IConstraint::popConstraint(), and NLAIC::IPointerGestion::release().
00553 { 00554 if (_Constraint != NULL) 00555 { 00556 if(!_RunIsDone) _Constraint->popConstraint(this); 00557 00558 _Constraint->release(); 00559 _Constraint = NULL; 00560 00561 } 00562 delete _TxtInfo; 00563 } |
|
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 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 55 of file type_def.h.
00055 {} |
|
Get a clone pointer memory.
Implements NLAISCRIPT::IConstraint. Definition at line 502 of file type_def.h. References NLAISCRIPT::IConstraint::clone(), COperandUnknown(), and x.
00503 { 00504 IConstraint *x = new COperandUnknown((IConstraint *)_Constraint->clone()); 00505 return x; 00506 } |
|
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 538 of file type_def.h. References NLAISCRIPT::IConstraint::dependOn().
00539 { 00540 return _Constraint == c || _Constraint->dependOn(c); 00541 } |
|
Reimplemented in NLAISCRIPT::COperandSimpleListOr. Definition at line 76 of file type_def.cpp. References NLAISCRIPT::IOpType::evalParam(), NLAISCRIPT::IConstraint::getConstraintTypeOf(), NLAISCRIPT::IConstraint::getTypeOfClass(), NLAISCRIPT::l, and x. Referenced by NLAISCRIPT::CParam::eval().
00077 { 00078 if(getConstraintTypeOf() != NULL && e->getConstraintTypeOf() != NULL) 00079 { 00080 if(e->getTypeOfClass() == operandSimpleListOr) 00081 { 00082 COperandSimpleListOr *l = (COperandSimpleListOr *)e; 00083 std::list<NLAIC::CIdentType *>::const_iterator i = l->getList().begin(); 00084 while(i != l->getList().end() ) 00085 { 00086 COperandSimple *x =new COperandSimple (new NLAIC::CIdentType(*(*i++))); 00087 double d = evalParam(x); 00088 delete x; 00089 if(d >= 0.0) return d; 00090 } 00091 00092 } 00093 else return evalParam(e); 00094 } 00095 return -1.0; 00096 } |
|
Definition at line 34 of file type_def.cpp. References NLAISCRIPT::IClassInterpret::getComputeBaseClass(), NLAISCRIPT::IConstraint::getConstraintTypeOf(), NLAIC::CIdentType::getFactory(), NLAISCRIPT::IClassInterpret::getType(), and type. Referenced by NLAISCRIPT::IOpType::eval().
00035 { 00036 double d; 00037 if(e->getConstraintTypeOf() != NULL) 00038 { 00039 const NLAIC::CIdentType &idG = *getConstraintTypeOf(); 00040 const NLAIC::CIdentType &idD = *e->getConstraintTypeOf(); 00041 if(!(idG == idD)) 00042 { 00043 if(((const NLAIC::CTypeOfObject &)idD) & NLAIC::CTypeOfObject::tInterpret ) 00044 { 00045 IClassInterpret *o = (IClassInterpret *)((CClassInterpretFactory *)idD.getFactory())->getClass(); 00046 bool type = false; 00047 d = 0.0; 00048 while(o != NULL) 00049 { 00050 if( o->getType() == idG) 00051 { 00052 d += 1.0; 00053 type = true; 00054 break; 00055 } 00056 o = (IClassInterpret *)o->getComputeBaseClass(); 00057 } 00058 if(!type) return -1.0; 00059 else return d; 00060 } 00061 else 00062 { 00063 //NLAIC::CTypeOfObject o_t(tNombre | TString | tList | tLogic); 00064 if(((const NLAIC::CTypeOfObject &)idD) & ((const NLAIC::CTypeOfObject &)idG)) 00065 { 00066 return 0.0; 00067 } 00068 else return -1.0; 00069 } 00070 } 00071 else return 0.0; 00072 } 00073 else return -1.0; 00074 } |
|
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. Reimplemented in NLAISCRIPT::CConstraintStackComp. Definition at line 58 of file type_def.h.
00058 {return 0;}
|
|
Type of the expression that it have to be resolve by constraint.
Implements NLAISCRIPT::IConstraint. Definition at line 493 of file type_def.h. References NLAISCRIPT::IConstraint::getConstraintTypeOf(). Referenced by satisfied().
00494 { 00495 if(_Id == NULL) 00496 { 00497 _Id = (NLAIC::CIdentType *)_Constraint->getConstraintTypeOf(); 00498 } 00499 return _Id; 00500 } |
|
|
get an error string when the constraint is'nt stisfied.
Implements NLAISCRIPT::IConstraint. Reimplemented in NLAISCRIPT::CConstraintStackComp. Definition at line 56 of file type_def.h.
00056 {} |
|
Get a string info.
Implements NLAISCRIPT::IConstraint. Definition at line 488 of file type_def.h.
00489 { 00490 return _TxtInfo; 00491 } |
|
get the line of the expression that it have to be resolve by constraint in the code source.
Implements NLAISCRIPT::IConstraint. Reimplemented in NLAISCRIPT::CConstraintStackComp. Definition at line 57 of file type_def.h.
00057 { return 0;}
|
|
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.
Implements NLAISCRIPT::IConstraint. Definition at line 542 of file type_def.h. Referenced by operator==().
00543 { 00544 return operandUnknown; 00545 } |
|
|
Loader for IOpType. Not that we save and load an know type.
Definition at line 982 of file type_def.h. References NLMISC::IStream::serial(), sint32, and x.
00983 { 00984 IConstraint::ConstraintTypeEnum k = constraintMethode; 00985 IOpType *x; 00986 00987 f.serial((sint32 &)k); 00988 00989 switch(k) 00990 { 00991 case operandAnyObject: 00992 x = new COperandAnyObject(); 00993 return x; 00994 00995 case operandVoid: 00996 x = new COperandVoid(); 00997 return x; 00998 00999 case operandSimple: 01000 x = new COperandSimple(f); 01001 return x; 01002 01003 case operandSimpleListOr: 01004 x = new COperandSimpleListOr(f); 01005 return x; 01006 default: break; 01007 } 01008 return NULL; 01009 } |
|
Implements NLAISCRIPT::IConstraint. Definition at line 529 of file type_def.h. References NLAISCRIPT::IConstraint::getTypeOfClass(), and getTypeOfClass().
00530 { 00531 if(getTypeOfClass() == c.getTypeOfClass() && *((const COperandUnknown &)c)._Constraint == *_Constraint) 00532 { 00533 return true; 00534 } 00535 return false; 00536 } |
|
pop the last constaint dependency.
Definition at line 32 of file constraint.cpp. References NLAISCRIPT::IConstraint::_ConstraintList. Referenced by ~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.
Reimplemented from NLAISCRIPT::IOpType. Definition at line 517 of file type_def.h. References NLAISCRIPT::IConstraint::getConstraintTypeOf(), and satisfied().
00518 { 00519 if(c == _Constraint) 00520 { 00521 _Id = (NLAIC::CIdentType *)_Constraint->getConstraintTypeOf(); 00522 if(satisfied()) 00523 { 00524 _RunIsDone = true; 00525 } 00526 } 00527 } |
|
Run with a CCompilateur dependency.
Reimplemented from NLAISCRIPT::IOpType. Definition at line 508 of file type_def.h. References NLAISCRIPT::IConstraint::run().
00509 { 00510 if(_Id == NULL) 00511 { 00512 _Constraint->run(c); 00513 run(_Constraint); 00514 } 00515 } |
|
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(), NLAISCRIPT::CConstraintFindRun::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 547 of file type_def.h. References getConstraintTypeOf(). Referenced by run().
00548 { 00549 return getConstraintTypeOf() != NULL; 00550 } |
|
Reimplemented from NLAIC::IPointerGestion. Definition at line 478 of file type_def.h. References NLAISCRIPT::COperandSimple::serial().
00479 { 00480 if(_Id != NULL) 00481 { 00482 COperandSimple n(new NLAIC::CIdentType (*_Id)); 00483 n.serial(f); 00484 } 00485 else throw NLMISC::EStream(); 00486 } |
|
Definition at line 462 of file type_def.h. |
|
Definition at line 463 of file type_def.h. |
|
Definition at line 465 of file type_def.h. |
|
Definition at line 464 of file type_def.h. |