123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #include "stdafx.h"
- #include "PacketDispatcherFactory.h"
- #include "PacketDispatcher.h"
- using namespace DIOS::Dev::Detail::MachineryECOM;
- PacketDispatcherFactory *PacketDispatcherFactory::m_instance = nullptr;
- PacketDispatcherFactory::PacketDispatcherFactory()
- {
- }
- PacketDispatcherFactory::~PacketDispatcherFactory()
- {
- }
- PacketDispatcherFactory *PacketDispatcherFactory::Instance()
- {
- if (m_instance == nullptr)
- {
- m_instance = new PacketDispatcherFactory();
- }
- return m_instance;
- }
- IPacketDispatcher *PacketDispatcherFactory::CreateSingleton(const std::string &typeName)
- {
- if (m_dispatchers.find(typeName) != m_dispatchers.end())
- {
- return m_dispatchers[typeName];
- }
- IPacketDispatcher *dispatcher = nullptr;
-
- if (typeName == GENERAL_DISPATCHER)
- {
- dispatcher = new PacketDispatcher();
- m_dispatchers.insert(make_pair(typeName, dispatcher));
- }
- return dispatcher;
- }
|