Manager for hardware interface registrations. More...
#include <interface_manager.h>
Public Member Functions | |
template<class T > | |
T * | get () |
Get an interface. More... | |
std::vector< std::string > | getInterfaceResources (std::string iface_type) const |
Get the resource names registered to an interface, specified by type. More... | |
std::vector< std::string > | getNames () const |
Lists the demangled names of all registered interfaces. More... | |
template<class T > | |
void | registerInterface (T *iface) |
Register an interface. More... | |
void | registerInterfaceManager (InterfaceManager *iface_man) |
Register another interface manager. More... | |
Protected Types | |
typedef std::vector< InterfaceManager * > | InterfaceManagerVector |
typedef std::map< std::string, void * > | InterfaceMap |
typedef std::map< std::string, std::vector< std::string > > | ResourceMap |
typedef std::map< std::string, size_t > | SizeMap |
Protected Attributes | |
std::vector< ResourceManagerBase * > | interface_destruction_list_ |
InterfaceManagerVector | interface_managers_ |
InterfaceMap | interfaces_ |
InterfaceMap | interfaces_combo_ |
SizeMap | num_ifaces_registered_ |
ResourceMap | resources_ |
This will allow us to check the resources based on the demangled type name of the interface. More... | |
Manager for hardware interface registrations.
This class enables the registration of interfaces based on their class type, handling all the required demangling and storage. The registration ensures the presence of at most one interface instance per type. Accessors for interface listing are provided. Additionally, combinations of interfaces as required in CombinedRobotHW
are handled transparently.
Definition at line 122 of file interface_manager.h.
|
protected |
Definition at line 303 of file interface_manager.h.
|
protected |
Definition at line 302 of file interface_manager.h.
|
protected |
Definition at line 305 of file interface_manager.h.
|
protected |
Definition at line 304 of file interface_manager.h.
|
inline |
Get an interface.
If this class and its registered sub-managers only have one registered instance of the requested interface type, this will be returned. If multiple instances of the interface type were registered and the type is a ResourceManager
, this call will try to combine them into a single handle. In all other cases, nullptr
will be returned.
ResourceManager
, this method will not be able to combine them and will return nullptr
.T | The interface type |
T
or nullptr
Definition at line 183 of file interface_manager.h.
|
inline |
Get the resource names registered to an interface, specified by type.
This will return the list of all registered resources for ResourceManager
interfaces and an empty list for all others.
iface_type | The demangled type name of an interface |
Definition at line 283 of file interface_manager.h.
|
inline |
Lists the demangled names of all registered interfaces.
This includes the interfaces directly registered to this instance and the interfaces registered to registered managers. As multiple interfaces of the same type will get merged on access, duplicates are omitted.
Definition at line 250 of file interface_manager.h.
|
inline |
Register an interface.
This associates the name of the type of interface to be registered with the given pointer.
T | The interface type |
iface | A pointer to the interface to store |
Definition at line 138 of file interface_manager.h.
|
inline |
Register another interface manager.
This manager will be integrated transparently into all further access methods.
iface_man | A pointer to the interface manager to store |
Definition at line 157 of file interface_manager.h.
|
protected |
Definition at line 311 of file interface_manager.h.
|
protected |
Definition at line 309 of file interface_manager.h.
|
protected |
Definition at line 307 of file interface_manager.h.
|
protected |
Definition at line 308 of file interface_manager.h.
|
protected |
Definition at line 310 of file interface_manager.h.
|
protected |
This will allow us to check the resources based on the demangled type name of the interface.
Definition at line 313 of file interface_manager.h.