Public Member Functions | Private Attributes | List of all members
robot_activity::resource::ResourceManager< Resource > Class Template Reference

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_
 

Detailed Description

template<class Resource>
class robot_activity::resource::ResourceManager< Resource >

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.

Template Parameters
Resourcetype to be managed

Definition at line 70 of file resource_manager.h.

Constructor & Destructor Documentation

template<class Resource>
robot_activity::resource::ResourceManager< Resource >::ResourceManager ( )
inline

Default constructor.

Definition at line 76 of file resource_manager.h.

template<class Resource>
robot_activity::resource::ResourceManager< Resource >::~ResourceManager ( )
inline

Default destructor.

Definition at line 81 of file resource_manager.h.

Member Function Documentation

template<class Resource >
void robot_activity::resource::ResourceManager< Resource >::acquireAll ( const ros::NodeHandlePtr node_handle)

Acquires all managed resources.

Parameters
node_handleROS Node handle is necessary for acquiring

Definition at line 45 of file resource_manager.cpp.

template<class Resource>
template<typename... Args>
Resource::SharedPtr robot_activity::resource::ResourceManager< Resource >::add ( Args &&...  args)
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.

Parameters
argsArguments describing the resource
Returns
Returns a std::shared_ptr to the managed resource

Definition at line 95 of file resource_manager.h.

template<class Resource >
void robot_activity::resource::ResourceManager< Resource >::pauseAll ( )

Pauses all managed resources.

Definition at line 59 of file resource_manager.cpp.

template<class Resource >
void robot_activity::resource::ResourceManager< Resource >::releaseAll ( )

Releases all managed resources.

Definition at line 52 of file resource_manager.cpp.

template<class Resource >
void robot_activity::resource::ResourceManager< Resource >::resumeAll ( )

Resumes all managed resources.

Definition at line 66 of file resource_manager.cpp.

Member Data Documentation

template<class Resource>
std::vector<typename Resource::SharedPtr> robot_activity::resource::ResourceManager< Resource >::resources_
private

Definition at line 125 of file resource_manager.h.


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


robot_activity
Author(s): Maciej ZURAD
autogenerated on Thu Jun 6 2019 19:32:17