Commit dc19df5d authored by JP Dinger's avatar JP Dinger

Skins2: Use typedefs for internal template-derived types, and rectify an...

Skins2: Use typedefs for internal template-derived types, and rectify an accidental skip while removing.
parent bebef5dc
...@@ -89,22 +89,22 @@ void AsyncQueue::push( const CmdGenericPtr &rcCommand, bool removePrev ) ...@@ -89,22 +89,22 @@ void AsyncQueue::push( const CmdGenericPtr &rcCommand, bool removePrev )
void AsyncQueue::remove( const string &rType, const CmdGenericPtr &rcCommand ) void AsyncQueue::remove( const string &rType, const CmdGenericPtr &rcCommand )
{ {
list<CmdGenericPtr>::iterator it; cmdList_t::iterator it;
for( it = m_cmdList.begin(); it != m_cmdList.end(); it++ ) for( it = m_cmdList.begin(); it != m_cmdList.end(); /* nothing */ )
{ {
// Remove the command if it is of the given type // Remove the command if it is of the given type and the command
if( (*it).get()->getType() == rType ) // doesn't disagree. Note trickery to avoid skipping entries
// while maintaining iterator validity.
if( (*it).get()->getType() == rType &&
rcCommand.get()->checkRemove( (*it).get() ) )
{ {
// Maybe the command wants to check if it must really be cmdList_t::iterator itNew = it;
// removed ++itNew;
if( rcCommand.get()->checkRemove( (*it).get() ) == true ) m_cmdList.erase( it );
{ it = itNew;
list<CmdGenericPtr>::iterator itNew = it;
itNew++;
m_cmdList.erase( it );
it = itNew;
}
} }
else ++it;
} }
} }
......
...@@ -56,7 +56,8 @@ public: ...@@ -56,7 +56,8 @@ public:
private: private:
/// Command queue /// Command queue
list<CmdGenericPtr> m_cmdList; typedef std::list<CmdGenericPtr> cmdList_t;
cmdList_t m_cmdList;
/// Timer /// Timer
OSTimer *m_pTimer; OSTimer *m_pTimer;
/// Mutex /// Mutex
......
...@@ -26,8 +26,8 @@ ...@@ -26,8 +26,8 @@
void CmdMuxer::execute() void CmdMuxer::execute()
{ {
list<CmdGeneric*>::const_iterator it; cmdList_t::const_iterator it;
for( it = m_list.begin(); it != m_list.end(); it++ ) for( it = m_list.begin(); it != m_list.end(); ++it )
{ {
(*it)->execute(); (*it)->execute();
} }
......
...@@ -40,7 +40,8 @@ public: ...@@ -40,7 +40,8 @@ public:
private: private:
/// List of commands we will execute sequentially /// List of commands we will execute sequentially
list<CmdGeneric*> m_list; typedef std::list<CmdGeneric*> cmdList_t;
cmdList_t m_list;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment