Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

Observer.cpp

Go to the documentation of this file.
00001 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  * vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
00003  *
00004  * Copyright (C) 2005 Dell Inc.
00005  *  by Michael Brown <Michael_E_Brown@dell.com>
00006  * Licensed under the Open Software License version 2.1
00007  *
00008  * Alternatively, you can redistribute it and/or modify
00009  * it under the terms of the GNU General Public License as published
00010  * by the Free Software Foundation; either version 2 of the License,
00011  * or (at your option) any later version.
00012 
00013  * This program is distributed in the hope that it will be useful, but
00014  * WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00016  * See the GNU General Public License for more details.
00017  */
00018 
00019 #define LIBSMBIOS_SOURCE
00020 #include "smbios/IObserver.h"
00021 #include "smbios/IFactory.h"
00022 
00023 using namespace std;
00024 
00025 namespace factory
00026 {
00027     IFactory::~IFactory() {}
00028     IFactory::IFactory() {}
00029 }
00030 
00031 namespace observer
00032 {
00033 
00034     IObserver::IObserver()
00035     {}
00036 
00037     IObserver::~IObserver()
00038     {}
00039 
00040     IObservable::IObservable()
00041     {}
00042 
00043     IObservable::~IObservable()
00044     {}
00045 
00046     void IObservable::attach( IObserver *o ) const
00047     {
00048         observers.push_back(o);
00049     }
00050 
00051     void IObservable::detach( IObserver *o ) const
00052     {
00053         observers.remove(o);
00054     }
00055 
00056     void IObservable::notify(void *param) const
00057     {
00058         list< IObserver * >::iterator iter;
00059         for( iter = observers.begin(); iter != observers.end(); ++iter )
00060         {
00061             (*iter)->update(this, param);
00062         }
00063     }
00064 
00065 
00066 
00067 }

Generated on Wed Apr 11 16:25:10 2007 for SMBIOS Library by doxygen 1.3.5