MIRA
Public Member Functions | Protected Types | Protected Attributes | List of all members
UnitManager Class Reference

Class managing micro units and units. More...

#include <fw/UnitManager.h>

Public Member Functions

 ~UnitManager ()
 
std::string addThreadGroup (const ResourceName &ns, const std::string &name)
 Adds a thread group with namespace and name. More...
 
void addUnit (MicroUnitPtr unit, const std::string &ns, const std::string &name, const std::string &threadGroup="", bool startAtInit=true)
 Adds a unit to list of known ones. More...
 
void removeUnit (const std::string &id)
 Remove a known unit by its full id. More...
 
MicroUnitPtr getUnit (const std::string &id)
 Get a unit from the manager by its full id. More...
 
void initializeUnits ()
 Initializes (checks in) and starts all known units that are not yet initialized. More...
 
void startUnits ()
 Starts/Resumes all known units that are not yet started. More...
 
void stopUnits (bool destruct=false)
 Stops/Pauses all known units. More...
 

Protected Types

typedef std::tuple< MicroUnitPtr, std::string, std::string, std::string, bool > UnitEntry
 
typedef std::list< UnitEntryUnitList
 

Protected Attributes

UnitList mUnits
 
std::map< std::string, boost::shared_ptr< Authority > > mThreadGroups
 
boost::mutex mUnitsMutex
 

Detailed Description

Class managing micro units and units.

Member Typedef Documentation

◆ UnitEntry

typedef std::tuple<MicroUnitPtr, std::string, std::string, std::string, bool> UnitEntry
protected

◆ UnitList

typedef std::list<UnitEntry> UnitList
protected

Constructor & Destructor Documentation

◆ ~UnitManager()

Member Function Documentation

◆ addThreadGroup()

std::string addThreadGroup ( const ResourceName ns,
const std::string &  name 
)

Adds a thread group with namespace and name.

A thread group forms a parent authority of all enclosed units. These units will share the dispatcher thread of the thread groups authority

◆ addUnit()

void addUnit ( MicroUnitPtr  unit,
const std::string &  ns,
const std::string &  name,
const std::string &  threadGroup = "",
bool  startAtInit = true 
)

Adds a unit to list of known ones.

After all units are added they can be initialized, resumed and paused.

Parameters
[in]unitThe pointer to the micro unit
[in]nsThe namespace this unit resides in
[in]nameThe name of the unit
[in]threadGroupThe thread group that contains this unit or empty
[in]startAtInitFlag if unit shall be started after initialization (default=true)

◆ removeUnit()

void removeUnit ( const std::string &  id)

Remove a known unit by its full id.

◆ getUnit()

MicroUnitPtr getUnit ( const std::string &  id)

Get a unit from the manager by its full id.

Returns
pointer to unit or null pointer if not found

◆ initializeUnits()

void initializeUnits ( )

Initializes (checks in) and starts all known units that are not yet initialized.

◆ startUnits()

void startUnits ( )

Starts/Resumes all known units that are not yet started.

◆ stopUnits()

void stopUnits ( bool  destruct = false)

Stops/Pauses all known units.

Member Data Documentation

◆ mUnits

UnitList mUnits
protected

◆ mThreadGroups

std::map<std::string, boost::shared_ptr<Authority> > mThreadGroups
protected

◆ mUnitsMutex

boost::mutex mUnitsMutex
mutableprotected

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