NavBehavior.h
Go to the documentation of this file.
00001 /* -*- mode: C++ -*-
00002  * 
00003  *  Copyright (C) 2007, 2010, Austin Robot Technology
00004  *
00005  *  License: Modified BSD Software License Agreement
00006  *
00007  *  $Id: NavBehavior.h 996 2011-02-27 16:07:34Z jack.oquin $
00008  *
00009  *  Author: Jack O'Quin
00010  */
00011 
00012 #ifndef __NAV_BEHAVIORS_H__
00013 #define __NAV_BEHAVIORS_H__
00014 
00015 #include <ostream>
00016 #include <art_msgs/Behavior.h>
00017 
00019 class NavBehavior
00020 {
00021 public:
00022 
00023   // Navigator behaviors (lower numbers have higher priority)
00024   typedef enum
00025     {
00026       Abort = art_msgs::Behavior::Abort,
00027       Quit = art_msgs::Behavior::Quit,
00028       Pause = art_msgs::Behavior::Pause,
00029       Run = art_msgs::Behavior::Run,
00030       Suspend = art_msgs::Behavior::Suspend,
00031       Initialize = art_msgs::Behavior::Initialize,
00032       Go = art_msgs::Behavior::Go,
00033       None = art_msgs::Behavior::NONE,
00034       N_behaviors = art_msgs::Behavior::N_behaviors
00035     } nav_behavior_t;
00036 
00037   // return behavior name as a C string
00038   const char *Name(void) const
00039   {
00040     static const char *behavior_name[N_behaviors] =
00041       {
00042         "Abort",
00043         "Quit",
00044         "Pause",
00045         "Run",
00046         "Suspend",
00047         "Initialize",
00048         "Go",
00049         "None",
00050       };
00051     return behavior_name[this->behavior];
00052   }
00053 
00054   NavBehavior()
00055   {
00056     this->behavior = None;
00057   }
00058 
00059   NavBehavior(nav_behavior_t &ibehavior)
00060   {
00061     this->behavior = ibehavior;
00062   }
00063 
00064   NavBehavior(const art_msgs::Behavior &behavior_msg)
00065   {
00066     this->behavior = (nav_behavior_t) behavior_msg.value;
00067   }
00068 
00069   ~NavBehavior();
00070 
00071   nav_behavior_t Value(void)
00072   {
00073     return this->behavior;
00074   }
00075 
00076   void operator=(const NavBehavior &newval)
00077   {
00078     this->behavior = newval.behavior;
00079   }
00080 
00081   bool operator==(const NavBehavior compare)
00082   {
00083     return this->behavior == compare.behavior;
00084   }
00085 
00086   bool operator!=(const NavBehavior compare)
00087   {
00088     return this->behavior != compare.behavior;
00089   }
00090 
00091   void operator=(const NavBehavior::nav_behavior_t &newbehavior)
00092   {
00093     this->behavior = newbehavior;
00094   }
00095 
00096   bool operator==(const nav_behavior_t &compare)
00097   {
00098     return this->behavior == compare;
00099   }
00100 
00101   bool operator!=(const nav_behavior_t &compare)
00102   {
00103     return this->behavior != compare;
00104   }
00105 
00106 private:
00107   nav_behavior_t behavior;
00108 };
00109 
00111 //std::ostream& operator<<(std::ostream &out, const NavBehavior &behavior)
00112 //  {
00113 //    out << behavior.Name();
00114 //    return out;
00115 //  }
00116 
00117 #endif // __NAV_BEHAVIORS_H__
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


art_nav
Author(s): Austin Robot Technology, Jack O'Quin
autogenerated on Tue Sep 24 2013 10:42:11