00001 /** 00002 * @file Location.cpp 00003 * 00004 * Implementation of class Location. 00005 * 00006 * @author Max Risler 00007 */ 00008 00009 #include <string> 00010 #include "Location.h" 00011 #include "Platform/SystemCall.h" 00012 #include "Tools/Streams/InStreams.h" 00013 00014 static Location theLocation; 00015 00016 Location& getLocation() 00017 { 00018 return theLocation; 00019 } 00020 00021 Location::Location() 00022 { 00023 name[0] = 0; 00024 InConfigFile file("location.cfg"); 00025 if(file.exists() && !file.eof()) 00026 { 00027 file >> name; 00028 } 00029 } 00030 00031 const char* Location::getFilename(const char *file) 00032 { 00033 if (name[0] == 0) 00034 return file; 00035 00036 sprintf(filename, "Location/%s/%s", name, file); 00037 return filename; 00038 } 00039 00040 const char* Location::getModelFilename(const char *file) 00041 { 00042 return getModelFilename(file, SystemCall::getRobotDesign()); 00043 } 00044 00045 const char* Location::getModelFilename(const char *file, RobotDesign::Design design) 00046 { 00047 if (name[0] == 0) 00048 return file; 00049 00050 sprintf(filename, "Location/%s/%s/%s", name, RobotDesign::getRobotDesignName(design), file); 00051 return filename; 00052 } 00053 00054 /* 00055 * Change log : 00056 * 00057 * $Log: Location.cpp,v $ 00058 * Revision 1.3 2004/05/27 12:28:33 thomas 00059 * added function to get specific config-files for a given robotdesign 00060 * 00061 * Revision 1.2 2004/05/27 10:08:09 thomas 00062 * added model-specific locations 00063 * 00064 * Revision 1.1.1.1 2004/05/22 17:35:53 cvsadm 00065 * created new repository GT2004_WM 00066 * 00067 * Revision 1.1 2003/10/07 10:13:21 cvsadm 00068 * Created GT2004 (M.J.) 00069 * 00070 * Revision 1.1.1.1 2003/07/02 09:40:28 cvsadm 00071 * created new repository for the competitions in Padova from the 00072 * tamara CVS (Tuesday 2:00 pm) 00073 * 00074 * removed unused solutions 00075 * 00076 * Revision 1.2 2003/05/30 16:26:06 risler 00077 * bugfix: name initialization 00078 * 00079 * Revision 1.1 2003/05/11 17:03:00 risler 00080 * added location.cfg 00081 * 00082 */