12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- #include "task_command_manager.h"
- #include "../laser/Laser.h"
- #include "../laser/laser_manager.h"
- #include "../locate/locate_manager.h"
- //对外的接口函数,所有的任务发送方,都必须使用该函数。
- //execute_task在内部解析了Task_Base里面的Task_type,然后转发给具体某个模块的实例对象。
- //input:p_task_base 任务单,基类的指针,指向子类的实例,(多态)
- Error_manager Task_command_manager::execute_task(Task_Base* p_task_base)
- {
- Error_manager t_error;
- void * tp_tast_receiver = p_task_base->get_tast_receiver();
- switch ( p_task_base->get_task_type() )
- {
- case UNKNOW_TASK:
- t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
- " p_task_base->get_task_type() is UNKNOW_TASK ");
- break;
- case LASER_MANGER_SCAN_TASK:
- if ( tp_tast_receiver != NULL )
- {
- t_error = ((Laser_manager*)tp_tast_receiver)->execute_task(p_task_base);
- }
- else
- {
- t_error = Laser_manager::get_instance_references().execute_task(p_task_base);
- }
- break;
- case LASER_BASE_SCAN_TASK:
- if ( tp_tast_receiver != NULL )
- {
- t_error = ((Laser_base*)tp_tast_receiver)->execute_task(p_task_base);
- }
- else
- {
- return Error_manager(Error_code::TASK_NO_RECEIVER, Error_level::MINOR_ERROR,
- " Task_command_manager::execute_task have not receiver ");
- }
- break;
- case LOCATE_MANGER_TASK:
- if ( tp_tast_receiver != NULL )
- {
- t_error = ((Locate_manager*)tp_tast_receiver)->execute_task(p_task_base);
- }
- else
- {
- t_error = Locate_manager::get_instance_references().execute_task(p_task_base);
- }
- break;
- case PLC_TASK:
- ;
- break;
- case WJ_TASK:
- ;
- break;
- default:
- t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
- " p_task_base->get_task_type() is UNKNOW_TASK ");
- break;
- }
- return t_error;
- }
|