Subject_Observer.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2002-2003 Jean-Francois Mercure Burroughs
00003 
00004 This program is free software; you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation; either version 2 of the License, or
00007 (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 
00018 
00019 Report problems and direct all questions to:
00020 
00021 email: Jean-Francois Mercure Burroughs or richard.gourdeau@polymtl.ca
00022 */
00023 
00029 
00030 static const char rcsid[] = "$Id: Subject_Observer.cpp,v 1.2 2004/09/06 21:04:53 gourdeau Exp $";
00031 
00032 #include <list>
00033 
00034 #include "Subject_Observer.h"
00035 
00036 Subject::Subject()
00038 {
00039 }
00040 
00041 Subject::~Subject()
00043 {
00044 }
00045 
00046 void Subject::Attach(Observer* o)
00048 {
00049   m_observers.push_back(o);
00050 }
00051 
00052 void Subject::Detach(Observer* o)
00054 {
00055     m_observers.remove(o);
00056 
00057 }
00058 
00059 void Subject::Notify(Observer* o)
00064 {
00065     list<Observer*>::iterator iter;
00066     for(iter=m_observers.begin();iter!=m_observers.end();iter++)
00067 //    for(iter=m_observers.begin();iter!=m_observers.end();++iter)
00068     {
00069         if(o!=(*iter))  
00070             (*iter)->Update(this);      
00071     }
00072 }
00073 
00074 // -----------------------------------------------------------------------------------------
00075 
00076 Observer::Observer()
00078 {
00079 }
00080 
00081 Observer::~Observer()
00083 {
00084 }
00085 
00086 void Observer::Update(Subject *theChangedSubject)
00093 {
00094 }
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 

Generated on Fri Feb 9 08:52:20 2007 for GLroboop An OpenGL Robotics Object Oriented Package in C++ by  doxygen 1.5.1