#include <manifest_parser/utils/logging.h>
-#include <boost/bind/bind.hpp>
-
+#include <algorithm>
#include <list>
#include <memory>
#include <string>
* the lists of steps and runs each of the step in the configured
* order.
*/
-class AppInstaller {
+class AppInstaller : public Step::IStepErrorSignal {
public:
/** Enumeration of possible returned Results */
enum class Result {
/** virtual desctructor */
virtual ~AppInstaller();
+ /** error handler for sending error signal */
+ void on_error(Step::Status result, const std::string& error) override;
+
/**
* \brief Adds new step to installer by specified type
* Type of template parameter is used to create requested step
void AddStep(Args&&... args) {
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this,
- boost::placeholders::_1, boost::placeholders::_2));
+ step->connect(this);
steps_.emplace_back(std::move(step));
}
void AddStepAtIndex(unsigned int index, Args&&... args) {
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this,
- boost::placeholders::_1, boost::placeholders::_2));
+ step->connect(this);
std::list<std::unique_ptr<Step>> tmpList;
tmpList.emplace_back(std::move(step));
auto it = steps_.begin();
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this,
- boost::placeholders::_1, boost::placeholders::_2));
+ step->connect(this);
*it = std::move(step);
}
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this,
- boost::placeholders::_1, boost::placeholders::_2));
+ step->connect(this);
steps_.insert(it, std::move(step));
}
std::unique_ptr<Step> step(
new StepT(context_.get(), std::forward<Args>(args)...));
- step->on_error.connect(
- boost::bind(&AppInstaller::HandleStepError, this,
- boost::placeholders::_1, boost::placeholders::_2));
+ step->connect(this);
steps_.insert(++it, std::move(step));
}