- Main Page
- Modules
- Classes
- Files
- Related Pages

- File List
- File Members

# src/typedefs.h

Go to the documentation of this file.

    00001 #ifndef TYPEDEFS_H_
    00002 #define TYPEDEFS_H_
    00003
    00004 #include <map>
    00005 #include <vector>
    00006 #include <deque>
    00007
    00008 #include "config.h"
    00009 #include <ode/ode.h>
    00010 #include "AssertionException.h"
    00011 #include "vectorMath/vmath.h"
    00012
    00014 #define mASSERT(a) if (!(a)) {\
    00015     _FATAL("Assertion \"" #a "\" failed");\
    00016     throw AssertionException("assertion \"" #a "\" failed");\
    00017 }
    00018
    00020 typedef Vector2<dReal> Vector2r;
    00021 typedef Vector3<dReal> Vector3r;
    00022 typedef Vector4<dReal> Vector4r;
    00023 typedef Matrix3<dReal> Matrix3r;
    00024 typedef Matrix4<dReal> Matrix4r;
    00025 typedef Quaternion<dReal> Quatr;
    00026
    00028 typedef struct PVector3r {
    00030     Vector3r _pos;
    00032     Vector3r _dir;
    00033     PVector3r(const Vector3r &pos, const Vector3r &dir): _pos(pos), _dir(dir) {};
    00034 } PVector3r;
    00035 std::ostream& operator<<(std::ostream &oss, const PVector3r &p);
    00036 std::ostream& operator<<(std::ostream &oss, const PVector3r* p);
    00037
    00039 typedef struct ViewPoint {
    00041     float _xyz[3];
    00043     float _hpr[3];
    00044 } ViewPoint;
    00046 typedef std::vector<ViewPoint> ViewPointVector;
    00047
    00048 class SimulationObject;
    00050 typedef std::map<int, SimulationObject*> SOContainer;
    00051 typedef std::vector<SimulationObject*> SOVector;
    00052
    00053 class Car;
    00055 typedef std::vector<Car*> CarVector;
    00056 std::ostream& operator<<(std::ostream &oss, const CarVector &cv);
    00057
    00058 class Animated;
    00060 typedef std::map<int, Animated*> AOContainer;
    00061
    00062 class Visualized;
    00064 typedef std::map<int, Visualized*> VOContainer;
    00065
    00066 class Sector;
    00068 typedef std::map<int, Sector*> SectorMap;
    00070 typedef std::vector<Sector*> SectorVector;
    00072 typedef std::deque<Sector*> SectorDeque;
    00073 std::ostream& operator<<(std::ostream &oss, const SectorDeque &sd);
    00074
    00076 typedef std::deque<Vector3r> Polygon;
    00077 std::ostream& operator<<(std::ostream &oss, const Polygon &p);
    00078 std::ostream& operator<<(std::ostream &oss, const Polygon* p);
    00079
    00081 typedef struct Line {
    00082     Line(): _a(), _b() {};
    00083     Line(const Vector3r &a, const Vector3r &b): _a(a), _b(b) {};
    00085     Vector3r _a;
    00087     Vector3r _b;
    00088     bool operator==(const Line &l) { return (_a == l._a) && (_b == l._b); };
    00090     inline void invert() { Vector3r tmp = _a; _a = _b; _b = tmp; };
    00091 } Line;
    00092 std::ostream& operator<<(std::ostream &oss, const Line &l);
    00093
    00095 typedef std::deque<Polygon*> PolygonVector;
    00097 typedef std::map<Sector*, Polygon*> SectorPolygonMapping;
    00098
    00100 typedef struct CarType {
    00101     CarType(): _bodySize(-1, -1, -1), _wheelRad(-1), _wheelThick(-1), _wheelWeight(-1), _weight(-1), _maxSpeed(-1), _acceleration(-1), _decceleration(-1) {};
    00103     Vector3r _bodySize;
    00105     dReal _wheelRad;
    00107     dReal _wheelThick;
    00109     dReal _wheelWeight;
    00111     dReal _weight;
    00113     dReal _maxSpeed;
    00115     dReal _acceleration;
    00117     dReal _decceleration;
    00119     bool check() {
    00120         if (_bodySize.x == -1 || _bodySize.y == -1 || _bodySize.z == -1 ||
    00121             _wheelRad == -1 || _wheelThick == -1 || _wheelWeight == -1 || _weight == -1 || _maxSpeed == -1 || _acceleration == -1 || _decceleration == -1) return false;
    00122         else return true;
    00123     }
    00124 } CarType;
    00125
    00127 typedef std::map<std::string, CarType> CarTypeMap;
    00128
    00135 enum CarPriority { CAR_FOLLOW, CAR_NOT_INTERFERING, CAR_LET_GO, CAR_LETS_GO };
    00136
    00138 typedef std::pair<Car*, CarPriority> CarInSight;
    00139
    00141 typedef std::multimap<Sector*, CarInSight> SectorCarMapping;
    00142 std::ostream& operator<<(std::ostream &oss, const SectorCarMapping &sm);
    00143
    00144 #endif /*TYPEDEFS_H_*/