54 static void callCM(
typename std::vector<C*>& managers, C* result,
typename C::ResourceManagerType*)
57 std::vector<typename C::ResourceManagerType*> managers_in(managers.begin(), managers.end());
58 C::concatManagers(managers_in, result);
63 static void callCM(
typename std::vector<C*>& , C* , ...) {}
67 { callCM<T>(managers, result,
nullptr); }
72 static void callGR(std::vector<std::string> &resources, C* iface,
typename C::ResourceManagerType*)
74 resources = iface->getNames();
79 static void callGR(std::vector<std::string> &, T* , ...) { }
83 {
return callGR<T>(resources, iface,
nullptr); }
86 static T*
newCI(std::vector<ResourceManagerBase*> &guards,
typename C::ResourceManagerType*)
88 T* iface_combo =
new T;
96 static T*
newCI(std::vector<ResourceManagerBase*> &, ...) {
98 ROS_ERROR(
"You cannot register multiple interfaces of the same type which are "
99 "not of type ResourceManager. There is no established protocol "
100 "for combining them.");
106 return newCI<T>(guards,
nullptr);
140 const std::string iface_name = internal::demangledTypeName<T>();
143 ROS_WARN_STREAM(
"Replacing previously registered interface '" << iface_name <<
"'.");
185 std::string type_name = internal::demangledTypeName<T>();
186 std::vector<T*> iface_list;
189 InterfaceMap::iterator it =
interfaces_.find(type_name);
191 T* iface =
static_cast<T*
>(it->second);
194 "'. This should never happen");
197 iface_list.push_back(iface);
202 T* iface = interface_manager->get<T>();
204 iface_list.push_back(iface);
207 if(iface_list.size() == 0)
210 if(iface_list.size() == 1)
211 return iface_list.front();
222 iface_combo =
static_cast<T*
>(it_combo->second);
235 iface_combo =
nullptr;
252 std::vector<std::string> out;
256 out.push_back(interface.first);
262 for (
const auto& interface_name : interface_manager->getNames())
264 if (std::find(out.begin(), out.end(), interface_name) == out.end())
266 out.push_back(interface_name);
285 std::vector<std::string> out;
286 ResourceMap::const_iterator it =
resources_.find(iface_type);
294 std::vector<std::string> resources = interface_manager->getInterfaceResources(iface_type);
295 out.insert(out.end(), resources.begin(), resources.end());
304 typedef std::map<std::string, size_t>
SizeMap;
305 typedef std::map<std::string, std::vector<std::string> >
ResourceMap;