00001 /* Copyright (C) 2002 Nicolas Hatier 00002 00003 This library is free software; you can redistribute it and/or 00004 modify it under the terms of the GNU Lesser General Public 00005 License as published by the Free Software Foundation; either 00006 version 2.1 of the License, or (at your option) any later version. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public 00014 License along with this library; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 #ifndef _LINEARRAY_H_ 00018 #define _LINEARRAY_H_ 00019 00020 #include "Object.h" 00021 #include <iostream> 00022 00023 namespace RobotFlow { 00024 00025 struct line 00026 { 00027 line() : rho(0), omega(0) { } 00028 line(int Omega, int Rho) : omega(Omega), rho(Rho) { } 00029 int rho; 00030 int omega; 00031 }; 00032 00033 struct linenode 00034 { 00035 linenode * next; 00036 linenode * prev; 00037 line node; 00038 }; 00039 00040 class LineArray : public FD::Object 00041 { 00042 public: 00043 LineArray(); 00044 LineArray(const LineArray & cpy); 00045 00046 virtual ~LineArray(); 00047 00048 virtual void printOn(std::ostream &out = std::cout) const; 00049 00050 int get_count() const; 00051 int add_line(line & ln); 00052 void set_coords(int lineindex, line & newln); 00053 00054 void reset_get() const; 00055 const line * get_next_line() const; 00056 00057 private: 00058 int m_count; 00059 linenode m_linearray; 00060 linenode * m_last; 00061 const mutable linenode * m_cur_itr; 00062 00063 }; 00064 00065 }//namespace RobotFlow 00066 #endif 00067 00068