#ifndef TCB_HH #define TCB_HH #include "sporadic_task.hh" #include "time_io.hh" #include #include #include class tcb { private: enum class State { NOT_INIT, UNEMPLOYED, READY, RUNNING, HOLD, DELAYED }; Sporadic_Task *t; State s; ms_t CPU_time; pid_t pid; pid_t kill_group_pid; std::chrono::system_clock::time_point rt_a, rt_c, rt_d, rt_t; void wierd_task_state(); void stop_process(); void cont_process(); void kill_process(); void usr1_process(); void extern_process_change_state(State state); public: tcb(); tcb(std::ifstream& f); ~tcb(); void change_state(State state); bool is_employed(); void tick(ms_t tick_time); void tick_running(ms_t tick_time); void update_state(); void check_release(); void check_period_over(); void check_delayed(); void check_done(); void release(); std::chrono::system_clock::time_point get_rt_c(); int get_id() { return t->get_id(); } ms_t get_c() { return t->get_c(); } ms_t get_d() { return t->get_d(); } ms_t get_t() { return t->get_t(); } void run(); void stop(); void store(); void print_state(std::ostream& os = std::cout); void print_relevant_runtime_data(std::ostream& os = std::cout); void print_runtime_data(std::ostream& os = std::cout); void print_task_parameters(std::ostream& os = std::cout); void print_end_of_period(std::ostream& os = std::cout); void print_completed(std::ostream& os = std::cout); void print_actual_deadline(std::ostream& os = std::cout); void print(std::ostream& os = std::cout); friend std::ostream& operator<<(std::ostream& os, tcb* tcb); }; #endif