25 #ifndef WCONDITIONSET_H
26 #define WCONDITIONSET_H
32 #include <boost/shared_ptr.hpp>
35 #include <boost/thread.hpp>
38 #include "WCondition.h"
53 typedef boost::shared_ptr< WConditionSet >
SPtr;
58 typedef boost::shared_ptr< const WConditionSet >
ConstSPtr;
76 virtual void add( boost::shared_ptr< WCondition > condition );
83 virtual void remove( boost::shared_ptr< WCondition > condition );
89 virtual void wait()
const;
94 virtual void reset()
const;
107 void setResetable(
bool resetable =
true,
bool autoReset =
true );
166 #endif // WCONDITIONSET_H
WConditionSet()
Default constructor.
std::map< boost::shared_ptr< WCondition >, boost::signals2::connection > ConditionConnectionMap
We need to keep track of the connections a condition has made since boost::function objects do not pr...
virtual void wait() const
Wait for the condition.
boost::shared_ptr< const WConditionSet > ConstSPtr
Shared pointer to const instance of this class.
bool m_autoReset
Flag which shows whether the wait() call should reset the state m_fired when it returns.
boost::function0< void > t_ConditionNotifierType
Type used for signalling condition changes.
virtual void add(boost::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
virtual ~WConditionSet()
Destructor.
std::pair< boost::shared_ptr< WCondition >, boost::signals2::connection > ConditionConnectionPair
Each condition has a connection.
virtual void reset() const
Resets the internal fire state.
boost::shared_mutex m_conditionSetLock
Lock used for thread-safe writing to the condition set.
Class allowing multiple conditions to be used for one waiting cycle.
virtual void conditionFired()
Notifier function getting notified whenever a condition got fired.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
bool m_fired
Flag denoting whether one condition fired in the past.
bool isResetable()
Returns whether the condition set acts like a one shot condition.
ConditionConnectionMap m_conditionSet
Set of conditions to be waited for.
Class to encapsulate boost::condition_variable_any.
bool m_resetable
Flag denoting whether the condition set should act like a one shot condition.
boost::shared_ptr< WConditionSet > SPtr
Shared pointer to instance of this class.
WCondition::t_ConditionNotifierType m_notifier
The notifier which gets called by all conditions if they fire.