+ void destroy();
+
+ void release_dependencies()
+ {
+ while (not successors_.empty()) {
+ ActivityPtr b = successors_.back();
+ XBT_CVERB(s4u_activity, "Remove a dependency from '%s' on '%s'", get_cname(), b->get_cname());
+ b->dependencies_.erase(this);
+ if (b->dependencies_solved()) {
+ b->vetoable_start();
+ }
+ successors_.pop_back();
+ }
+ }
+
+ void add_successor(ActivityPtr a)
+ {
+ if(this == a)
+ throw std::invalid_argument("Cannot be its own successor");
+ auto p = std::find_if(successors_.begin(), successors_.end(), [a](ActivityPtr const& i){ return i.get() == a.get(); });
+ if (p != successors_.end())
+ throw std::invalid_argument("Dependency already exists");
+
+ successors_.push_back(a);
+ a->dependencies_.insert({this});
+ }
+
+ void remove_successor(ActivityPtr a)
+ {
+ if(this == a)
+ throw std::invalid_argument("Cannot ask to remove itself from successors list");
+
+ auto p = std::find_if(successors_.begin(), successors_.end(), [a](ActivityPtr const& i){ return i.get() == a.get(); });
+ if (p != successors_.end()){
+ successors_.erase(p);
+ a->dependencies_.erase({this});
+ } else
+ throw std::invalid_argument("Dependency does not exist. Can not be removed.");
+ }
+
+ static std::set<Activity*>* vetoed_activities_;
+
+private:
+ static xbt::signal<void(Activity&)> on_veto;
+ static xbt::signal<void(Activity&)> on_completion;