22 #include <boost/regex.hpp> 24 #include <ros_uri/ros_uri.hpp> 25 #include <boost/algorithm/string.hpp> 47 return fs::path(realPath);
52 std::string packageString = ros_uri::package_uri(pt.string());
79 fs::path folder = this->
getPath();
83 if (!fs::is_directory(folder))
85 ROS_DEBUG(
"'%s' is not a valid folder", folder.c_str());
89 ROS_DEBUG(
"'%s' already read", folder.c_str());
94 boost::regex expression(regexp);
97 for (fs::directory_iterator diriter(folder); diriter != fs::directory_iterator(); diriter++)
99 fs::path path = *diriter;
101 fs::path
filename = path.filename();
103 if (boost::regex_match(filename.c_str(), what, expression))
105 if (fs::is_directory(path))
112 strUniqueName = what[1].str();
115 strUniqueName = what[0].str();
118 fs::path rvizMeshResourcePath = fs::path();
119 fs::path normalVectorResourcePath = fs::path();
120 fs::path deviation_resource_path = fs::path();
121 fs::path rotation_invariance_resource_path = fs::path();
122 for (fs::directory_iterator subdiriter(path); subdiriter != fs::directory_iterator();
125 fs::path subdir_path = *subdiriter;
126 fs::path subdir_filename = subdir_path.filename();
129 if (boost::regex_match(subdir_filename.c_str(), match, boost::regex(
".*\\.dae")))
131 rvizMeshResourcePath = subdir_path;
134 if (boost::regex_match(subdir_filename.c_str(), match, boost::regex(
".*\\.nv.txt")))
136 normalVectorResourcePath = subdir_path;
138 if (boost::regex_match(subdir_filename.c_str(), match, boost::regex(
".*\\.dev.txt")))
140 deviation_resource_path = subdir_path;
142 if (boost::regex_match(subdir_filename.c_str(), match, boost::regex(
".*\\.ri.txt")))
144 rotation_invariance_resource_path = subdir_path;
150 path, rvizMeshResourcePath,
151 normalVectorResourcePath,
152 deviation_resource_path,
153 rotation_invariance_resource_path));
154 mEntries[entryPtr->getUniqueName()] = entryPtr;
156 ROS_DEBUG(
"File '%s' in db called '%s'", filename.c_str(), strUniqueName.c_str());
ObjectDatabaseEntryPtrMap mEntries
const basenameMatchPattern_type & basenameMatchPattern() const
const std::string getRegexp()
const ObjectDatabaseEntryPtr & getEntry(const std::string objectName)
boost::shared_ptr< ObjectDatabaseEntry > ObjectDatabaseEntryPtr
ObjectDatabaseEntryPtrMap getEntries()
const uniqueName_type & uniqueName() const
const std::string getKeyword()
void setKeyword(const std::string kw)
std::map< std::string, ObjectDatabaseEntryPtr > ObjectDatabaseEntryPtrMap
void setRegexp(const std::string regexp)
::xsd::cxx::tree::string< char, simple_type > string
const objectDbRootFolder_type & objectDbRootFolder() const
ObjectDatabaseRecognizer(database db)
void setPath(const fs::path pt)