Skip to content
Snippets Groups Projects
Commit 8272212f authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

protected consume functions and new getters

parent c406ac3a
No related branches found
No related tags found
1 merge request!272Problem notification lists API
This commit is part of merge request !272. Comments created here will be created in the context of that merge request.
...@@ -252,9 +252,13 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -252,9 +252,13 @@ class Problem : public std::enable_shared_from_this<Problem>
*/ */
void removeStateBlock(StateBlockPtr _state_ptr); void removeStateBlock(StateBlockPtr _state_ptr);
/** \brief Returns the map of factor notification to be handled by the solver (the map stored in this is emptied) /** \brief Returns the size of the map of state block notification
*/ */
std::map<StateBlockPtr,Notification> consumeStateBlockNotificationMap(); SizeStd getStateBlockNotificationMapSize() const;
/** \brief Returns if the state block has been notified, and the notification via parameter
*/
bool getStateBlockNotification(const StateBlockPtr& sb_ptr, Notification& notif) const;
/** \brief Notifies a new factor to be added to the solver manager /** \brief Notifies a new factor to be added to the solver manager
*/ */
...@@ -264,10 +268,24 @@ class Problem : public std::enable_shared_from_this<Problem> ...@@ -264,10 +268,24 @@ class Problem : public std::enable_shared_from_this<Problem>
*/ */
void removeFactor(FactorBasePtr _factor_ptr); void removeFactor(FactorBasePtr _factor_ptr);
/** \brief Returns the size of the map of factor notification
*/
SizeStd getFactorNotificationMapSize() const;
/** \brief Returns if the factor has been notified, and the notification via parameter
*/
bool getFactorNotification(const FactorBasePtr& fac_ptr, Notification& notif) const;
protected:
/** \brief Returns the map of state block notification to be handled by the solver (the map stored in this is emptied)
*/
std::map<StateBlockPtr,Notification> consumeStateBlockNotificationMap();
/** \brief Returns the map of factor notification to be handled by the solver (the map stored in this is emptied) /** \brief Returns the map of factor notification to be handled by the solver (the map stored in this is emptied)
*/ */
std::map<FactorBasePtr, Notification> consumeFactorNotificationMap(); std::map<FactorBasePtr, Notification> consumeFactorNotificationMap();
public:
// Print and check --------------------------------------- // Print and check ---------------------------------------
/** /**
* \brief print wolf tree * \brief print wolf tree
...@@ -311,12 +329,25 @@ inline std::map<StateBlockPtr,Notification> Problem::consumeStateBlockNotificati ...@@ -311,12 +329,25 @@ inline std::map<StateBlockPtr,Notification> Problem::consumeStateBlockNotificati
return std::move(state_block_notification_map_); return std::move(state_block_notification_map_);
} }
inline SizeStd Problem::getStateBlockNotificationMapSize() const
{
std::lock_guard<std::mutex> lock(mut_state_block_notifications_);
return state_block_notification_map_.size();
}
inline std::map<FactorBasePtr,Notification> Problem::consumeFactorNotificationMap() inline std::map<FactorBasePtr,Notification> Problem::consumeFactorNotificationMap()
{ {
std::lock_guard<std::mutex> lock(mut_factor_notifications_); std::lock_guard<std::mutex> lock(mut_factor_notifications_);
return std::move(factor_notification_map_); return std::move(factor_notification_map_);
} }
inline wolf::SizeStd Problem::getFactorNotificationMapSize() const
{
std::lock_guard<std::mutex> lock(mut_factor_notifications_);
return factor_notification_map_.size();
}
} // namespace wolf } // namespace wolf
#endif // PROBLEM_H #endif // PROBLEM_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment