extended interface
This commit is contained in:
@@ -8,6 +8,15 @@
|
|||||||
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
#ifndef _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||||
#define _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
#define _SRC_OUTPUT_IOUTPUTDRIVER_H_
|
||||||
|
|
||||||
|
#include "output/items/ILamp.h"
|
||||||
|
#include "output/items/ISolenoid.h"
|
||||||
|
#include "output/items/IDisplay.h"
|
||||||
|
#include "output/items/ISound.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
@@ -16,8 +25,17 @@ namespace output
|
|||||||
class IOutputDriver
|
class IOutputDriver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IOutputDriver();
|
virtual ~IOutputDriver() = default;
|
||||||
virtual ~IOutputDriver();
|
|
||||||
|
virtual std::vector<std::shared_ptr<items::ILamp>> get_lamps() = 0;
|
||||||
|
virtual std::vector<std::shared_ptr<items::ISolenoid>> get_solenoids() = 0;
|
||||||
|
virtual std::vector<std::shared_ptr<items::ISound>> get_sounds() = 0;
|
||||||
|
virtual std::vector<std::shared_ptr<items::IDisplay>> get_displays() = 0;
|
||||||
|
|
||||||
|
virtual boost::optional<std::shared_ptr<items::ILamp>> get_lamp(std::string name) = 0;
|
||||||
|
virtual boost::optional<std::shared_ptr<items::ISolenoid>> get_solenoid(std::string name) = 0;
|
||||||
|
virtual boost::optional<std::shared_ptr<items::ISound>> get_sound(std::string name) = 0;
|
||||||
|
virtual boost::optional<std::shared_ptr<items::IDisplay>> get_display(char number) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ public:
|
|||||||
void handle(Event& event) override;
|
void handle(Event& event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<IInputDriver> input_driver;
|
const std::shared_ptr<IInputDriver> input_driver;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ private:
|
|||||||
void notify();
|
void notify();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
utility::IBlockingQueue<Event>* event_queue;
|
const utility::IBlockingQueue<Event>* event_queue;
|
||||||
std::set<IEventHandler*> event_handlers;
|
std::set<IEventHandler*> event_handlers;
|
||||||
|
|
||||||
bool is_running;
|
bool is_running;
|
||||||
|
|||||||
@@ -10,14 +10,7 @@
|
|||||||
|
|
||||||
#include "output/IOutputDriver.h"
|
#include "output/IOutputDriver.h"
|
||||||
|
|
||||||
#include "output/items/ILamp.h"
|
|
||||||
#include "output/items/ISolenoid.h"
|
|
||||||
#include "output/items/IDisplay.h"
|
|
||||||
#include "output/items/ISound.h"
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace flippR_driver
|
namespace flippR_driver
|
||||||
{
|
{
|
||||||
@@ -31,21 +24,21 @@ public:
|
|||||||
|
|
||||||
virtual ~OutputDriver() = default;
|
virtual ~OutputDriver() = default;
|
||||||
// todo what is flipper_relay ?
|
// todo what is flipper_relay ?
|
||||||
std::vector<std::shared_ptr<items::ILamp>> get_lamps();
|
std::vector<std::shared_ptr<items::ILamp>> get_lamps() override;
|
||||||
std::vector<std::shared_ptr<items::ISolenoid>> get_solenoids();
|
std::vector<std::shared_ptr<items::ISolenoid>> get_solenoids() override;
|
||||||
std::vector<std::shared_ptr<items::ISound>> get_sounds();
|
std::vector<std::shared_ptr<items::ISound>> get_sounds() override;
|
||||||
std::vector<std::shared_ptr<items::IDisplay>> get_displays();
|
std::vector<std::shared_ptr<items::IDisplay>> get_displays() override;
|
||||||
|
|
||||||
std::shared_ptr<items::ILamp> get_lamp(std::string name);
|
boost::optional<std::shared_ptr<items::ILamp>> get_lamp(std::string name) override;
|
||||||
std::shared_ptr<items::ISolenoid> get_solenoid(std::string name);
|
boost::optional<std::shared_ptr<items::ISolenoid>> get_solenoid(std::string name) override;
|
||||||
std::shared_ptr<items::ISound> get_sound(std::string name);
|
boost::optional<std::shared_ptr<items::ISound>> get_sound(std::string name) override;
|
||||||
std::shared_ptr<items::IDisplay> get_display(char number);
|
boost::optional<std::shared_ptr<items::IDisplay>> get_display(char number) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::map<std::string, std::shared_ptr<items::ILamp>> lamps;
|
const std::map<std::string, std::shared_ptr<items::ILamp>> lamps;
|
||||||
std::map<std::string, std::shared_ptr<items::ISolenoid>> solenoids;
|
const std::map<std::string, std::shared_ptr<items::ISolenoid>> solenoids;
|
||||||
std::map<char, std::shared_ptr<items::IDisplay>> displays;
|
const std::map<char, std::shared_ptr<items::IDisplay>> displays;
|
||||||
std::map<std::string, std::shared_ptr<items::ISound>> sounds;
|
const std::map<std::string, std::shared_ptr<items::ISound>> sounds;
|
||||||
};
|
};
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
|||||||
Reference in New Issue
Block a user