#include <PfcParser.h>
Collaboration diagram for Parser:
Public Member Functions | |
~Parser () | |
Destructor. | |
void | parse (PotentialfieldComposition *composition, std::string filename) |
Executes the parser. | |
Private Member Functions | |
std::string | nextToken () |
Returns the next token from file. | |
char | nextChar () |
Returns one character from file. | |
bool | endOfFile () |
Tests for the end of the file. | |
double | parseAngle () |
Parses an angle. | |
void | parseComposition () |
Parses parameters for PotentialfieldComposition. | |
Object * | parseObject () |
Parses an object. | |
void | parseAndInsertObject () |
Parses an object and inserts it in the object list. | |
void | parseObjectStateSymbol () |
Parses an ObjectStateSymbol. | |
void | parseInstanceGroup () |
Parses a group of instances. | |
void | parseInstance () |
Parses the instance of an object. | |
void | parseFormationObject () |
Parses a formation object. | |
void | parseSingleFormation (SingleFormation *&formation, const std::string &formationToken) |
Parses and creates single formation rule for a formation. | |
void | parseMotionfield () |
Parses a Motionfield. | |
void | parseTransformation (PotentialfieldTransformation *&transformation, const std::string &typeToken) |
Parses and creates a transformation. | |
void | parseAction (Action &action) |
Parses an Action for an Actionfield. | |
void | parseActionfield () |
Parses an Actionfield. | |
void | parseFunction (PotentialfieldFunction *&function) |
Parses and creates a function. | |
void | parseGeometricObject (PfieldGeometricObject *&geometricObject, const std::string &preparsedToken="") |
Parses and creates a geometric object. | |
void | parseObjectsForField (const std::string &nameOfFirst, Potentialfield *field) |
Parses a list of object references. | |
void | parseTimeConstraintsForField (Potentialfield *field) |
Parses some timing variables for a field. | |
void | addGroupToField (const std::string &groupName, Potentialfield *field) |
Adds the elements of an object group to a field. | |
Object * | getObject (const std::string &name) |
Finds an object given its name. | |
Object * | getInstance (const std::string &name) |
Finds an object given its name and creates an instance. | |
Private Attributes | |
InBinaryFile * | file |
A file object. | |
std::string | currentToken |
The last parsed token. | |
std::vector< Object * > | objects |
Parsed objects. | |
NameToIndexMap | objectMap |
Fast mapping from name to index. | |
std::vector< InstanceGroup > | instanceGroups |
The cached instance groups. | |
PotentialfieldComposition * | composition |
The calling PotentialfieldComposition. |
Definition at line 56 of file PfcParser.h.
|
Destructor.
Definition at line 63 of file PfcParser.cpp. References instanceGroups. |
|
Executes the parser.
Definition at line 858 of file PfcParser.cpp. References endOfFile(), nextToken(), parseActionfield(), parseAndInsertObject(), parseComposition(), parseFormationObject(), parseInstance(), parseInstanceGroup(), parseMotionfield(), and parseObjectStateSymbol(). Referenced by PotentialfieldComposition::load(). |
Here is the call graph for this function:
|
Returns the next token from file.
Definition at line 97 of file PfcParser.cpp. References endOfFile(), and nextChar(). Referenced by parse(), parseAction(), parseActionfield(), parseAngle(), parseComposition(), parseFormationObject(), parseFunction(), parseGeometricObject(), parseInstance(), parseInstanceGroup(), parseMotionfield(), parseObject(), parseObjectsForField(), parseObjectStateSymbol(), parseSingleFormation(), parseTimeConstraintsForField(), and parseTransformation(). |
Here is the call graph for this function:
|
Returns one character from file.
Definition at line 75 of file PfcParser.cpp. Referenced by nextToken(). |
|
Tests for the end of the file.
Definition at line 87 of file PfcParser.cpp. Referenced by nextToken(), and parse(). |
|
Parses an angle.
Definition at line 115 of file PfcParser.cpp. References nextToken(), pi_180, and toDouble(). Referenced by parseInstance(), parseMotionfield(), parseObject(), parseSingleFormation(), and parseTransformation(). |
Here is the call graph for this function:
|
Parses parameters for PotentialfieldComposition.
Definition at line 843 of file PfcParser.cpp. References BEST_OF_N, composition, nextToken(), PotentialfieldComposition::setFieldSelectionParameters(), SUCCESSIVE_N_TIMES, and toInt(). Referenced by parse(). |
Here is the call graph for this function:
|
Parses an object.
Definition at line 317 of file PfcParser.cpp. References ATTRACTIVE, CLOCKWISE, composition, COUNTER_CLOCKWISE, Sector::crossFunction, nextToken(), ObjectType, Sector::openingAngle, parseAngle(), parseFunction(), parseGeometricObject(), POINT_FIELD, REPULSIVE, SECTOR_FIELD, Object::setField(), Object::setFunction(), Object::setGeometry(), Object::setPfieldCompositionRef(), PotentialfieldFunction::setSmoothingParameters(), Object::setTangentialField(), SHAPE_FIELD, and toDouble(). Referenced by parseAndInsertObject(), and parseMotionfield(). |
Here is the call graph for this function:
|
Parses an object and inserts it in the object list.
Definition at line 384 of file PfcParser.cpp. References Object::getName(), objectMap, and parseObject(). Referenced by parse(). |
Here is the call graph for this function:
|
Parses an ObjectStateSymbol.
Definition at line 293 of file PfcParser.cpp. References PotentialfieldComposition::addDynamicObjectState(), composition, and nextToken(). Referenced by parse(). |
Here is the call graph for this function:
|
Parses a group of instances.
Definition at line 300 of file PfcParser.cpp. References getInstance(), instanceGroups, InstanceGroup::name, nextToken(), and InstanceGroup::objects. Referenced by parse(). |
Here is the call graph for this function:
|
Parses the instance of an object.
Definition at line 392 of file PfcParser.cpp. References PotentialfieldComposition::addObject(), composition, PotentialfieldComposition::getIdFromObjectStateSymbol(), nextToken(), objectMap, parseAngle(), PfPose::pos, PfPose::rotation, Object::setActivation(), Object::setPose(), Object::setStatic(), toDouble(), PfVec::x, and PfVec::y. Referenced by parse(). |
Here is the call graph for this function:
|
Parses a formation object.
Definition at line 478 of file PfcParser.cpp. References BestFitFormation::addFormation(), PotentialfieldComposition::addObject(), FormationObject::addSingleFormation(), composition, nextToken(), parseSingleFormation(), SELECT_MAX_GRADIENT, SELECT_MAX_PRIORITY, SELECT_MIN_DISTANCE, SELECT_MIN_GRADIENT, and BestFitFormation::setBestFitSelection(). Referenced by parse(). |
Here is the call graph for this function:
|
Parses and creates single formation rule for a formation.
Definition at line 423 of file PfcParser.cpp. References ABSOLUTE_FORMATION, SingleFormation::addObject(), getInstance(), SingleFormation::init(), instanceGroups, nextToken(), parseAngle(), parseFunction(), RELATIVE_FORMATION, SingleFormation::setFunction(), RelativeFormation::setParameters(), SingleFormation::setPriority(), and toDouble(). Referenced by parseFormationObject(). |
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Parses and creates a transformation.
Definition at line 635 of file PfcParser.cpp. References Translation::alongGradient, Rotation::angle, getInstance(), Translation::maxGradientDeviation, Translation::maxLength, nextToken(), parseAngle(), Rotation::speed, Translation::speed, Translation::stepLength, PotentialfieldTransformation::time, toDouble(), Rotation::toGradient, Rotation::toObject, Translation::toObject, Translation::translation, PfVec::x, and PfVec::y. Referenced by parseAction(). |
Here is the call graph for this function:
|
Parses an Action for an Actionfield.
Definition at line 711 of file PfcParser.cpp. References Action::actionType, getInstance(), Action::impactAreas, Action::joinAction, Action::manipulatedObject, MEASURE_OBJECT, MEASURE_SELF, MOVE_OBJECT, MOVE_SELF, nextToken(), parseGeometricObject(), parseTransformation(), PotentialfieldTransformation::probability, PotentialfieldTransformation::time, toBool(), toDouble(), and Action::transformations. Referenced by parseActionfield(). |
Here is the call graph for this function:
|
Here is the call graph for this function:
|
Parses and creates a function.
Definition at line 179 of file PfcParser.cpp. References nextToken(), PotentialfieldFunction::setSmoothingParameters(), and toDouble(). Referenced by parseObject(), and parseSingleFormation(). |
Here is the call graph for this function:
|
Parses and creates a geometric object.
Definition at line 121 of file PfcParser.cpp. References Polygon::addPoint(), NoGeometry::initRadiusOfCollisionCircle(), Circle::initRadiusOfCollisionCircle(), Polygon::initRadiusOfCollisionCircle(), Line::initRadiusOfCollisionCircle(), PfieldGeometricObject::intersectable, Line, nextToken(), Line::p1, Line::p2, Circle::radius, toBool(), toDouble(), PfVec::x, and PfVec::y. Referenced by parseAction(), and parseObject(). |
Here is the call graph for this function:
|
Parses a list of object references.
Definition at line 247 of file PfcParser.cpp. References addGroupToField(), Potentialfield::addObject(), getInstance(), and nextToken(). Referenced by parseActionfield(), and parseMotionfield(). |
Here is the call graph for this function:
|
Parses some timing variables for a field.
Definition at line 528 of file PfcParser.cpp. References ChangeType, KEEP_FIELD, KEEP_RESULT, KeepType, nextToken(), Potentialfield::setTimeConstraints(), toChangeType(), and toInt(). Referenced by parseActionfield(), and parseMotionfield(). |
Here is the call graph for this function:
|
Adds the elements of an object group to a field.
Definition at line 274 of file PfcParser.cpp. References Potentialfield::addObject(), and instanceGroups. Referenced by parseObjectsForField(). |
Here is the call graph for this function:
|
Finds an object given its name.
|
|
Finds an object given its name and creates an instance.
Definition at line 238 of file PfcParser.cpp. References composition, PotentialfieldComposition::objectMap, and PotentialfieldComposition::objects. Referenced by parseAction(), parseInstanceGroup(), parseMotionfield(), parseObjectsForField(), parseSingleFormation(), and parseTransformation(). |
|
A file object.
Definition at line 71 of file PfcParser.h. |
|
The last parsed token.
Definition at line 77 of file PfcParser.h. |
|
Parsed objects.
Definition at line 79 of file PfcParser.h. |
|
Fast mapping from name to index.
Definition at line 81 of file PfcParser.h. Referenced by parseAndInsertObject(), and parseInstance(). |
|
The cached instance groups.
Definition at line 83 of file PfcParser.h. Referenced by addGroupToField(), parseInstanceGroup(), parseSingleFormation(), and ~Parser(). |
|
The calling PotentialfieldComposition.
Definition at line 85 of file PfcParser.h. Referenced by getInstance(), parseActionfield(), parseComposition(), parseFormationObject(), parseInstance(), parseMotionfield(), parseObject(), and parseObjectStateSymbol(). |