#include <functional>
#include <iostream>
#include <vector>

enum System { SYS_A, SYS_B, SYS_C };

class Command {
public:
  typedef std::function<void()> FuncType;

  Command(FuncType func, std::initializer_list<System> requirements)
  :func_(func), requirements_(requirements) { }

  void operator()() {
    std::cout << "Executing Command:" << std::endl;
    for ( System s : requirements_ )
      std::cout << "   REQUIRES " << static_cast<int>(s) << std::endl;
    func_();
  }

private:
  FuncType            func_;
  std::vector<System> requirements_;
};

class Scheduler {
public:
  void add(Command c) {
    c();
  }
};

class Robot {
public:
  Robot()
  :do_something_    (std::bind(&Robot::do_something, this),     {SYS_A, SYS_B}),
   do_another_thing_(std::bind(&Robot::do_another_thing, this), {SYS_A, SYS_C}) { }

  void runRobot() {
    s_.add(do_something_);
    s_.add(do_another_thing_);
  }

private:
  void do_first_thing()  { std::cout << "   FIRST THING!" << std::endl;  }
  void do_second_thing() { std::cout << "   SECOND THING!" << std::endl; }
  void do_third_thing()  { std::cout << "   THIRD THING!" << std::endl;  }

  void do_something()     { do_first_thing(); do_second_thing(); }
  void do_another_thing() { do_first_thing(); do_third_thing();  }

  Command   do_something_;
  Command   do_another_thing_;
  Scheduler s_;
};

int main(int, char**) {
  Robot().runRobot();
}