estar/FacadeReadInterface.hpp

Go to the documentation of this file.
00001 /* 
00002  * Copyright (C) 2007 Roland Philippsen <roland dot philippsen at gmx net>
00003  * 
00004  * This program is free software; you can redistribute it and/or modify
00005  * it under the terms of the GNU General Public License as published by
00006  * the Free Software Foundation; either version 2 of the License, or
00007  * (at your option) any later version.
00008  * 
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  * 
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00017  * USA
00018  */
00019 
00020 
00021 #ifndef ESTAR_FACADE_READ_INTERFACE_HPP
00022 #define ESTAR_FACADE_READ_INTERFACE_HPP
00023 
00024 
00025 #include <estar/GridNode.hpp>
00026 #include <vector>
00027 
00028 
00029 namespace estar {
00030   
00031   class Algorithm;
00032   class Grid;
00033   class Kernel;
00034   
00035   
00041   struct carrot_item {
00042     carrot_item(double x, double y, double gx, double gy, double val, bool dgn)
00043       : cx(x), cy(y), gradx(gx), grady(gy), value(val), degenerate(dgn) {}
00044     double cx;                  
00045     double cy;                  
00046     double gradx;               
00047     double grady;               
00048     double value;               
00049     bool degenerate;            
00050   };
00051   
00052   typedef std::vector<carrot_item> carrot_trace;
00053   
00054   
00061   class FacadeReadInterface
00062   {
00063   public:
00064     virtual ~FacadeReadInterface() {}
00065     
00072     typedef enum {
00074       OUT_OF_GRID,
00076       UPWIND,
00078       DOWNWIND,
00080       WAVEFRONT,
00082       GOAL,
00084       OBSTACLE
00085     } node_status_t;
00086     
00090     virtual double GetScale() const = 0;
00091     
00097     virtual double GetFreespaceMeta() const = 0;
00098     
00104     virtual double GetObstacleMeta() const = 0;
00105     
00111     virtual double GetValue(ssize_t ix, ssize_t iy) const = 0;
00112     
00118     virtual double GetMeta(ssize_t ix, ssize_t iy) const = 0;
00119     
00123     virtual bool IsGoal(ssize_t ix, ssize_t iy) const = 0;
00124     
00131     virtual bool HaveWork() const = 0;
00132     
00142     virtual node_status_t GetStatus(ssize_t ix, ssize_t iy) const = 0;
00143     
00149     virtual node_status_t GetStatus(vertex_t vertex) const = 0;
00150     
00154     virtual bool IsValidIndex(ssize_t ix, ssize_t iy) const = 0;
00155     
00169     virtual bool GetLowestInconsistentValue(double & value) const = 0;
00170     
00174     virtual const Algorithm & GetAlgorithm() const = 0;
00175     
00176   protected:
00177     friend void dump_raw(const FacadeReadInterface &, FILE *, FILE *);
00178     friend void dump_queue(const FacadeReadInterface &, size_t, FILE *);
00179     friend void dump_facade_range_highlight(const FacadeReadInterface &,
00180                                             ssize_t, ssize_t, ssize_t, ssize_t,
00181                                             ssize_t, ssize_t, FILE *);
00182     
00186     virtual boost::shared_ptr<Grid const> GetGrid() const = 0;
00187   public:
00188     
00192     virtual const Kernel & GetKernel() const = 0;
00193     
00194     
00223     virtual int TraceCarrot(double robot_x, double robot_y,
00224                             double distance, double stepsize,
00225                             size_t maxsteps,
00226                             carrot_trace & trace) const = 0;
00227 
00228     virtual boost::shared_ptr<GridCSpace const> GetCSpace() const = 0;
00229   };
00230   
00231 } // namespace estar
00232 
00233 #endif // ESTAR_FACADE_READ_INTERFACE_HPP

doxygen SourceForge.net Logo
E* Interpolated Graph Replanner Wed Dec 12 18:55:40 2007