Public Types | List of all members
hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy > Class Template Reference

Base class for handling hardware resources. More...

#include <hardware_resource_manager.h>

Inheritance diagram for hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy >:
Inheritance graph
[legend]

Public Types

typedef ResourceHandle ResourceHandleType
 
- Public Types inherited from hardware_interface::ResourceManager< ResourceHandle >
typedef ResourceManager< ResourceHandle > ResourceManagerType
 

Public Member Functions

Non Real-Time Safe Functions
ResourceHandle getHandle (const std::string &name)
 Get a resource handle by name. More...
 
- Public Member Functions inherited from hardware_interface::HardwareInterface
virtual ~HardwareInterface ()=default
 
virtual void claim (std::string resource)
 Claim a resource by name. More...
 
void clearClaims ()
 Clear the resources this interface is claiming. More...
 
std::set< std::string > getClaims () const
 Get the list of resources this interface is currently claiming. More...
 
- Public Member Functions inherited from hardware_interface::ResourceManager< ResourceHandle >
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...
 
- Public Member Functions inherited from hardware_interface::ResourceManagerBase
virtual ~ResourceManagerBase ()=default
 

Additional Inherited Members

- Static Public Member Functions inherited from hardware_interface::ResourceManager< ResourceHandle >
static void concatManagers (std::vector< ResourceManagerType * > &managers, ResourceManagerType *result)
 Combine a list of interfaces into one. More...
 
- Protected Types inherited from hardware_interface::ResourceManager< ResourceHandle >
typedef std::map< std::string, ResourceHandle > ResourceMap
 
- Protected Attributes inherited from hardware_interface::ResourceManager< ResourceHandle >
ResourceMap resource_map_
 

Detailed Description

template<class ResourceHandle, class ClaimPolicy = DontClaimResources>
class hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy >

Base class for handling hardware resources.

Hardware resources are encapsulated inside handle instances, and this class allows to register and get them by name. It is also possible to specify through the ClaimPolicy template parameter whether getting a handle claims the corresponding resource or not, like in the following example

// If unspecified, the resource manager will not claim resources
{
HardwareResourceManager<JointStateHandle> m;
// Populate m
m.getHandle("handle_name"); // DOES NOT claim the "handle_name" resource
}
// Explicitly set ClaimPolicy to DontClaimResources
{
HardwareResourceManager<JointStateHandle, DontClaimResources> m;
// Populate m
m.getHandle("handle_name"); // DOES NOT claim the "handle_name" resource
}
// Explicitly set ClaimPolicy to ClaimResources
{
HardwareResourceManager<JointHandle, ClaimResources> m;
// Populate m
m.getHandle("handle_name"); // DOES claim the "handle_name" resource
}
Template Parameters
ResourceHandleResource handle type. The only requisite on the type is that it implements a std::string getName() method.
ClaimPolicySpecifies the resource claiming policy for resource handling

Definition at line 79 of file hardware_resource_manager.h.

Member Typedef Documentation

◆ ResourceHandleType

template<class ResourceHandle , class ClaimPolicy = DontClaimResources>
typedef ResourceHandle hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy >::ResourceHandleType

Definition at line 82 of file hardware_resource_manager.h.

Member Function Documentation

◆ getHandle()

template<class ResourceHandle , class ClaimPolicy = DontClaimResources>
ResourceHandle hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy >::getHandle ( const std::string &  name)
inline

Get a resource handle by name.

Note
If the ClaimPolicy template parameter is set to ClaimResources, calling this method will internally claim the resource. If set to DontClaimResources, calling this method will not claim the resource.
Parameters
nameResource name.
Returns
Resource associated to name. If the resource name is not found, an exception is thrown.

Definition at line 96 of file hardware_resource_manager.h.


The documentation for this class was generated from the following file:


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