A general resource loaders using environment variable. More...
#include <resource_locator.h>
Public Types | |
using | ConstPtr = std::shared_ptr< const GeneralResourceLocator > |
using | Ptr = std::shared_ptr< GeneralResourceLocator > |
![]() | |
using | ConstPtr = std::shared_ptr< const ResourceLocator > |
using | Ptr = std::shared_ptr< ResourceLocator > |
Public Member Functions | |
bool | addPath (const std::filesystem::path &path) |
Add path to the resource locator. More... | |
GeneralResourceLocator (const GeneralResourceLocator &)=default | |
GeneralResourceLocator (const std::vector< std::filesystem::path > &paths, const std::vector< std::string > &environment_variables={ "TESSERACT_RESOURCE_PATH", "ROS_PACKAGE_PATH" }) | |
Construct a new General Resource Locator object using the provided paths and/or the TESSERACT_RESOURCE_PATH environment variable. More... | |
GeneralResourceLocator (const std::vector< std::string > &environment_variables={ "TESSERACT_RESOURCE_PATH", "ROS_PACKAGE_PATH" }) | |
Construct a new General Resource Locator object using the TESSERACT_RESOURCE_PATH environment variable. More... | |
GeneralResourceLocator (GeneralResourceLocator &&)=default | |
bool | loadEnvironmentVariable (const std::string &environment_variable) |
Load paths from an environment variable. More... | |
std::shared_ptr< Resource > | locateResource (const std::string &url) const override |
Locate a resource based on a URL. More... | |
bool | operator!= (const GeneralResourceLocator &rhs) const |
GeneralResourceLocator & | operator= (const GeneralResourceLocator &)=default |
GeneralResourceLocator & | operator= (GeneralResourceLocator &&)=default |
bool | operator== (const GeneralResourceLocator &rhs) const |
~GeneralResourceLocator () override=default | |
![]() | |
bool | operator!= (const ResourceLocator &rhs) const |
bool | operator== (const ResourceLocator &rhs) const |
virtual | ~ResourceLocator ()=default |
Private Member Functions | |
void | processToken (const std::string &token) |
template<class Archive > | |
void | serialize (Archive &ar, const unsigned int version) |
Private Attributes | |
std::unordered_map< std::string, std::string > | package_paths_ |
Friends | |
class | boost::serialization::access |
struct | tesseract_common::Serialization |
A general resource loaders using environment variable.
Also can set this environment variable TESSERACT_RESOURCE_PATH with ':' separated directories and then use the directires as package names
Definition at line 84 of file resource_locator.h.
using tesseract_common::GeneralResourceLocator::ConstPtr = std::shared_ptr<const GeneralResourceLocator> |
Definition at line 88 of file resource_locator.h.
using tesseract_common::GeneralResourceLocator::Ptr = std::shared_ptr<GeneralResourceLocator> |
Definition at line 87 of file resource_locator.h.
tesseract_common::GeneralResourceLocator::GeneralResourceLocator | ( | const std::vector< std::string > & | environment_variables = { "TESSERACT_RESOURCE_PATH", "ROS_PACKAGE_PATH" } | ) |
Construct a new General Resource Locator object using the TESSERACT_RESOURCE_PATH environment variable.
environment_variables | A vector of environment variables to search for paths |
Definition at line 60 of file resource_locator.cpp.
tesseract_common::GeneralResourceLocator::GeneralResourceLocator | ( | const std::vector< std::filesystem::path > & | paths, |
const std::vector< std::string > & | environment_variables = { "TESSERACT_RESOURCE_PATH", "ROS_PACKAGE_PATH" } |
||
) |
Construct a new General Resource Locator object using the provided paths and/or the TESSERACT_RESOURCE_PATH environment variable.
paths | A vector of paths to search for resources |
environment_variables | A vector of environment variables to search for paths |
Definition at line 68 of file resource_locator.cpp.
|
default |
|
default |
|
overridedefault |
bool tesseract_common::GeneralResourceLocator::addPath | ( | const std::filesystem::path & | path | ) |
Add path to the resource locator.
path | The path to add. Must be a directory |
Definition at line 101 of file resource_locator.cpp.
bool tesseract_common::GeneralResourceLocator::loadEnvironmentVariable | ( | const std::string & | environment_variable | ) |
Load paths from an environment variable.
environment_variable | The environment variable to load paths from |
Definition at line 82 of file resource_locator.cpp.
|
overridevirtual |
Locate a resource based on a URL.
url | The URL of the resource |
Implements tesseract_common::ResourceLocator.
Definition at line 169 of file resource_locator.cpp.
bool tesseract_common::GeneralResourceLocator::operator!= | ( | const GeneralResourceLocator & | rhs | ) | const |
Definition at line 211 of file resource_locator.cpp.
|
default |
|
default |
bool tesseract_common::GeneralResourceLocator::operator== | ( | const GeneralResourceLocator & | rhs | ) | const |
Definition at line 210 of file resource_locator.cpp.
|
private |
Definition at line 113 of file resource_locator.cpp.
|
private |
Definition at line 214 of file resource_locator.cpp.
|
friend |
Definition at line 136 of file resource_locator.h.
|
friend |
Definition at line 137 of file resource_locator.h.
|
private |
Definition at line 141 of file resource_locator.h.