Public Types | List of all members
hardware_interface::ResourceManager< ResourceHandle > Class Template Reference

Class for handling named resources. More...

#include <resource_manager.h>

Inheritance diagram for hardware_interface::ResourceManager< ResourceHandle >:
Inheritance graph
[legend]

Public Types

typedef ResourceManager< ResourceHandle > ResourceManagerType
 

Non Real-Time Safe Functions

typedef std::map< std::string, ResourceHandle > ResourceMap
 
ResourceMap resource_map_
 
std::vector< std::string > getNames () const
 
void registerHandle (const ResourceHandle &handle)
 Register a new resource. If the resource name already exists, the previously stored resource value will be replaced with val. More...
 
ResourceHandle getHandle (const std::string &name)
 Get a resource handle by name. More...
 
static void concatManagers (std::vector< ResourceManagerType * > &managers, ResourceManagerType *result)
 Combine a list of interfaces into one. More...
 

Additional Inherited Members

- Public Member Functions inherited from hardware_interface::ResourceManagerBase
virtual ~ResourceManagerBase ()=default
 

Detailed Description

template<class ResourceHandle>
class hardware_interface::ResourceManager< ResourceHandle >

Class for handling named resources.

Resources are encapsulated inside handle instances, and this class allows to register and get them by name.

Template Parameters
ResourceHandleResource handle type. Must implement the following method:
std::string getName() const;

Definition at line 69 of file resource_manager.h.

Member Typedef Documentation

◆ ResourceManagerType

template<class ResourceHandle >
typedef ResourceManager<ResourceHandle> hardware_interface::ResourceManager< ResourceHandle >::ResourceManagerType

Definition at line 72 of file resource_manager.h.

◆ ResourceMap

template<class ResourceHandle >
typedef std::map<std::string, ResourceHandle> hardware_interface::ResourceManager< ResourceHandle >::ResourceMap
protected

Definition at line 147 of file resource_manager.h.

Member Function Documentation

◆ concatManagers()

template<class ResourceHandle >
static void hardware_interface::ResourceManager< ResourceHandle >::concatManagers ( std::vector< ResourceManagerType * > &  managers,
ResourceManagerType result 
)
inlinestatic

Combine a list of interfaces into one.

Every registered handle in each of the managers is registered into the result interface

Parameters
managersThe list of resource managers to be combined.
resultThe interface where all the handles will be registered.
Returns
Resource associated to name. If the resource name is not found, an exception is thrown.

Definition at line 134 of file resource_manager.h.

◆ getHandle()

template<class ResourceHandle >
ResourceHandle hardware_interface::ResourceManager< ResourceHandle >::getHandle ( const std::string &  name)
inline

Get a resource handle by name.

Parameters
nameResource name.
Returns
Resource associated to name. If the resource name is not found, an exception is thrown.

Definition at line 113 of file resource_manager.h.

◆ getNames()

template<class ResourceHandle >
std::vector<std::string> hardware_interface::ResourceManager< ResourceHandle >::getNames ( ) const
inline
Returns
Vector of resource names registered to this interface.

Definition at line 77 of file resource_manager.h.

◆ registerHandle()

template<class ResourceHandle >
void hardware_interface::ResourceManager< ResourceHandle >::registerHandle ( const ResourceHandle &  handle)
inline

Register a new resource. If the resource name already exists, the previously stored resource value will be replaced with val.

Parameters
handleResource value. Its type should implement a std::string getName() method.

Definition at line 93 of file resource_manager.h.

Member Data Documentation

◆ resource_map_

template<class ResourceHandle >
ResourceMap hardware_interface::ResourceManager< ResourceHandle >::resource_map_
protected

Definition at line 148 of file resource_manager.h.


The documentation for this class was generated from the following file:
getName
ROSCONSOLE_CONSOLE_IMPL_DECL std::string getName(void *handle)


hardware_interface
Author(s): Wim Meeussen, Adolfo Rodriguez Tsouroukdissian
autogenerated on Tue Oct 15 2024 02:08:19