[Cmap-cvs] libs/eval eval.cpp,1.1.1.1,1.2 evalImpl.h,1.1.1.1,1.2 parser.h,1.1.1.1,1.2
Status: Beta
Brought to you by:
dyp
From: Denis P. <dy...@us...> - 2004-10-31 09:06:50
|
Update of /cvsroot/cmap/libs/eval In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26307/eval Modified Files: eval.cpp evalImpl.h parser.h Log Message: Integrate eval to cmap. city var now an integer. Only 0 or 1 is used at the moment. WARNING: this version crashes for some unknown reason. Index: eval.cpp =================================================================== RCS file: /cvsroot/cmap/libs/eval/eval.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- eval.cpp 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ eval.cpp 31 Oct 2004 09:06:40 -0000 1.2 @@ -4,33 +4,33 @@ #include "eval.h" #include "evalImpl.h" -void IntAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); +void IntAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, rvalue->getValue(obj, op, numArray)); } -void IntPlusAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, lvalue->getValue(obj, o, numArray) + rvalue->getValue(obj, o, numArray)); +void IntPlusAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, lvalue->getValue(obj, op, numArray) + rvalue->getValue(obj, op, numArray)); } -void StringAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void StringAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, rvalue->getValue(obj, op)); } -void StringPlusAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, lvalue->getValue(obj, o) + rvalue->getValue(obj, o)); +void StringPlusAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, lvalue->getValue(obj, op) + rvalue->getValue(obj, op)); } -void BoolAssign::exec(const void *obj, ObjectProp &o, int numArray) { - lvalue->setValue(o, rvalue->getValue(obj, o, numArray)); +void BoolAssign::exec(const void *obj, ObjectProp &op, int numArray) { + lvalue->setValue(op, rvalue->getValue(obj, op, numArray)); } -void KindAssign::exec(const void *obj, ObjectProp &o, int) { - lvalue->setValue(o, rvalue->getValue(obj, o)); +void KindAssign::exec(const void *obj, ObjectProp &op, int) { + lvalue->setValue(op, rvalue->getValue(obj, op)); } -void Block::exec(const void *obj, ObjectProp &o, int numArray) { +void Block::exec(const void *obj, ObjectProp &op, int numArray) { for (Executable *a = first; a != NULL; a = a->next) - a->exec(obj, o, numArray); + a->exec(obj, op, numArray); } void Block::addAssign(Assign *a) { @@ -53,41 +53,40 @@ } } -void Case::exec(const void *obj, ObjectProp &o, int numArray) { - if (expr->getValue(obj, o, numArray)) - Block::exec(obj, o, numArray); +void Case::exec(const void *obj, ObjectProp &op, int numArray) { + if (expr->getValue(obj, op, numArray)) + Block::exec(obj, op, numArray); } -bool ObjectConf::handle(const void *obj, ObjectProp &o, int numArray) { - memset(&o, 0, sizeof(ObjectProp)); - o.garminType = -1; - o.typePoint = -1; - o.typeLine = -1; - o.typePoly = -1; - o.doExport = true; +bool ObjectConf::handle(const void *obj, ObjectProp &op, int numArray) { + op.garminType = -1; + op.typePoint = -1; + op.typeLine = -1; + op.typePoly = -1; + op.doExport = true; - init(obj, o); + init(obj, op); - block.exec(obj, o, numArray); + block.exec(obj, op, numArray); - if (!o.doExport) + if (!op.doExport) return false; - if (o.garminType != -1) + if (op.garminType != -1) return true; - switch (o.kind) { + switch (op.kind) { case kind::Point: - o.garminType = o.typePoint; + op.garminType = op.typePoint; break; case kind::Line: - o.garminType = o.typeLine; + op.garminType = op.typeLine; break; case kind::Polygon: - o.garminType = o.typePoly; + op.garminType = op.typePoly; break; default: - printf("Unknown object type: '%d'\n", o.kind); + printf("Unknown object type: '%d'\n", op.kind); exit(1); } Index: parser.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/parser.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- parser.h 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ parser.h 31 Oct 2004 09:06:40 -0000 1.2 @@ -40,7 +40,7 @@ KindLVar *parseKindLVar(const std::string &varName); KindExpr *parseKindExpr(); - SetVar *parseSetVar(const std::string &varName); + virtual SetVar *parseSetVar(const std::string &varName); void parseAssign(Block *b, const std::string &varName); void parseBlock(Block *b, ObjectConf *obj = NULL); @@ -52,7 +52,5 @@ Tokenizer &t; }; -void readConfig(const char *filename); - #endif // __CMAP_PARSER_H__ Index: evalImpl.h =================================================================== RCS file: /cvsroot/cmap/libs/eval/evalImpl.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- evalImpl.h 31 Oct 2004 06:03:32 -0000 1.1.1.1 +++ evalImpl.h 31 Oct 2004 09:06:40 -0000 1.2 @@ -18,21 +18,21 @@ virtual ~StringExpr() { } - virtual std::string getValue(const void *obj, const ObjectProp &o) = 0; + virtual std::string getValue(const void *obj, const ObjectProp &op) = 0; }; class StringLVar : public StringExpr { public: - virtual void setValue(ObjectProp &o, const std::string &value) = 0; + virtual void setValue(ObjectProp &op, const std::string &value) = 0; }; class LabelLVar : public StringLVar { - virtual std::string getValue(const void *, const ObjectProp &o) { - return o.label; + virtual std::string getValue(const void *, const ObjectProp &op) { + return op.label; } - virtual void setValue(ObjectProp &o, const std::string &value) { - o.label = value; + virtual void setValue(ObjectProp &op, const std::string &value) { + op.label = value; } }; @@ -59,72 +59,72 @@ virtual ~IntExpr() { } - virtual int getValue(const void *obj, const ObjectProp &o, int numArray) = 0; + virtual int getValue(const void *obj, const ObjectProp &op, int numArray) = 0; }; class IntLVar : public IntExpr { public: - virtual int getValue(const void *obj, const ObjectProp &o, int numArray) = 0; - virtual void setValue(ObjectProp &o, int value) = 0; + virtual int getValue(const void *obj, const ObjectProp &op, int numArray) = 0; + virtual void setValue(ObjectProp &op, int value) = 0; }; class LayerMinVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.layerMin; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.layerMin; } - virtual void setValue(ObjectProp &o, int value) { - o.layerMin = value; + virtual void setValue(ObjectProp &op, int value) { + op.layerMin = value; } }; class LayerMaxVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.layerMax; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.layerMax; } - virtual void setValue(ObjectProp &o, int value) { - o.layerMax = value; + virtual void setValue(ObjectProp &op, int value) { + op.layerMax = value; } }; class PointVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.typePoint; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.typePoint; } - virtual void setValue(ObjectProp &o, int value) { - o.typePoint = value; + virtual void setValue(ObjectProp &op, int value) { + op.typePoint = value; } }; class LineVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.typeLine; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.typeLine; } - virtual void setValue(ObjectProp &o, int value) { - o.typeLine = value; + virtual void setValue(ObjectProp &op, int value) { + op.typeLine = value; } }; class PolygonVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.typePoly; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.typePoly; } - virtual void setValue(ObjectProp &o, int value) { - o.typePoly = value; + virtual void setValue(ObjectProp &op, int value) { + op.typePoly = value; } }; class TypeVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int numArray) { - return o.garminType; + virtual int getValue(const void *, const ObjectProp &op, int numArray) { + return op.garminType; } - virtual void setValue(ObjectProp &o, int value) { - o.garminType = value; + virtual void setValue(ObjectProp &op, int value) { + op.garminType = value; } }; @@ -155,7 +155,7 @@ } } - virtual void exec(const void *obj, ObjectProp &o, int numArray) = 0; + virtual void exec(const void *obj, ObjectProp &op, int numArray) = 0; Executable *next; }; @@ -179,12 +179,12 @@ delete rvalue; }; - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class StringPlusAssign : public StringAssign { public: - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class IntAssign : public Assign { @@ -197,12 +197,12 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class IntPlusAssign : public IntAssign { public: - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class BoolExpr { @@ -210,12 +210,12 @@ virtual ~BoolExpr() { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) = 0; + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) = 0; }; class BoolLVar : public BoolExpr { public: - virtual void setValue(ObjectProp &o, bool value) = 0; + virtual void setValue(ObjectProp &op, bool value) = 0; }; class BoolConst : public BoolExpr { @@ -231,32 +231,32 @@ }; class ExportVar : public BoolLVar { - virtual bool getValue(const void *, const ObjectProp &o, int) { - return o.doExport; + virtual bool getValue(const void *, const ObjectProp &op, int) { + return op.doExport; } - virtual void setValue(ObjectProp &o, bool value) { - o.doExport = value; + virtual void setValue(ObjectProp &op, bool value) { + op.doExport = value; } }; class IndexVar : public BoolLVar { - virtual bool getValue(const void *, const ObjectProp &o, int) { - return o.index; + virtual bool getValue(const void *, const ObjectProp &op, int) { + return op.index; } - virtual void setValue(ObjectProp &o, bool value) { - o.index = value; + virtual void setValue(ObjectProp &op, bool value) { + op.index = value; } }; class CityVar : public IntLVar { - virtual int getValue(const void *, const ObjectProp &o, int) { - return o.city; + virtual int getValue(const void *, const ObjectProp &op, int) { + return op.city; } - virtual void setValue(ObjectProp &o, int value) { - o.city = value; + virtual void setValue(ObjectProp &op, int value) { + op.city = value; } }; @@ -269,8 +269,8 @@ delete expr; } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return !expr->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return !expr->getValue(obj, op, numArray); } BoolExpr *expr; @@ -286,7 +286,7 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); }; class BinaryIntExpr : public BoolExpr { @@ -308,8 +308,8 @@ EQIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) == expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) == expr2->getValue(obj, op, numArray); } }; @@ -318,8 +318,8 @@ NEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) != expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) != expr2->getValue(obj, op, numArray); } }; @@ -328,8 +328,8 @@ GEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) >= expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) >= expr2->getValue(obj, op, numArray); } }; @@ -338,8 +338,8 @@ GTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) > expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) > expr2->getValue(obj, op, numArray); } }; @@ -348,8 +348,8 @@ LEIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) <= expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) <= expr2->getValue(obj, op, numArray); } }; @@ -358,8 +358,8 @@ LTIntExpr(IntExpr *_expr1, IntExpr *_expr2) : BinaryIntExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - return expr1->getValue(obj, o, numArray) < expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + return expr1->getValue(obj, op, numArray) < expr2->getValue(obj, op, numArray); } }; @@ -382,8 +382,8 @@ EQStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) == expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) == expr2->getValue(obj, op); } }; @@ -392,8 +392,8 @@ NEStringExpr(StringExpr *_expr1, StringExpr *_expr2) : BinaryStringExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) != expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) != expr2->getValue(obj, op); } }; @@ -424,8 +424,8 @@ InExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - int index = expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + int index = expr2->getValue(obj, op, numArray); // assert(index < 120); return expr1->getIn(obj, index); } @@ -436,8 +436,8 @@ NotInExpr(SetVar *_expr1, IntExpr *_expr2) : BinarySetExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int numArray) { - int index = expr2->getValue(obj, o, numArray); + virtual bool getValue(const void *obj, const ObjectProp &op, int numArray) { + int index = expr2->getValue(obj, op, numArray); // assert(index < 120); return !expr1->getIn(obj, index); } @@ -448,7 +448,7 @@ virtual ~KindExpr() { } - virtual Kind getValue(const void *obj, const ObjectProp &o) = 0; + virtual Kind getValue(const void *obj, const ObjectProp &op) = 0; }; class KindConst : public KindExpr { @@ -465,16 +465,16 @@ class KindLVar : public KindExpr { public: - virtual void setValue(ObjectProp &o, const Kind value) = 0; + virtual void setValue(ObjectProp &op, const Kind value) = 0; }; class KindVar : public KindLVar { - virtual Kind getValue(const void *, const ObjectProp &o) { - return o.kind; + virtual Kind getValue(const void *, const ObjectProp &op) { + return op.kind; } - virtual void setValue(ObjectProp &o, const Kind value) { - o.kind = value; + virtual void setValue(ObjectProp &op, const Kind value) { + op.kind = value; } }; @@ -488,7 +488,7 @@ delete rvalue; } - virtual void exec(const void *obj, ObjectProp &o, int); + virtual void exec(const void *obj, ObjectProp &op, int); }; class BinaryKindExpr : public BoolExpr { @@ -510,8 +510,8 @@ EQKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) == expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) == expr2->getValue(obj, op); } }; @@ -520,8 +520,8 @@ NEKindExpr(KindExpr *_expr1, KindExpr *_expr2) : BinaryKindExpr(_expr1, _expr2) { } - virtual bool getValue(const void *obj, const ObjectProp &o, int) { - return expr1->getValue(obj, o) != expr2->getValue(obj, o); + virtual bool getValue(const void *obj, const ObjectProp &op, int) { + return expr1->getValue(obj, op) != expr2->getValue(obj, op); } }; @@ -540,7 +540,7 @@ } } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); void addAssign(Assign *a); void addCase(Case *a); @@ -557,7 +557,7 @@ delete expr; } - virtual void exec(const void *obj, ObjectProp &o, int numArray); + virtual void exec(const void *obj, ObjectProp &op, int numArray); BoolExpr *expr; }; @@ -567,7 +567,7 @@ ObjectConf() : typePoint(-1), typeLine(-1), typePoly(-1), next(NULL) { } - bool handle(const void *obj, ObjectProp &o, int numArray); + bool handle(const void *obj, ObjectProp &op, int numArray); // std::string object_cod; // êîä @@ -580,7 +580,7 @@ ObjectConf *next; // virtual bool check(const void *obj) = 0; - virtual void init(const void *obj, ObjectProp &o) = 0; + virtual void init(const void *obj, ObjectProp &op) = 0; }; #endif |