Robot Devastation
MockImageManager.hpp
1 // Authors: see AUTHORS.md at project root.
2 // CopyPolicy: released under the terms of the LGPLv2.1, see LICENSE at project root.
3 // URL: https://github.com/asrob-uc3m/robotDevastation
4 
5 #ifndef __RD_MOCK_IMAGE_MANAGER_HPP__
6 #define __RD_MOCK_IMAGE_MANAGER_HPP__
7 
8 #include <string>
9 
10 #include <yarp/os/Semaphore.h>
11 
12 #include "ImageManager.hpp"
13 
14 namespace rd{
15 
32 {
33  public:
34  virtual bool start();
35  virtual bool stop();
36  virtual bool isStopped() const;
37  virtual bool setEnabled(bool enabled);
38  virtual bool isEnabled() const;
39  virtual bool configure(const std::string & parameter, const std::string & value);
40  virtual Image getImage() const;
41 
47  static bool RegisterManager();
48 
50  virtual ~MockImageManager();
51 
53  static const std::string id;
54 
56  bool receiveImage(const Image & received_image);
57 
58  private:
66 
68  MockImageManager & operator=(const MockImageManager &);
69 
72 
74  mutable yarp::os::Semaphore semaphore;
75 
77  Image image;
78 
79  bool stopped;
80  bool enabled;
81 };
82 
83 
84 
85 }
86 
87 #endif //-- __RD_MOCK_IMAGE_MANAGER_HPP__
rd::MockImageManager
Image input manager based in YARP.
Definition: MockImageManager.hpp:31
rd::MockImageManager::receiveImage
bool receiveImage(const Image &received_image)
Simulate image has been received from device.
Definition: MockImageManager.cpp:75
rd::MockImageManager::semaphore
yarp::os::Semaphore semaphore
Semaphore to make the image manipulation thread-safe.
Definition: MockImageManager.hpp:74
rd::MockImageManager::configure
virtual bool configure(const std::string &parameter, const std::string &value)
Configures a parameter with a value.
Definition: MockImageManager.cpp:45
rd::MockImageManager::RegisterManager
static bool RegisterManager()
Register this manager in the ImageManager registry so that can be used.
Definition: MockImageManager.cpp:60
rd
The main, catch-all namespace for Robot Devastation.
Definition: groups.dox:4
rd::MockImageManager::getImage
virtual Image getImage() const
Return the last received image.
Definition: MockImageManager.cpp:51
rd::MockImageManager::MockImageManager
MockImageManager()
Constructor.
Definition: MockImageManager.cpp:98
rd::MockImageManager::start
virtual bool start()
Start to capture images.
Definition: MockImageManager.cpp:15
rd::MockImageManager::setEnabled
virtual bool setEnabled(bool enabled)
Enables/disables notifications to listeners.
Definition: MockImageManager.cpp:34
rd::MockImageManager::id
static const std::string id
String that identifies this manager.
Definition: MockImageManager.hpp:53
rd::MockImageManager::isStopped
virtual bool isStopped() const
True if the manager is not active.
Definition: MockImageManager.cpp:29
rd::MockImageManager::uniqueInstance
static MockImageManager * uniqueInstance
Reference to this manager (unique instance)
Definition: MockImageManager.hpp:71
rd::MockImageManager::~MockImageManager
virtual ~MockImageManager()
Destructor. Used to reset the local static reference after destroying this manager.
Definition: MockImageManager.cpp:70
rd::MockImageManager::image
Image image
Last image received.
Definition: MockImageManager.hpp:77
rd::MockImageManager::stop
virtual bool stop()
Stop capturing images.
Definition: MockImageManager.cpp:22
rd::ImageManager
Generic image input manager.
Definition: ImageManager.hpp:39