CommunicateEntityFactory.cpp 870 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include "stdafx.h"
  2. #include "CommunicateEntityFactory.h"
  3. #include "DIOSBoardCommunicateEntity.h"
  4. using namespace DIOS::Dev::Detail::MachineryECOM;
  5. CommunicateEntityFactory *CommunicateEntityFactory::m_instance = nullptr;
  6. CommunicateEntityFactory::CommunicateEntityFactory()
  7. {
  8. }
  9. CommunicateEntityFactory::~CommunicateEntityFactory()
  10. {
  11. }
  12. CommunicateEntityFactory *CommunicateEntityFactory::Instance()
  13. {
  14. if (m_instance == nullptr)
  15. {
  16. m_instance = new CommunicateEntityFactory();
  17. }
  18. return m_instance;
  19. }
  20. ICommunicateEntity *CommunicateEntityFactory::CreateSingleton(const std::string &typeName)
  21. {
  22. if (m_communicates.find(typeName) == m_communicates.end())
  23. {
  24. if (typeName == COMMUNICATE_ENTITY_DIOSBOARD)
  25. {
  26. m_communicates[typeName] = new DIOSBoardCommunicateEntity();
  27. }
  28. }
  29. return m_communicates[typeName];
  30. }