implemented output driver
This commit is contained in:
@@ -7,20 +7,58 @@
|
|||||||
|
|
||||||
#include "OutputDriver.h"
|
#include "OutputDriver.h"
|
||||||
|
|
||||||
|
#include <boost/range/adaptor/map.hpp>
|
||||||
|
#include <boost/range/algorithm/copy.hpp>
|
||||||
|
|
||||||
namespace FlippR_Driver
|
namespace FlippR_Driver
|
||||||
{
|
{
|
||||||
namespace output
|
namespace output
|
||||||
{
|
{
|
||||||
|
|
||||||
OutputDriver::OutputDriver()
|
OutputDriver::OutputDriver(std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds)
|
||||||
{
|
: cabinet_items(cabinet_items), displays(displays), sounds(sounds)
|
||||||
// TODO Auto-generated constructor stub
|
{}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<ICabinetItem>> OutputDriver::get_cabinet_items()
|
||||||
|
{
|
||||||
|
std::vector<std::shared_ptr<ICabinetItem>> cabinet_items;
|
||||||
|
|
||||||
|
boost::copy(this->cabinet_items | boost::adaptors::map_values, std::back_inserter(cabinet_items));
|
||||||
|
|
||||||
|
return cabinet_items;
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputDriver::~OutputDriver()
|
std::vector<std::shared_ptr<ISound>> OutputDriver::get_sounds()
|
||||||
{
|
{
|
||||||
// TODO Auto-generated destructor stub
|
std::vector<std::shared_ptr<ISound>> sounds;
|
||||||
|
|
||||||
|
boost::copy(this->sounds | boost::adaptors::map_values, std::back_inserter(sounds));
|
||||||
|
|
||||||
|
return sounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<IDisplay>> OutputDriver::get_displays()
|
||||||
|
{
|
||||||
|
std::vector<std::shared_ptr<IDisplay>> displays;
|
||||||
|
|
||||||
|
boost::copy(this->displays | boost::adaptors::map_values, std::back_inserter(displays));
|
||||||
|
|
||||||
|
return displays;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<ICabinetItem> OutputDriver::get_cabinet_item(std::string name)
|
||||||
|
{
|
||||||
|
return this->cabinet_items.find(name)->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<ISound> OutputDriver::get_sound(std::string name)
|
||||||
|
{
|
||||||
|
return this->sounds.find(name)->second;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<IDisplay> OutputDriver::get_display(char number)
|
||||||
|
{
|
||||||
|
return this->displays.find(number)->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
} /* namespace output */
|
} /* namespace output */
|
||||||
|
|||||||
@@ -25,8 +25,9 @@ namespace output
|
|||||||
class OutputDriver : public IOutputDriver
|
class OutputDriver : public IOutputDriver
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputDriver();
|
OutputDriver(std::map<std::string, std::shared_ptr<ICabinetItem>> cabinet_items, std::map<char, std::shared_ptr<IDisplay>> displays, std::map<std::string, std::shared_ptr<ISound>> sounds);
|
||||||
virtual ~OutputDriver();
|
|
||||||
|
virtual ~OutputDriver() = default;
|
||||||
|
|
||||||
std::vector<std::shared_ptr<ICabinetItem>> get_cabinet_items();
|
std::vector<std::shared_ptr<ICabinetItem>> get_cabinet_items();
|
||||||
std::vector<std::shared_ptr<ISound>> get_sounds();
|
std::vector<std::shared_ptr<ISound>> get_sounds();
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace output
|
|||||||
class OutputDriverFactory
|
class OutputDriverFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::shared_ptr <OutputDriver> getOutputDriver(std::ifstream &output_gpio_config, std::ifstream &output_config);
|
static std::shared_ptr <OutputDriver> getOutputDriver(std::ifstream &output_gpio_config, std::ifstream &output_config);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user