Skip to content

Problem notification lists API

Joan Vallvé Navarro requested to merge features/getters_notification_maps into devel

After merging !261 (merged), for some reasons related with the mutex in problem, the old accessors for the notification maps getStateBlockNotificationMap() and getFactorNotificationMap() were removed. The were replaced by the new consumeStateBlockNotificationMap() and consumeFactorNotificationMap() that returns them via copy, so, the map is emptied after calling them.

The tests were adapted to these new functions, but I think it can be misleading, mostly for new tests (notifications emptied before being updated to the solver...).

In this MR I propose to keep Problem::consumeStateBlockNotificationMap() and Problem::consumeFactorNotificationMap() protected. Then, SolverManager has been added as a friend to allow it to call these functions.

For testing, new public functions are provided (that does not alter the maps in Problem):

  • SizeStd getStateBlockNotificationMapSize() const: Returns the size of the map of state block notification.
  • bool getStateBlockNotification(const StateBlockPtr& sb_ptr, Notification& notif) const: Returns if the state block has been notified, and the notification via parameter.
  • SizeStd getFactorNotificationMapSize() const: Returns the size of the map of factor notification.
  • bool getFactorNotification(const FactorBasePtr& sb_ptr, Notification& notif) const: Returns if the factor has been notified, and the notification via parameter.

Merge request reports