SMBIOS Library
Observer.cpp
Go to the documentation of this file.
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2  * vim:expandtab:autoindent:tabstop=4:shiftwidth=4:filetype=c:cindent:textwidth=0:
3  *
4  * Copyright (C) 2005 Dell Inc.
5  * by Michael Brown <Michael_E_Brown@dell.com>
6  * Licensed under the Open Software License version 2.1
7  *
8  * Alternatively, you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published
10  * by the Free Software Foundation; either version 2 of the License,
11  * or (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  */
18 
19 #define LIBSMBIOS_SOURCE
20 #include "smbios/IObserver.h"
21 #include "smbios/IFactory.h"
22 
23 using namespace std;
24 
25 namespace factory
26 {
27  IFactory::~IFactory() {}
28  IFactory::IFactory() {}
29 }
30 
31 namespace observer
32 {
33 
34  IObserver::IObserver()
35  {}
36 
37  IObserver::~IObserver()
38  {}
39 
40  IObservable::IObservable()
41  {}
42 
43  IObservable::~IObservable()
44  {}
45 
46  void IObservable::attach( IObserver *o ) const
47  {
48  observers.push_back(o);
49  }
50 
51  void IObservable::detach( IObserver *o ) const
52  {
53  observers.remove(o);
54  }
55 
56  void IObservable::notify(void *param) const
57  {
58  list< IObserver * >::iterator iter;
59  for( iter = observers.begin(); iter != observers.end(); ++iter )
60  {
61  (*iter)->update(this, param);
62  }
63  }
64 
65 
66 
67 }