lemon/bits/alteration_notifier.h
changeset 1697 4c593a4096da
parent 1587 8f1c317ebeb4
child 1701 77bb84387815
equal deleted inserted replaced
1:2da969e00b7e 2:26b06e03e6c6
    78       ///
    78       ///
    79       /// Default constructor for ObserverBase.
    79       /// Default constructor for ObserverBase.
    80       /// 
    80       /// 
    81       ObserverBase() : registry(0) {}
    81       ObserverBase() : registry(0) {}
    82 
    82 
       
    83       ObserverBase(const ObserverBase& copy) {
       
    84 	if (copy.attached()) {
       
    85 	  copy.getRegistry()->attach(*this);
       
    86 	}
       
    87       }
       
    88 	
    83       virtual ~ObserverBase() {}
    89       virtual ~ObserverBase() {}
    84 
    90 
    85       /// \brief Attaches the observer into an AlterationNotifier.
    91       /// \brief Attaches the observer into an AlterationNotifier.
    86       ///
    92       ///
    87       /// This member attaches the observer into an AlterationNotifier.
    93       /// This member attaches the observer into an AlterationNotifier.
   109       ///
   115       ///
   110       Registry* getRegistry() const { return const_cast<Registry*>(registry); }
   116       Registry* getRegistry() const { return const_cast<Registry*>(registry); }
   111       
   117       
   112       /// Gives back true when the observer is attached into a registry.
   118       /// Gives back true when the observer is attached into a registry.
   113       bool attached() const { return registry != 0; }
   119       bool attached() const { return registry != 0; }
   114 	
   120 
   115     private:
   121     private:
   116 
   122 
   117       ObserverBase(const ObserverBase& copy);
       
   118       ObserverBase& operator=(const ObserverBase& copy);
   123       ObserverBase& operator=(const ObserverBase& copy);
   119 
   124 
   120     protected:
   125     protected:
   121       
   126       
   122       Registry* registry;
   127       Registry* registry;