Manages resources. More...
#include <resource_manager.h>
Public Member Functions | |
void | acquireAll (const ros::NodeHandlePtr &node_handle) |
Acquires all managed resources. More... | |
template<typename... Args> | |
Resource::SharedPtr | add (Args &&...args) |
Adds a managed resource. More... | |
void | pauseAll () |
Pauses all managed resources. More... | |
void | releaseAll () |
Releases all managed resources. More... | |
ResourceManager () | |
Default constructor. More... | |
void | resumeAll () |
Resumes all managed resources. More... | |
~ResourceManager () | |
Default destructor. More... | |
Private Attributes | |
std::vector< typename Resource::SharedPtr > | resources_ |
Manages resources.
Managed resources such as ManagedSubscriber and ManagedServiceServer can be added to the manager and acquired or released on demand. ManagedRobotActivity uses this class in order to correctly pause/ shutdown and re-acquirer subscribers and services.
Resource | type to be managed |
Definition at line 70 of file resource_manager.h.
|
inline |
Default constructor.
Definition at line 76 of file resource_manager.h.
|
inline |
Default destructor.
Definition at line 81 of file resource_manager.h.
void robot_activity::resource::ResourceManager< Resource >::acquireAll | ( | const ros::NodeHandlePtr & | node_handle | ) |
Acquires all managed resources.
node_handle | ROS Node handle is necessary for acquiring |
Definition at line 45 of file resource_manager.cpp.
|
inline |
Adds a managed resource.
Adds a managed resource to the list of managed resources. Arguments passed in should describe the managed resource. If the manager is specialized to deal with e.g. ManagedSubscriber then the they should match its constructor, which in turn has to match one of the ros::NodeHandle::subscribe function.
args | Arguments describing the resource |
Definition at line 95 of file resource_manager.h.
void robot_activity::resource::ResourceManager< Resource >::pauseAll | ( | ) |
Pauses all managed resources.
Definition at line 59 of file resource_manager.cpp.
void robot_activity::resource::ResourceManager< Resource >::releaseAll | ( | ) |
Releases all managed resources.
Definition at line 52 of file resource_manager.cpp.
void robot_activity::resource::ResourceManager< Resource >::resumeAll | ( | ) |
Resumes all managed resources.
Definition at line 66 of file resource_manager.cpp.
|
private |
Definition at line 125 of file resource_manager.h.