Refactores Factory
This commit is contained in:
58
FlippR-Driver/src/output/factories/ItemFactory.h
Normal file
58
FlippR-Driver/src/output/factories/ItemFactory.h
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* ItemFactory.h
|
||||
*
|
||||
* Created on: December 28, 2019
|
||||
* Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
|
||||
*/
|
||||
|
||||
#ifndef FLIPPR_DRIVER_ITEMFACTORY_H
|
||||
#define FLIPPR_DRIVER_ITEMFACTORY_H
|
||||
|
||||
#include <PinController.h>
|
||||
#include "utility/config.h"
|
||||
#include "json/json.hpp"
|
||||
#include "output/items/Item.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace output
|
||||
{
|
||||
|
||||
namespace config_path
|
||||
{
|
||||
const char item_name[] = "name";
|
||||
const char item_address[] = "address";
|
||||
const char item_extender[] = "extender";
|
||||
const char item_identifier[] = "id";
|
||||
|
||||
const char deactivation_time[] = "deactivation_time_milliseconds";
|
||||
const char sound_path[] = "sounds";
|
||||
|
||||
const char flipper_path[] = "flippers";
|
||||
}
|
||||
|
||||
class ItemFactory
|
||||
{
|
||||
public:
|
||||
ItemFactory(nlohmann::json &object, std::shared_ptr<PinController> pin_controller);
|
||||
|
||||
virtual std::map<std::string, std::shared_ptr<items::Item>> getItemMap() = 0;
|
||||
|
||||
protected:
|
||||
void initialize_port_extender(nlohmann::json & extender);
|
||||
void initialize_port_extenders();
|
||||
uint8_t get_extender_pin_base(std::string & name);
|
||||
|
||||
protected:
|
||||
nlohmann::json object;
|
||||
std::shared_ptr<PinController> pin_controller;
|
||||
|
||||
private:
|
||||
nlohmann::json port_extenders;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //FLIPPR_DRIVER_ITEMFACTORY_H
|
||||
Reference in New Issue
Block a user