6 #include <boost/filesystem/fstream.hpp> 7 #include <boost/filesystem/path.hpp> 8 #include <boost/format.hpp> 18 const std::string& defaultPath)
20 boost::format fmt(
"%1%/%2%/%2%.init");
21 fmt % defaultPath % modelName;
27 const std::string& defaultPath)
29 boost::format fmt(
"%1%/%2%/%2%.ppm");
30 fmt % defaultPath % modelName;
36 const std::string& defaultPath)
38 boost::format fmt(
"%1%/%2%/%2%");
39 fmt % defaultPath % modelName;
45 const std::string& defaultPath)
47 boost::format fmt(
"%1%/%2%/%2%.xml");
48 fmt % defaultPath % modelName;
54 const std::string& defaultPath)
56 boost::format fmt(
"%1%/%2%/%2%.0.pos");
57 fmt % defaultPath % modelName;
63 std::string& fullModelPath)
65 std::string modelDescription;
75 char* tmpname = strdup(
"/tmp/tmpXXXXXX");
76 if (mkdtemp(tmpname) == NULL)
79 (
"Failed to create the temporary directory: " << strerror(errno));
83 std::string vrml_header(
"#VRML #vrml");
84 std::string cao_header(
"V1");
85 boost::filesystem::path path(tmpname);
86 if (modelDescription.compare(0, 5, vrml_header, 0, 5) == 0) {
89 else if (modelDescription.compare(0, 5, vrml_header, 6, 5) == 0) {
92 else if (modelDescription.compare(0, 2, cao_header) == 0) {
102 fullModelPath = path.native();
104 modelStream.open(path);
105 if (!modelStream.good())
110 modelStream << modelDescription;
std::string getHelpImageFileFromModelName(const std::string &modelName, const std::string &defaultPath)
std::string getModelFileFromModelName(const std::string &modelName, const std::string &defaultPath)
std::string getInitFileFromModelName(const std::string &modelName, const std::string &defaultPath)
ROSCPP_DECL bool get(const std::string &key, std::string &s)
std::string getInitialPoseFileFromModelName(const std::string &modelName, const std::string &defaultPath)
std::string model_description_param
ROSCPP_DECL bool has(const std::string &key)
std::string getConfigurationFileFromModelName(const std::string &modelName, const std::string &defaultPath)
#define ROS_DEBUG_STREAM(args)
#define ROS_ERROR_STREAM(args)
bool makeModelFile(boost::filesystem::ofstream &modelStream, std::string &fullModelPath)