68 template <
class ResourceHandle>
79 std::vector<std::string> out;
80 out.reserve(resource_map_.size());
81 for (
const auto& resource_name_and_handle : resource_map_)
83 out.push_back(resource_name_and_handle.first);
95 typename ResourceMap::iterator it = resource_map_.find(handle.getName());
96 if (it == resource_map_.end())
98 resource_map_.insert(std::make_pair(handle.getName(), handle));
102 ROS_WARN_STREAM(
"Replacing previously registered handle '" << handle.getName() <<
"' in '" +
115 typename ResourceMap::const_iterator it = resource_map_.find(name);
117 if (it == resource_map_.end())
119 throw std::logic_error(
"Could not find resource '" + name +
"' in '" +
135 resource_manager_type* result)
137 for (
const auto& manager : managers) {
138 for (
const auto& handle_name : manager->getNames()) {
ResourceMap resource_map_
virtual ~ResourceManagerBase()=default
std::vector< std::string > getNames() const
std::string demangledTypeName()
Convenience method for demangling type names.
ResourceManager< ResourceHandle > resource_manager_type
Class for handling named resources.
ResourceHandle getHandle(const std::string &name)
Get a resource handle by name.
#define ROS_WARN_STREAM(args)
void registerHandle(const ResourceHandle &handle)
Register a new resource. If the resource name already exists, the previously stored resource value wi...
static void concatManagers(std::vector< resource_manager_type *> &managers, resource_manager_type *result)
Combine a list of interfaces into one.
std::map< std::string, ResourceHandle > ResourceMap
Non-templated Base Class that contains a virtual destructor.