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 }
1.3.6