Robot Devastation
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | Protected Attributes | Static Private Attributes | List of all members
rd::ImageManager Class Referenceabstract

Generic image input manager. More...

#include <ImageManager.hpp>

Inheritance diagram for rd::ImageManager:
rd::MockImageManager rd::YarpImageManager rd::YarpLocalImageManager

Public Member Functions

virtual bool start ()=0
 Start to capture images. More...
 
virtual bool stop ()=0
 Stop capturing images.
 
virtual bool isStopped () const =0
 True if the manager is not active.
 
virtual bool setEnabled (bool enabled)=0
 Enables/disables notifications to listeners.
 
virtual Image getImage () const =0
 Return the last received image.
 
bool addImageEventListener (ImageEventListener *listener)
 Adds a ImageEventListener to the list of observers to be notified of events.
 
bool removeImageEventListeners ()
 Unregisters all the ImageEventListener stored.
 
virtual bool configure (const std::string &parameter, const std::string &value)
 Configures a parameter with a value.
 

Static Public Member Functions

static ImageManagergetImageManager ()
 Get a reference to the ImageManager. More...
 
static ImageManagergetImageManager (const std::string &id)
 Get a reference to the ImageManager. More...
 
static bool destroyImageManager ()
 Deallocate all the registered ImageManager.
 

Static Protected Member Functions

static bool Register (ImageManager *manager, const std::string &id)
 This function allows subclasses to install their unique instances in the singleton register to be selected later by the user.
 

Protected Attributes

std::vector< ImageEventListener * > listeners
 Observers registered to be notified of image events.
 

Static Private Attributes

static ImageManagerimageManagerInstance = NULL
 Stores the unique instance of the InputManager.
 
static std::string currentId = ""
 Stores the id of the current unique instance used.
 
static std::map< std::string, ImageManager * > imageManagerRegistry = std::map<std::string, rd::ImageManager *>()
 Stores all the ImageManager that have been registered.
 

Detailed Description

ImageManager is a singleton text (only one instance of this object can exist, that is is shared by all the users). To use this class, we first register the needed subclasses of this class. This way, we can later get the reference to the ImageManager with getImageManager() the name of the desired registered subclass. Later calls to getImageManager() will return that selected subclass.

When the program finishes, the ImageManager can be deallocated using destroyImageManager().

Imnage events are broadcasted to the registered listeners, along with the reference to the manager that triggered them to be able to access the image.

Member Function Documentation

◆ getImageManager() [1/2]

rd::ImageManager * rd::ImageManager::getImageManager ( )
static
Returns
By default, if no id is specified, this will return a reference to the first ImageManager that it can find in the registry, or NULL if no ImageManager was registered.

◆ getImageManager() [2/2]

rd::ImageManager * rd::ImageManager::getImageManager ( const std::string &  id)
static
Returns
The ImageManager registered with the given id, NULL if the id is not found in the registry.

◆ start()

virtual bool rd::ImageManager::start ( )
pure virtual

This function is supposed to be called after ImageManager configuration.

Implemented in rd::YarpLocalImageManager, rd::YarpImageManager, and rd::MockImageManager.


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