Jafar
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
PursuitGNode.hpp
Go to the documentation of this file.
00001 
00013 #ifndef LGL_PURSUIT_GRAPH_NODE_HPP
00014 #define LGL_PURSUIT_GRAPH_NODE_HPP
00015 
00016 #include <lgl/CellID.hpp>
00017 
00018 #include <set>
00019 #include <vector>
00020 #include <boost/shared_ptr.hpp>
00021 #include <boost/weak_ptr.hpp>
00022 
00023 
00024 
00025 namespace jafar {
00026   namespace lgl {
00027     
00028     // TODO change the name (more specific) => pursuit-toto
00029     // cf old conflict with "OK" in genom
00030     typedef enum {  SEEN,             // Nothing special, situation is under control
00031             RISK,             // The target is unseen, but still managed
00032             DANGER_HIDDEN,          // The target is hiding from the robot (enter not visible enough area)
00033             DANGER_LOST,          // Too much potential position for the target : it overwhelms the robot capacities ;
00034                                   // or the robot cannot re-catch the target in a finite time (inaccessible area, etc.)
00035             DANGER_UNSEEN,          // The risk term reached its maximal value (the target has been unseen for too much time)
00036             DANGER_DISAPPEARED        // The target "disappeared" (it's probable that the target model does not fit the real target)
00037       } RISK_LEVEL;
00043     class PursuitGNode {
00045     
00046       private :
00047         std::vector< boost::weak_ptr<PursuitGNode> > children;
00048 
00049       public : 
00051         Cell_ID robotPos;
00052 
00054         RISK_LEVEL risk;
00055         
00057         std::set<Cell_ID> targetPos;
00058 
00060         unsigned int time;
00061     
00063         unsigned int riskTerm;
00064     
00066         PursuitGNode() :
00067           robotPos (0),
00068           risk (SEEN),
00069           time(0),
00070           riskTerm(0)
00071         { }
00072       
00077         PursuitGNode( Cell_ID _robotPos, RISK_LEVEL _risk, unsigned long int _time=0, unsigned long int _riskTerm=0 ) :
00078           robotPos(_robotPos),
00079           risk(_risk),
00080           time(_time),
00081           riskTerm(_riskTerm)
00082         { }
00083 
00089         PursuitGNode(Cell_ID _robotPos, RISK_LEVEL _risk, std::set<Cell_ID> _targetPos, unsigned long int _time=0, unsigned long int _riskTerm=0 ) :
00090           robotPos(_robotPos),
00091           risk(_risk),
00092           targetPos(_targetPos),
00093           time(_time),
00094           riskTerm(_riskTerm)
00095         { }
00096         
00097         ~PursuitGNode() { }
00098 
00101         void setChildren ( const std::vector< boost::shared_ptr<PursuitGNode> > &newChildren ) ;
00102 
00105         void noMoreChildren() ;
00106 
00109         void addChild ( const boost::shared_ptr<PursuitGNode> & newChild ) ;
00110 
00111         void addChild ( const boost::weak_ptr<PursuitGNode> & newChild ) ;
00112 
00114         const std::vector< boost::weak_ptr<PursuitGNode> > & getChildren () const ; 
00115         
00119         bool operator== (const PursuitGNode &rhs) const ; 
00120 
00124         bool equal (const PursuitGNode &rhs) const ; 
00125 
00126     };
00127 
00128     /* comparator using temporal order */ 
00129     bool before( const boost::weak_ptr<PursuitGNode> &lhs, const boost::weak_ptr<PursuitGNode> &rhs) ; 
00130   
00131     /* output stream for PursuitGNode */
00132     std::ostream& operator<<(std::ostream& out, PursuitGNode const &rhs);
00133 
00134   }
00135 }
00136 
00137 #endif /* LGL_PURSUIT_GRAPH_NODE_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