MotionModelFactory.cpp 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #include "stdafx.h"
  2. #include "MotionModelFactory.h"
  3. #include "TomoMotionModel.h"
  4. #include "RADMotionModel.h"
  5. #include "ResetMotionModel.h"
  6. #include "CalibrationModel.h"
  7. #include "ParkingModel.h"
  8. #include "SelfTestModel.h"
  9. #include "CBCTMotionModel.h"
  10. #include "CArmGeneralModel.h"
  11. #include "CArmResetMotionModel.h"
  12. using namespace DIOS::Dev::Detail::MachineryECOM;
  13. MotionModelFactory *MotionModelFactory::m_instance = nullptr;
  14. MotionModelFactory::MotionModelFactory()
  15. {
  16. }
  17. MotionModelFactory::~MotionModelFactory()
  18. {
  19. }
  20. MotionModelFactory *MotionModelFactory::Instance()
  21. {
  22. if (m_instance == nullptr)
  23. {
  24. m_instance = new MotionModelFactory();
  25. }
  26. return m_instance;
  27. }
  28. IMotionModel *MotionModelFactory::CreateModel(MOTION_MODEL_TYPE type)
  29. {
  30. IMotionModel *model = nullptr;
  31. switch (type)
  32. {
  33. case MOTION_MODEL_TYPE_TOMO:
  34. model = CreateTomoMotionModel();
  35. break;
  36. case MOTION_MODEL_TYPE_RAD:
  37. model = CreateRADMotionModel();
  38. break;
  39. case MOTION_MODEL_TYPE_TOMO_RESET:
  40. model = CreateResetMotionModel();
  41. break;
  42. case MOTION_MODEL_TYPE_TOMO_CALIBRATION:
  43. model = CreateCalibrationMotionModel();
  44. break;
  45. case MOTION_MODEL_TYPE_TOMO_PARKING:
  46. model = CreateParkingMotionModel();
  47. break;
  48. case MOTION_MODEL_TYPE_TOMO_SELFTEST:
  49. model = CreateSelfTestMotionModel();
  50. break;
  51. case MOTION_MODEL_TYPE_CBCT:
  52. model = CreateCBCTMotionModel();
  53. break;
  54. case MOTION_MODEL_TYPE_CARM_GENERAL:
  55. model = CreateCArmGeneralMotionModel();
  56. break;
  57. case MOTION_MODEL_TYPE_CARM_RESET:
  58. model = CreateCArmResetMotionModel();
  59. break;
  60. default:
  61. break;
  62. }
  63. return model;
  64. }
  65. IMotionModel *MotionModelFactory::CreateTomoMotionModel()
  66. {
  67. return new TomoMotionModel();
  68. }
  69. IMotionModel *MotionModelFactory::CreateRADMotionModel()
  70. {
  71. return new RADMotionModel();
  72. }
  73. IMotionModel *MotionModelFactory::CreateResetMotionModel()
  74. {
  75. return new ResetMotionModel();
  76. }
  77. IMotionModel *MotionModelFactory::CreateCalibrationMotionModel()
  78. {
  79. return new CalibrationModel();
  80. }
  81. IMotionModel *MotionModelFactory::CreateParkingMotionModel()
  82. {
  83. return new ParkingModel();
  84. }
  85. IMotionModel *MotionModelFactory::CreateSelfTestMotionModel()
  86. {
  87. return new SelfTestModel();
  88. }
  89. IMotionModel *MotionModelFactory::CreateCBCTMotionModel()
  90. {
  91. return new CBCTMotionModel();
  92. }
  93. IMotionModel *MotionModelFactory::CreateCArmGeneralMotionModel()
  94. {
  95. return new CArmGeneralModel();
  96. }
  97. IMotionModel *MotionModelFactory::CreateCArmResetMotionModel()
  98. {
  99. return new CArmResetMotionModel();
  100. }