Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

/driver/common.h File Reference

#include "map.h"
#include "mapAbstraction.h"
#include "unitSimulation.h"
#include "glUtil.h"
#include "statCollection.h"

Include dependency graph for common.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Classes

class  commandLineCallbackData
class  joystickCallbackData
class  keyboardCallbackData
class  mouseCallbackData
struct  recCamera
struct  recContext

Typedefs

typedef recContext recContext
typedef recContextpRecContext
typedef void(* joystickCallback )(unitSimulation *, double offsetX, double offsetY, void *)
 a joystaick callback handler is passed the same data passed in when it was installed

typedef bool(* mouseCallback )(unitSimulation *, int x, int y, point3d loc, tButtonType, tMouseEventType)
 a mouse callback handler passes the absolute and local mouse coordinates of the click returns true if the click/movement was handled; false if ignored

typedef void(* keyboardCallback )(unitSimulation *, tKeyboardModifier, char)
 a keyboard callback handler is passed the current unit simulation, the key that was hit, and any modifiers that were being held down.

typedef int(* commandLineCallback )(char **, int)
 A command-line callback handler takes in a char** which points to the argument which matches the argument that this handler was installed for.


Enumerations

enum  {
  kMainMenu = 500, kCloseMenuItem = 2, kInfoMenuItem = 4, kAnimateMenuItem = 5,
  kInfoState = 1, kAnimateState = 0
}
enum  { kFSAAOff = 0, kFSAAFast = 1, kFSAANice = 2, kSamples = 4 }
enum  tKeyboardModifier {
  kNoModifier, kAnyModifier, kShiftDown, kControlDown,
  kAltDown
}
enum  tButtonType { kLeftButton, kRightButton, kMiddleButton }
enum  tMouseEventType { kMouseDown, kMouseUp, kMouseDrag }

Functions

void updateProjection (pRecContext pContextInfo)
 Update the projection matrix based on camera and view info.

void drawGL (pRecContext pContextInfo, bool swap)
bool doKeyboardCommand (pRecContext pContextInfo, unsigned char keyHit, bool shift, bool cntrl, bool alt)
void SetLighting (unsigned int mode)
void initialConditions (pRecContext pContextInfo)
void resetCamera (recCamera *pCamera)
void processCommandLineArgs (int argc, char *argv[])
void handleBatchRTS (int argc, char *argv[], int mode, char *_map)
void handleBatchPRA (int argc, char *argv[], int mode, char *_map)
void runSimpleUnitTest (char *_map)
void runLRTS (char *_map, int xxs, int yys, int xxg, int yyg, int _d, double _gamma, double _LQ, unsigned _numRuns, bool _drawMap, int _dist)
void runPRLRTS (char *_map, int xxs, int yys, int xxg, int yyg, int _d, double _gamma, double _LQ, unsigned _numRuns, bool _drawMap, int _dist)
void randomPathTesting (char *_map)
void pickStartEnd (int &xs, int &ys, int &xg, int &yg, Map *map, graph *g, mapAbstraction *aMap, double &spDist, double &aStarDifficulty, int)
void scenarioGenerator (char *_map)
void discrepancy (char *scenName, char *algName, int _d=1, double _gamma=1.0, double _LQ=99999999999.0)
void runScenario (char *scenName, char *algName, int _d=1, double _gamma=1.0, double _LQ=99999999999.0)
void calculateAverageTimePerStep (char *_map, char *coordFile, int MAP_SIZE)
void calculateSubOptimality (char *_map, char *coordFile, int MAP_SIZE)
void installJoystickHandler (joystickCallback jC, void *userdata)
void removeJoystickHandler (joystickCallback jC, void *userdata)
void handleJoystickMovement (pRecContext pContextInfo, double panX, double panY)
void installMouseClickHandler (mouseCallback jC)
void removeMouseClickHandler (mouseCallback jC)
bool handleMouseClick (pRecContext pContextInfo, int x, int y, point3d where, tButtonType, tMouseEventType)
void installKeyboardHandler (keyboardCallback kf, const char *title, const char *description, tKeyboardModifier mod, unsigned char firstKey, unsigned char lastKey=0)
void printKeyboardAssignments ()
void installCommandLineHandler (commandLineCallback, const char *, const char *, const char *)
void printCommandLineArguments ()
void createSimulation (unitSimulation *&unitLayer)
 This function is used to allocate the unit simulated that you want to run.

void initializeHandlers ()
 Allows you to install any keyboard handlers needed for program interaction.

void processStats (statCollection *)
 This function is called each time a unitSimulation is deallocated to allow any necessary stat processing beforehand.

void frameCallback (unitSimulation *)
 This function is called once after each [time-step and frame draw] You can do any high level processing, drawing, etc in this function.

void submitTextToBuffer (const char *val)
void appendTextToBuffer (char *)
pRecContext getCurrentContext ()
void updateModelView (pRecContext pContextInfo)
 Updates the viewpoint of the model.

void cameraLookAt (GLfloat, GLfloat, GLfloat, float cameraSpeed=0.1)
void cameraMoveTo (GLfloat x, GLfloat y, GLfloat z, float cameraSpeed=0.1)
void resetCamera ()
point3d GetOGLPos (int x, int y)

Variables

GLfloat gTrackBallRotation [4]
pRecContext gTrackingContextInfo
char gDefaultMap [1024]

Typedef Documentation

typedef int(* commandLineCallback)(char**, int)
 

A command-line callback handler takes in a char** which points to the argument which matches the argument that this handler was installed for.

The second argument is the number of remaining arguments available. The handler can process and use as many of the remaining arguments, and returns the number of arguments it processed.

typedef void(* joystickCallback)(unitSimulation *, double offsetX, double offsetY, void*)
 

