Move some code to header

This commit is contained in:
Benau 2018-02-17 10:51:33 +08:00
parent c5788a2c90
commit cfeadf335c
2 changed files with 12 additions and 16 deletions

View File

@ -60,18 +60,6 @@ std::shared_ptr<ProtocolManager> ProtocolManager::createInstance()
return pm; return pm;
} // createInstance } // createInstance
// ----------------------------------------------------------------------------
std::shared_ptr<ProtocolManager> ProtocolManager::lock()
{
return m_protocol_manager.lock();
} // lock
// ----------------------------------------------------------------------------
bool ProtocolManager::emptyInstance()
{
return m_protocol_manager.expired();
} // emptyInstance
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
ProtocolManager::ProtocolManager() ProtocolManager::ProtocolManager()
{ {

View File

@ -229,8 +229,10 @@ private:
virtual void unpauseProtocol(Protocol *protocol); virtual void unpauseProtocol(Protocol *protocol);
public: public:
ProtocolManager(); // ===========================================
virtual ~ProtocolManager(); // Public constructor is required for shared_ptr
ProtocolManager();
virtual ~ProtocolManager();
void abort(); void abort();
void propagateEvent(Event* event); void propagateEvent(Event* event);
Protocol* getProtocol(ProtocolType type); Protocol* getProtocol(ProtocolType type);
@ -250,9 +252,15 @@ public:
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
static std::shared_ptr<ProtocolManager> createInstance(); static std::shared_ptr<ProtocolManager> createInstance();
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
static bool emptyInstance(); static bool emptyInstance()
{
return m_protocol_manager.expired();
} // emptyInstance
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
static std::shared_ptr<ProtocolManager> lock(); static std::shared_ptr<ProtocolManager> lock()
{
return m_protocol_manager.lock();
} // lock
}; // class ProtocolManager }; // class ProtocolManager