Main Page   Namespace List   Class Hierarchy   Data Structures   File List   Namespace Members   Data Fields   Globals   Related Pages  

Observer.cpp

Go to the documentation of this file.
00001 /*
00002  * Observer.cpp
00003  *
00004  * Copyright 2003, MobileSpear Inc. (www.mobilespear.com). All rights reserved.
00005  * Copyright 2003, David Resnick. All rights reserved.
00006  *
00007  * See the file doc\license.txt for the terms of usage and distribution.
00008  */
00009 
00010 #include <bogotel/Portability.h>
00011 #include <bogotel/Observer.h>
00012 
00013 namespace bogotel {
00014 
00015     void CSubject::attach(CObserver* o) {
00016         m_lstpObservers.push_back(o);
00017     }
00018 
00019     void CSubject::detach(CObserver* o) {
00020         boost::mutex::scoped_lock lock(m_mtxListObservers);
00021 
00022         m_lstpObservers.remove(o);
00023     }
00024 
00025     void CSubject::notify() {
00026         boost::mutex::scoped_lock lock(m_mtxListObservers);
00027 
00028         LIST_OBSERVER::iterator i = m_lstpObservers.begin();
00029         
00030         for (i = m_lstpObservers.begin(); i != m_lstpObservers.end(); i++) {
00031             (*i)->update(this);
00032         }
00033     }
00034 
00035 }
00036 

Generated on Tue Aug 12 12:41:30 2003 for bogotel by doxygen 1.3. Hosted by SourceForge.net Logo