Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PursuitTaskManager.hpp
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 //#include <boost/weak_ptr.hpp>
00019 
00020 //#include <vector>
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         // variables
00041         unsigned int  time ;        // when
00042         Cell_ID     place ;       // where
00043         int       asking_robot;   // ID of the robot who created the task
00044         PursuitTask_ID  id ;        // ID of the task
00045         // priority level ?
00046         int       robot_in_charge;  // ID of the robot in charge of the task
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 ;        // when
00085       Cell_ID     place ;       // where
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 ;     // ID of the owner
00104 
00105         PursuitTask_ID countTaskID ;  // counter for the pursuit task IDs 
00106 
00107         std::map< PursuitTaskKey, PursuitTask > oldTaskList ;
00108         std::map< PursuitTaskKey, PursuitTask > newTaskList ;
00109 
00110         std::vector< PursuitTask_ID > obsoleteTasks ;   // the tasks that are not needed anymore
00111         std::vector< PursuitTask_ID > nonattributedTasks ;  // the tasks for no robot is in charge with 
00112 
00113       public : 
00114 
00116         //PursuitTaskManager() { }
00117         PursuitTaskManager( int _robotID = -1 ) ;
00118       
00120         ~PursuitTaskManager() { }
00121 
00122         /*  Actions */
00123         void updateTaskList( const PursuitGraph *aPG) ;
00124 
00125     };
00126 
00127   }
00128 }
00129 
00130 #endif /* LGL_PURSUIT_TASK_MANAGER_HPP */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on Wed Oct 15 2014 00:37:24 for Jafar by doxygen 1.7.6.1
LAAS-CNRS