equal
deleted
inserted
replaced
600 void eraseNode(const Node& node) { |
600 void eraseNode(const Node& node) { |
601 if (Parent::InEdgeIt(*this, node) == INVALID && |
601 if (Parent::InEdgeIt(*this, node) == INVALID && |
602 Parent::OutEdgeIt(*this, node) == INVALID) { |
602 Parent::OutEdgeIt(*this, node) == INVALID) { |
603 return; |
603 return; |
604 } |
604 } |
605 throw UnsupportedOperation(); |
605 throw typename NodesImplBase::Notifier::ImmediateDetach(); |
606 } |
606 } |
607 |
607 |
608 void clearNodes() { |
608 void clearNodes() { |
609 Parent::clear(); |
609 Parent::clear(); |
610 } |
610 } |
619 virtual ~NodesImpl() {} |
619 virtual ~NodesImpl() {} |
620 |
620 |
621 protected: |
621 protected: |
622 |
622 |
623 virtual void erase(const Node& node) { |
623 virtual void erase(const Node& node) { |
624 _edgeset.eraseNode(node); |
624 try { |
625 Parent::erase(node); |
625 _edgeset.eraseNode(node); |
|
626 Parent::erase(node); |
|
627 } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) { |
|
628 Parent::clear(); |
|
629 } |
626 } |
630 } |
627 virtual void erase(const std::vector<Node>& nodes) { |
631 virtual void erase(const std::vector<Node>& nodes) { |
628 for (int i = 0; i < (int)nodes.size(); ++i) { |
632 try { |
629 _edgeset.eraseNode(nodes[i]); |
633 for (int i = 0; i < (int)nodes.size(); ++i) { |
|
634 _edgeset.eraseNode(nodes[i]); |
|
635 } |
|
636 Parent::erase(nodes); |
|
637 } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) { |
|
638 Parent::clear(); |
630 } |
639 } |
631 Parent::erase(nodes); |
|
632 } |
640 } |
633 virtual void clear() { |
641 virtual void clear() { |
634 _edgeset.clearNodes(); |
642 _edgeset.clearNodes(); |
635 Parent::clear(); |
643 Parent::clear(); |
636 } |
644 } |
679 typedef typename Parent::Node Node; |
687 typedef typename Parent::Node Node; |
680 typedef typename Parent::Edge Edge; |
688 typedef typename Parent::Edge Edge; |
681 |
689 |
682 typedef _Graph Graph; |
690 typedef _Graph Graph; |
683 |
691 |
684 class UnsupportedOperation : public LogicError { |
|
685 public: |
|
686 virtual const char* what() const throw() { |
|
687 return "lemon::SmartUEdgeSet::UnsupportedOperation"; |
|
688 } |
|
689 }; |
|
690 |
|
691 protected: |
692 protected: |
692 |
693 |
693 typedef typename Parent::NodesImplBase NodesImplBase; |
694 typedef typename Parent::NodesImplBase NodesImplBase; |
694 |
695 |
695 void eraseNode(const Node& node) { |
696 void eraseNode(const Node& node) { |
696 if (typename Parent::IncEdgeIt(*this, node) == INVALID) { |
697 if (typename Parent::IncEdgeIt(*this, node) == INVALID) { |
697 return; |
698 return; |
698 } |
699 } |
699 throw UnsupportedOperation(); |
700 throw typename NodesImplBase::Notifier::ImmediateDetach(); |
700 } |
701 } |
701 |
702 |
702 void clearNodes() { |
703 void clearNodes() { |
703 Parent::clear(); |
704 Parent::clear(); |
704 } |
705 } |
713 virtual ~NodesImpl() {} |
714 virtual ~NodesImpl() {} |
714 |
715 |
715 protected: |
716 protected: |
716 |
717 |
717 virtual void erase(const Node& node) { |
718 virtual void erase(const Node& node) { |
718 _edgeset.eraseNode(node); |
719 try { |
719 Parent::erase(node); |
720 _edgeset.eraseNode(node); |
|
721 Parent::erase(node); |
|
722 } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) { |
|
723 Parent::clear(); |
|
724 } |
720 } |
725 } |
721 virtual void erase(const std::vector<Node>& nodes) { |
726 virtual void erase(const std::vector<Node>& nodes) { |
722 for (int i = 0; i < (int)nodes.size(); ++i) { |
727 try { |
723 _edgeset.eraseNode(nodes[i]); |
728 for (int i = 0; i < (int)nodes.size(); ++i) { |
724 } |
729 _edgeset.eraseNode(nodes[i]); |
725 Parent::erase(nodes); |
730 } |
|
731 Parent::erase(nodes); |
|
732 } catch (const typename NodesImplBase::Notifier::ImmediateDetach&) { |
|
733 Parent::clear(); |
|
734 } |
726 } |
735 } |
727 virtual void clear() { |
736 virtual void clear() { |
728 _edgeset.clearNodes(); |
737 _edgeset.clearNodes(); |
729 Parent::clear(); |
738 Parent::clear(); |
730 } |
739 } |