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,6 +229,8 @@ private:
virtual void unpauseProtocol(Protocol *protocol); virtual void unpauseProtocol(Protocol *protocol);
public: public:
// ===========================================
// Public constructor is required for shared_ptr
ProtocolManager(); ProtocolManager();
virtual ~ProtocolManager(); virtual ~ProtocolManager();
void abort(); void abort();
@ -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