void AllOrder::load_orders(FILE *fop){ clear_all_orders(); unsigned size; int type; Order *buff; fscanf(fop,"%u ",&size); for(unsigned i=0;i<size;i++){ fscanf(fop,"%d ",&type); buff=COD->creat_order(type); if(buff){ buff->load(fop); order_stack.push_back(buff); } } }
void initialize_elevator(){ elev_set_speed(-300); current_state = DOWN; io_clear_all_lights(); while (elev_get_floor_sensor_signal() == -1) ; // Wait until first floor is reached. stop_elev(); clear_all_orders(); current_state = STOP; }
void ImpTradeSession::session_manager_procedure(void) { std::cout << "-> SESSION_MANAGER_PROCEDURE STARTUP." << std::endl; std::mutex mtx; std::unique_lock<std::mutex> lck(mtx); while (_worker_running) { try { std::this_thread::sleep_for (std::chrono::seconds(1)); int day, tm; get_current_dt(day, tm); if (tm >= this->_startTime && tm < this->_endTime) { if (!this->_is_login) { this->login(); this->_is_login = true; } else { // check _heartBtInt if (_last_exec_time > tm) _last_exec_time = tm; if (second_between_time(_last_exec_time, tm) >= _heartBtInt) { //调用心跳 std::cout << "-> WORKER_PROCEDURE HEARTBEATS:" << tm << std::endl; pub_message(TradeAPI::MessageType::MTInfo, "WORKER_PROCEDURE HEARTBEATS AT: %d", tm); call_410502(); } } } else { if (this->_is_login) { this->_is_login = false; this->logout(); clear_all_orders(); } } } catch (std::exception &e) { std::cout << e.what() << std::endl; } } std::cout << "-> SESSION_MANAGER_PROCEDURE STOPPED." << std::endl; }
AllOrder::~AllOrder() { clear_all_orders(); delete COD; }