text: // This file was generated by mys. DO NOT EDIT!!!
  
  #include "message_passing/student.mys.hpp"
  #include "message_passing/calculator.mys.hpp"
  
  namespace message_passing::student
  {
  
  CalcTimer::CalcTimer(std::shared_ptr<Student> student)
  {
      this->student = student;
  }
  
  void CalcTimer::on_timeout()
  {
      auto value = std::make_shared<Timeout>();
      this->student->send_timeout(value);
  }
  
  Student::Student()
  {
      this->calculator = std::nullopt;
      //this->timer = std::make_shared<CalcTimer>(this->shared_from_this());
  }
  
  Student::~Student()
  {
  }
  
  void Student::start_timer()
  {
      this->timer->start(1);
  }
  
  void Student::start()
  {
      Thread::start();
      this->start_timer();
  }
  
  void Student::send_timeout(std::shared_ptr<Timeout>& message)
  {
  }
  
  void Student::handle_timeout(std::shared_ptr<Timeout>& message)
  {
      std::cout << std::endl;
      std::cout << *message << std::endl;
      auto value = std::make_shared<message_passing::calculator::Add>(random(), random());
      this->calculator.value()->send_add(value);
  }
  
  void Student::send_result(std::shared_ptr<message_passing::calculator::Result>& message)
  {
  }
  
  void Student::handle_result(std::shared_ptr<message_passing::calculator::Result>& message)
  {
      std::cout << *message << std::endl;
      this->start_timer();
  }
  
  }
  