30 #include <boost/utility.hpp>
32 #include "WProgressCombiner.h"
53 boost::shared_lock< std::shared_mutex > rlock;
54 rlock = boost::shared_lock< std::shared_mutex >(
m_updateLock );
59 unsigned int numPendingChildren = 0;
62 for( std::set< std::shared_ptr< WProgress > >::iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
68 if( ( *i )->isPending() )
77 if( numPendingChildren )
79 m_progress /=
static_cast< float >( numPendingChildren );
88 boost::shared_lock< std::shared_mutex > rlock = boost::shared_lock< std::shared_mutex >(
m_updateLock );
91 bool addComma =
false;
93 for( std::set< std::shared_ptr< WProgress > >::const_iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
95 if( !( !( *i )->isPending() && excludeFinished ) )
103 ss << ( *i )->getName();
116 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_updateLock );
124 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_updateLock );
133 std::unique_lock<std::shared_mutex> lock = std::unique_lock<std::shared_mutex>(
m_updateLock );
136 for( std::set< std::shared_ptr< WProgress > >::iterator i =
m_children.begin(); i !=
m_children.end(); ++i )
Base class for all kinds of progress combinations.
virtual void removeSubProgress(std::shared_ptr< WProgress > progress)
Removes the specified sub progress from this combiner.
virtual void addSubProgress(std::shared_ptr< WProgress > progress)
Adds a new progress to this combiner.
virtual void update()
Function updating the internal state.
WProgressCombiner(std::string name="")
Default constructor.
std::shared_mutex m_updateLock
Lock for the above child set and the internal state update.
std::set< std::shared_ptr< WProgress > > m_children
Set of all child progress.
virtual ~WProgressCombiner()
Destructor.
virtual float getProgress()
Returns the overall progress of this progress instance, including the child progress'.
virtual void finish()
Stops the progress.
virtual WProgressCombiner & operator++()
Simple increment operator to signal a forward stepping.
std::string getCombinedNames(bool excludeFinished=false) const
Generates a string combined out of every child progress name.
float m_progress
The current conglomerated progress.
Class managing progress inside of modules.
virtual void finish()
Stops the progress.
bool m_pending
Flag denoting whether the progress is running or not.
bool m_determined
True if the progress has a known end point.