#include <constraint.h>
Inheritance diagram for NLAISCRIPT::IConstraint:
This class is a abstract class used for all back prossing work needed for the compiler. Earlier than do multy passing parssing, we chose to push all expression needed to be clarify in a list of IConstraint where its can auto-call them self.
Nevrax France
Definition at line 129 of file constraint.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 } |
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. | |
virtual void | addIndex (int n, CCodeBrancheRun *opcodePtr)=0 |
virtual const IConstraint * | clone () const=0 |
Get a clone pointer memory. | |
sint32 | decRef () |
Decrement the reference of an object. | |
virtual bool | dependOn (const IConstraint *) const=0 |
If this constraint depond on other constraint. | |
virtual int | getColone () const=0 |
get the colone of the expression that it have to be resolve by constraint in the code source. | |
virtual const NLAIC::CIdentType * | getConstraintTypeOf ()=0 |
Type of the expression that it have to be resolve by constraint. | |
virtual void | getDebugString (std::string &t) const |
virtual void | getError (char *) const=0 |
get an error string when the constraint is'nt stisfied. | |
virtual const char * | getInfo ()=0 |
Get a string info. | |
virtual int | getLine () const=0 |
get the line of the expression that it have to be resolve by constraint in the code source. | |
const sint32 & | getRef () const |
get the refence count. | |
virtual ConstraintTypeEnum | getTypeOfClass () const=0 |
get the type of class. the type must be in the ConstraintTypeEnum enumeration. | |
IConstraint () | |
void | incRef () |
Inc a reference. We use this when we have to conserve a pointer memeory for exemple in a list. | |
virtual bool | operator== (const IConstraint &) const=0 |
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 (IConstraint *)=0 |
Run with a IConstraint dependency. | |
virtual void | run (CCompilateur &)=0 |
Run with a CCompilateur dependency. | |
void | runConnexcion () |
When a constraint is resoved,we call all dependency. | |
virtual bool | satisfied ()=0 |
If the constraint is resolved. | |
virtual | ~IConstraint () |
Private Attributes | |
std::list< IConstraint * > | _ConstraintList |
List of constraint dependency. When constraint is resolve it call all constraint contain in this list and run its. |
|
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 173 of file constraint.h.
00173 {} |
|
Definition at line 224 of file constraint.h.
00225 { 00226 } |
|
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 _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. Implemented in NLAISCRIPT::CConstraintMethode, NLAISCRIPT::CConstraintDebug, NLAISCRIPT::CConstraintChkMethodeType, and NLAISCRIPT::IOpType. |
|
|
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 }
|
|
|
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.
Implemented in NLAISCRIPT::CConstraintMethode, NLAISCRIPT::CConstraintDebug, NLAISCRIPT::CConstraintStackComp, NLAISCRIPT::CConstraintChkMethodeType, and NLAISCRIPT::IOpType. Referenced by NLAISCRIPT::CCompilateur::errorMethodConstraint(). |
|
|
|
get an error string when the constraint is'nt stisfied.
Implemented in NLAISCRIPT::CConstraintMethode, NLAISCRIPT::CConstraintDebug, NLAISCRIPT::CConstraintStackComp, NLAISCRIPT::CConstraintChkMethodeType, and NLAISCRIPT::IOpType. Referenced by NLAISCRIPT::CCompilateur::errorMethodConstraint(). |
|
|
get the line of the expression that it have to be resolve by constraint in the code source.
Implemented in NLAISCRIPT::CConstraintMethode, NLAISCRIPT::CConstraintDebug, NLAISCRIPT::CConstraintStackComp, NLAISCRIPT::CConstraintChkMethodeType, and NLAISCRIPT::IOpType. Referenced by NLAISCRIPT::CCompilateur::errorMethodConstraint(). |
|
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 }
|
|
|
|
|
pop the last constaint dependency.
Definition at line 32 of file constraint.cpp. References _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 } |
|
|
|
|
When a constraint is resoved,we call all dependency.
Definition at line 214 of file constraint.h. References _ConstraintList, and 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 } |
|
|
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 } |
|
List of constraint dependency. When constraint is resolve it call all constraint contain in this list and run its.
Definition at line 170 of file constraint.h. Referenced by addConstraint(), popConstraint(), and runConnexcion(). |