#include <type_def.h>
Inheritance diagram for NLAISCRIPT::COperandSimpleListOr:
Nevrax France
Definition at line 315 of file type_def.h.
Redefinition of base class method | |
virtual void | addIndex (int i, CCodeBrancheRun *) |
double | evalParam (IOpType *) |
virtual int | getColone () const |
get the colone of the expression that it have to be resolve by constraint in the code source. | |
virtual void | getError (char *) const |
get an error string when the constraint is'nt stisfied. | |
virtual int | getLine () const |
get the line of the expression that it have to be resolve by constraint in the code source. | |
virtual void | run (CCompilateur &) |
Run with a CCompilateur dependency. | |
virtual void | run (IConstraint *) |
Run with a IConstraint dependency. | |
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. | |
COperandSimpleListOr (int count,...) | |
COperandSimpleListOr (const std::list< NLAIC::CIdentType * > &l) | |
COperandSimpleListOr (NLMISC::IStream &f) | |
sint32 | decRef () |
Decrement the reference of an object. | |
bool | dependOn (const IConstraint *) const |
If this constraint depond on other constraint. | |
virtual double | eval (IOpType *) |
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 std::list< NLAIC::CIdentType * > & | getList () const |
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 | 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 | ~COperandSimpleListOr () |
Static Public Member Functions | |
const IOpType * | loadIOpType (NLMISC::IStream &f) |
Loader for IOpType. Not that we save and load an know type. | |
Private Attributes | |
char * | _TxtInfo |
std::list< NLAIC::CIdentType * > | _TypeListe |
|
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 323 of file type_def.h. References serial(). Referenced by clone().
00324 { 00325 serial(f); 00326 } |
|
Definition at line 328 of file type_def.h. References _TypeListe, and NLAISCRIPT::l.
00329 { 00330 char txt[1028*8]; 00331 sprintf(txt,"constraint<COperandSimpleListOr> for ..."); 00332 _TxtInfo = new char [strlen(txt) + 1]; 00333 strcpy(_TxtInfo,txt); 00334 00335 std::list<NLAIC::CIdentType *>::const_iterator i = l.begin(); 00336 while(i != l.end()) 00337 { 00338 _TypeListe.push_back(new NLAIC::CIdentType(*(*i++))); 00339 } 00340 } |
|
Definition at line 131 of file type_def.cpp. References _TypeListe, count, and NLAIC::stringGetBuild().
00132 { 00133 va_list marker; 00134 00135 va_start( marker, count ); 00136 while(count --) 00137 { 00138 NLAIC::CIdentType *o = va_arg( marker, NLAIC::CIdentType *); 00139 _TypeListe.push_back(o); 00140 } 00141 std::string text; 00142 text = NLAIC::stringGetBuild("constraint<COperandSimpleListOr> for ..."); 00143 _TxtInfo = new char [strlen(text.c_str()) + 1]; 00144 strcpy(_TxtInfo,text.c_str()); 00145 } |
|
Definition at line 438 of file type_def.h. References _TypeListe.
00439 { 00440 while(_TypeListe.size()) 00441 { 00442 delete _TypeListe.back(); 00443 _TypeListe.pop_back(); 00444 } 00445 delete _TxtInfo; 00446 } |
|
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 55 of file type_def.h.
00055 {} |
|
Get a clone pointer memory.
Implements NLAISCRIPT::IConstraint. Definition at line 387 of file type_def.h. References _TypeListe, COperandSimpleListOr(), and x.
00388 { 00389 IConstraint *x = new COperandSimpleListOr(_TypeListe); 00390 return x; 00391 } |
|
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 382 of file type_def.h.
00383 { 00384 return false; 00385 } |
|
Reimplemented from NLAISCRIPT::IOpType. Definition at line 147 of file type_def.cpp.
00148 { 00149 std::list<NLAIC::CIdentType *>::const_iterator i = getList().begin(); 00150 while(i != getList().end() ) 00151 { 00152 //NLAIC::CIdentType id(*(*i++)); 00153 COperandSimple x(*i); 00154 (*i)->incRef(); 00155 double d = x.eval(e); 00156 i ++; 00157 if(d >= 0.0) return d; 00158 } 00159 return -1.0; 00160 } |
|
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 354 of file type_def.h. References _TypeListe.
00355 { 00356 return _TypeListe.back(); 00357 } |
|
|
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 349 of file type_def.h.
00350 { 00351 return _TxtInfo; 00352 } |
|
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;}
|
|
Definition at line 344 of file type_def.h. References _TypeListe. Referenced by eval().
00345 { 00346 return _TypeListe; 00347 } |
|
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 359 of file type_def.h. Referenced by operator==(), and serial().
00360 { 00361 return operandSimpleListOr; 00362 } |
|
|
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 364 of file type_def.h. References _TypeListe, NLAISCRIPT::IConstraint::getTypeOfClass(), getTypeOfClass(), and NLAISCRIPT::l.
00365 { 00366 if(getTypeOfClass() == c.getTypeOfClass()) 00367 { 00368 const COperandSimpleListOr &l = (const COperandSimpleListOr &)c; 00369 if(l._TypeListe.size() != _TypeListe.size()) return false; 00370 00371 std::list<NLAIC::CIdentType *>::const_iterator i = _TypeListe.begin(); 00372 std::list<NLAIC::CIdentType *>::const_iterator j = l._TypeListe.begin(); 00373 while(i != _TypeListe.end()) 00374 { 00375 if(!((*i++) == (*j++))) return false; 00376 } 00377 return true; 00378 } 00379 return false; 00380 } |
|
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 CCompilateur dependency.
Implements NLAISCRIPT::IConstraint. Reimplemented in NLAISCRIPT::CConstraintStackComp, NLAISCRIPT::COperandUnknown, NLAISCRIPT::COperationType, NLAISCRIPT::COperationTypeGD, and NLAISCRIPT::COperandListType. Definition at line 54 of file type_def.h.
00054 {} |
|
Run with a IConstraint dependency.
Implements NLAISCRIPT::IConstraint. Reimplemented in NLAISCRIPT::CConstraintStackComp, NLAISCRIPT::COperandUnknown, NLAISCRIPT::COperationType, and NLAISCRIPT::COperationTypeGD. Definition at line 53 of file type_def.h. Referenced by NLAISCRIPT::COperandListType::run(), NLAISCRIPT::COperationTypeGD::run(), NLAISCRIPT::COperationType::run(), and NLAISCRIPT::CConstraintStackComp::run().
00053 {} |
|
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 393 of file type_def.h.
00394 { 00395 return true; 00396 } |
|
Reimplemented from NLAIC::IPointerGestion. Definition at line 398 of file type_def.h. References _TypeListe, getTypeOfClass(), and sint32. Referenced by COperandSimpleListOr().
00399 { 00400 if ( f.isReading() ) 00401 { 00402 while(_TypeListe.size()) 00403 { 00404 delete _TypeListe.back(); 00405 _TypeListe.pop_back(); 00406 } 00407 00408 00409 sint32 i; 00410 f.serial(i); 00411 while(i --) 00412 { 00413 NLAIC::CIdentType *ident = new NLAIC::CIdentType(f); 00414 _TypeListe.push_back(ident); 00415 } 00416 delete _TxtInfo; 00417 char txt[1028*8]; 00418 sprintf(txt,"constraint<COperandSimpleListOr> for ..."); 00419 _TxtInfo = new char [strlen(txt) + 1]; 00420 strcpy(_TxtInfo,txt); 00421 } 00422 else 00423 { 00424 sint32 n = (sint32)getTypeOfClass(); 00425 f.serial(n); 00426 n = _TypeListe.size(); 00427 f.serial(n); 00428 std::list<NLAIC::CIdentType *>::iterator i = _TypeListe.begin(); 00429 while(i != _TypeListe.end()) 00430 { 00431 (*i++)->serial(f); 00432 } 00433 } 00434 } |
|
Definition at line 320 of file type_def.h. |
|
Definition at line 318 of file type_def.h. Referenced by clone(), COperandSimpleListOr(), getConstraintTypeOf(), getList(), operator==(), serial(), and ~COperandSimpleListOr(). |