29 #include <boost/utility.hpp>
31 #include "WProgressCombiner.h"
52 boost::shared_lock< boost::shared_mutex > rlock;
53 rlock = boost::shared_lock< boost::shared_mutex >(
m_updateLock );
58 unsigned int numPendingChildren = 0;
61 for( std::set< boost::shared_ptr< WProgress > >::iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
67 if( ( *i )->isPending() )
76 if( numPendingChildren )
78 m_progress /=
static_cast< float >( numPendingChildren );
87 boost::shared_lock< boost::shared_mutex > rlock = boost::shared_lock< boost::shared_mutex >(
m_updateLock );
90 bool addComma =
false;
92 for( std::set< boost::shared_ptr< WProgress > >::const_iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
94 if( !( !( *i )->isPending() && excludeFinished ) )
102 ss << ( *i )->getName();
115 boost::unique_lock<boost::shared_mutex> lock = boost::unique_lock<boost::shared_mutex>(
m_updateLock );
123 boost::unique_lock<boost::shared_mutex> lock = boost::unique_lock<boost::shared_mutex>(
m_updateLock );
132 boost::unique_lock<boost::shared_mutex> lock = boost::unique_lock<boost::shared_mutex>(
m_updateLock );
135 for( std::set< boost::shared_ptr< WProgress > >::iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
virtual float getProgress()
Returns the overall progress of this progress instance, including the child progress'.
Class managing progress inside of modules.
float m_progress
The current conglomerated progress.
virtual ~WProgressCombiner()
Destructor.
virtual void addSubProgress(boost::shared_ptr< WProgress > progress)
Adds a new progress to this combiner.
boost::shared_mutex m_updateLock
Lock for the above child set and the internal state update.
Base class for all kinds of progress combinations.
std::string getCombinedNames(bool excludeFinished=false) const
Generates a string combined out of every child progress name.
std::set< boost::shared_ptr< WProgress > > m_children
Set of all child progress.
virtual void finish()
Stops the progress.
bool m_pending
Flag denoting whether the progress is running or not.
virtual void finish()
Stops the progress.
virtual void removeSubProgress(boost::shared_ptr< WProgress > progress)
Removes the specified sub progress from this combiner.
virtual WProgressCombiner & operator++()
Simple increment operator to signal a forward stepping.
WProgressCombiner(std::string name="")
Default constructor.
bool m_determined
True if the progress has a known end point.
virtual void update()
Function updating the internal state.