Go to the documentation of this file.00001
00012 #ifndef LGL_PURSUIT_TASK_MANAGER_HPP
00013 #define LGL_PURSUIT_TASK_MANAGER_HPP
00014
00015 #include <lgl/PursuitGraph.hpp>
00016 #include <lgl/CellID.hpp>
00017
00018
00019
00020
00021
00022 #ifndef PURSUIT_TASK_ID
00023 #define PURSUIT_TASK_ID
00024
00025 typedef long int PursuitTask_ID ;
00026
00027 #endif
00028
00029 namespace jafar {
00030 namespace lgl {
00031
00035 class PursuitTask {
00037
00038
00039 public :
00040
00041 unsigned int time ;
00042 Cell_ID place ;
00043 int asking_robot;
00044 PursuitTask_ID id ;
00045
00046 int robot_in_charge;
00047
00048
00050 PursuitTask() {}
00051
00052 PursuitTask(
00053 unsigned int _time,
00054 Cell_ID _place,
00055 int _asking_robot,
00056 PursuitTask_ID _id,
00057 int _robot_in_charge = -1
00058 ) :
00059 time (_time),
00060 place(_place),
00061 asking_robot(_asking_robot),
00062 id(_id),
00063 robot_in_charge( _robot_in_charge)
00064 { }
00065
00067 ~PursuitTask() { }
00068
00072 bool operator< (const PursuitTask &rhs) const ;
00073
00077 bool operator== (const PursuitTask &rhs) const ;
00078
00079 };
00080
00082 struct PursuitTaskKey
00083 {
00084 unsigned int time ;
00085 Cell_ID place ;
00086
00087 bool operator< (const PursuitTaskKey &rhs) const
00088 {
00089 if ( time != rhs.time ) return ( time < rhs.time );
00090 else return ( place < rhs.place );
00091 }
00092
00093 };
00094
00095
00099 class PursuitTaskManager {
00101
00102 private :
00103 int robotID ;
00104
00105 PursuitTask_ID countTaskID ;
00106
00107 std::map< PursuitTaskKey, PursuitTask > oldTaskList ;
00108 std::map< PursuitTaskKey, PursuitTask > newTaskList ;
00109
00110 std::vector< PursuitTask_ID > obsoleteTasks ;
00111 std::vector< PursuitTask_ID > nonattributedTasks ;
00112
00113 public :
00114
00116
00117 PursuitTaskManager( int _robotID = -1 ) ;
00118
00120 ~PursuitTaskManager() { }
00121
00122
00123 void updateTaskList( const PursuitGraph *aPG) ;
00124
00125 };
00126
00127 }
00128 }
00129
00130 #endif