Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Modules/SelfLocator/LinesTables2004.cpp

Go to the documentation of this file.
00001 /**
00002  * @file Modules/SelfLocator/LinesTables2004.cpp
00003  * 
00004  * This file contains a class that represents the tables used for localization based on field lines.
00005  *
00006  * @author <A href=mailto:roefer@tzi.de>Thomas Röfer</A>
00007  */
00008 
00009 #include "LinesTables2004.h"
00010 #include "Tools/Debugging/Debugging.h"
00011 #include "Tools/Streams/InStreams.h"
00012 
00013 Field LinesTables2004::field;
00014 ObservationTable<280,200,25>* LinesTables2004::observationTable = 0;
00015 TemplateTable<50000>* LinesTables2004::templateTable = 0;
00016 int LinesTables2004::refCount = 0;
00017 
00018 //#define SAVE
00019 
00020 LinesTables2004::LinesTables2004()
00021 {
00022   if(!refCount++)
00023   {
00024     int i;
00025     observationTable = new ObservationTable<280,200,25>[LinesPercept::numberOfLineTypes + 1];
00026     templateTable = new TemplateTable<50000>[2];
00027 
00028 #ifdef SAVE
00029     OutBinaryFile stream("lines04.tab");
00030     for(i = 0; i < LinesPercept::numberOfLineTypes + 1; ++i)
00031     {
00032       if(i == LinesPercept::field)
00033         observationTable[i].create(field,LinesPercept::xField);
00034       else if(i == LinesPercept::numberOfLineTypes)
00035         observationTable[i].create(field,LinesPercept::yField);
00036       else
00037         observationTable[i].create(field,LinesPercept::LineType(i));
00038       stream << observationTable[i];
00039     }
00040     templateTable[0].create(field,LinesPercept::yellowGoal);
00041     templateTable[LinesPercept::skyblueGoal - LinesPercept::yellowGoal].create(field,LinesPercept::skyblueGoal);
00042     stream << templateTable[0] << templateTable[1];
00043 #else
00044     InBinaryFile stream("lines04.tab");
00045     if(stream.exists())
00046     {
00047       for(i = 0; i < LinesPercept::numberOfLineTypes + 1; ++i)
00048         stream >> observationTable[i];
00049       stream >> templateTable[0] >> templateTable[1];
00050     }
00051     else
00052     {
00053       OUTPUT(idText, text, "LinesTables2004 : lines04.tab not found");
00054     }
00055 #endif
00056   }
00057 }
00058 
00059 LinesTables2004::~LinesTables2004()
00060 {
00061   if(!--refCount)
00062   {
00063     delete [] observationTable;
00064     delete [] templateTable;
00065   }
00066 }
00067 
00068 /*
00069  * Change log :
00070  * 
00071  * $Log: LinesTables2004.cpp,v $
00072  * Revision 1.2  2004/06/24 18:26:38  roefer
00073  * Lines table redesign, should not influence the performance of GT2003SL
00074  *
00075  * Revision 1.1.1.1  2004/05/22 17:20:45  cvsadm
00076  * created new repository GT2004_WM
00077  *
00078  * Revision 1.2  2004/03/08 01:09:34  roefer
00079  * Use of LinesTables2004 restructured
00080  *
00081  * Revision 1.1  2003/10/06 14:10:14  cvsadm
00082  * Created GT2004 (M.J.)
00083  *
00084  * Revision 1.1.1.1  2003/07/02 09:40:24  cvsadm
00085  * created new repository for the competitions in Padova from the 
00086  * tamara CVS (Tuesday 2:00 pm)
00087  *
00088  * removed unused solutions
00089  *
00090  * Revision 1.1  2003/05/22 07:53:05  roefer
00091  * GT2003SelfLocator added
00092  *
00093  */

Generated on Thu Sep 23 19:57:31 2004 for GT2004 by doxygen 1.3.6