Base class for handling hardware resources. More...
#include <hardware_resource_manager.h>
Public Types | |
typedef ResourceHandle | ResourceHandleType |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
virtual | ~ResourceManagerBase ()=default |
Additional Inherited Members | |
![]() | |
static void | concatManagers (std::vector< ResourceManagerType * > &managers, ResourceManagerType *result) |
Combine a list of interfaces into one. More... | |
![]() | |
typedef std::map< std::string, ResourceHandle > | ResourceMap |
![]() | |
ResourceMap | resource_map_ |
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
ResourceHandle | Resource handle type. The only requisite on the type is that it implements a std::string getName() method. |
ClaimPolicy | Specifies the resource claiming policy for resource handling |
Definition at line 79 of file hardware_resource_manager.h.
typedef ResourceHandle hardware_interface::HardwareResourceManager< ResourceHandle, ClaimPolicy >::ResourceHandleType |
Definition at line 82 of file hardware_resource_manager.h.
|
inline |
Get a resource handle by name.
name | Resource name. |
Definition at line 96 of file hardware_resource_manager.h.