a joystaick callback handler is passed the same data passed in when it was installed

typedef void(* keyboardCallback)(unitSimulation *,tKeyboardModifier,char)
 

a keyboard callback handler is passed the current unit simulation, the key that was hit, and any modifiers that were being held down.

Note that the modifiers can change the character being passed.

typedef bool(* mouseCallback)(unitSimulation *, int x, int y, point3d loc, tButtonType, tMouseEventType)
 

a mouse callback handler passes the absolute and local mouse coordinates of the click returns true if the click/movement was handled; false if ignored

typedef struct recContext* pRecContext
 

typedef struct recContext recContext
 


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
kMainMenu 
kCloseMenuItem 
kInfoMenuItem 
kAnimateMenuItem 
kInfoState 
kAnimateState 

anonymous enum
 

Enumeration values:
kFSAAOff 
kFSAAFast 
kFSAANice 
kSamples 

enum tButtonType
 

Enumeration values:
kLeftButton 
kRightButton 
kMiddleButton 

enum tKeyboardModifier
 

Enumeration values:
kNoModifier 
kAnyModifier 
kShiftDown 
kControlDown 
kAltDown 

enum tMouseEventType
 

Enumeration values:
kMouseDown 
kMouseUp 
kMouseDrag 


Function Documentation

void appendTextToBuffer char *   ) 
 

void calculateAverageTimePerStep char *  _map,
char *  coordFile,
int  MAP_SIZE
 

void calculateSubOptimality char *  _map,
char *  coordFile,
int  MAP_SIZE
 

void cameraLookAt GLfloat  ,
GLfloat  ,
GLfloat  ,
float  cameraSpeed = 0.1
 

void cameraMoveTo GLfloat  x,
GLfloat  y,
GLfloat  z,
float  cameraSpeed = 0.1
 

void createSimulation unitSimulation *&  unitSim  ) 
 

This function is used to allocate the unit simulated that you want to run.

Any parameters or other experimental setup can be done at this time.

void discrepancy char *  scenName,
char *  algName,
int  _d = 1,
double  _gamma = 1.0,
double  _LQ = 99999999999.0
 

bool doKeyboardCommand pRecContext  pContextInfo,
unsigned char  keyHit,
bool  shift,
bool  cntrl,
bool  alt
 

void drawGL pRecContext  pContextInfo,
bool  swap
 

void frameCallback unitSimulation  ) 
 

This function is called once after each [time-step and frame draw] You can do any high level processing, drawing, etc in this function.

pRecContext getCurrentContext  ) 
 

point3d GetOGLPos int  x,
int  y
 

void handleBatchPRA int  argc,
char *  argv[],
int  mode,
char *  _map
 

void handleBatchRTS int  argc,
char *  argv[],
int  mode,
char *  _map
 

void handleJoystickMovement pRecContext  pContextInfo,
double  panX,
double  panY
 

bool handleMouseClick pRecContext  pContextInfo,
int  x,
int  y,
point3d  where,
tButtonType  ,
tMouseEventType 
 

void initialConditions pRecContext  pContextInfo  ) 
 

void initializeHandlers  ) 
 

Allows you to install any keyboard handlers needed for program interaction.

void installCommandLineHandler commandLineCallback  ,
const char *  ,
const char *  ,
const char * 
 

void installJoystickHandler joystickCallback  jC,
void *  userdata
 

void installKeyboardHandler keyboardCallback  kf,
const char *  title,
const char *  description,
tKeyboardModifier  mod,
unsigned char  firstKey,
unsigned char  lastKey = 0
 

void installMouseClickHandler mouseCallback  jC  ) 
 

void pickStartEnd int &  xs,
int &  ys,
int &  xg,
int &  yg,
Map map,
graph g,
mapAbstraction aMap,
double &  spDist,
double &  aStarDifficulty,
int 
 

void printCommandLineArguments  ) 
 

void printKeyboardAssignments  ) 
 

void processCommandLineArgs int  argc,
char *  argv[]
 

void processStats statCollection  ) 
 

This function is called each time a unitSimulation is deallocated to allow any necessary stat processing beforehand.

void randomPathTesting char *  _map  ) 
 

void removeJoystickHandler joystickCallback  jC,
void *  userdata
 

void removeMouseClickHandler mouseCallback  jC  ) 
 

void resetCamera  ) 
 

void resetCamera recCamera pCamera  ) 
 

void runLRTS char *  _map,
int  xxs,
int  yys,
int  xxg,
int  yyg,
int  _d,
double  _gamma,
double  _LQ,
unsigned  _numRuns,
bool  _drawMap,
int  _dist
 

void runPRLRTS char *  _map,
int  xxs,
int  yys,
int  xxg,
int  yyg,
int  _d,
double  _gamma,
double  _LQ,
unsigned  _numRuns,
bool  _drawMap,
int  _dist
 

void runScenario char *  scenName,
char *  algName,
int  _d = 1,
double  _gamma = 1.0,
double  _LQ = 99999999999.0
 

void runSimpleUnitTest char *  _map  ) 
 

void scenarioGenerator char *  _map  ) 
 

void SetLighting unsigned int  mode  ) 
 

void submitTextToBuffer const char *  val  ) 
 

void updateModelView pRecContext  pContextInfo  ) 
 

Updates the viewpoint of the model.

void updateProjection pRecContext  pContextInfo  ) 
 

Update the projection matrix based on camera and view info.

Should be called when viewport size, eye z position, or camera aperture changes. Also call if far or near changes which is determined by shape size in this case.


Variable Documentation

char gDefaultMap[1024]
 

GLfloat gTrackBallRotation[4]
 

pRecContext gTrackingContextInfo
 


Generated on Tue Aug 18 03:35:55 2009 for HOG by doxygen 1.3.4