Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Examples  

SubjectObserver.hpp

00001 #if   !defined(__SUBJECTOBSERVER_HPP)
00002 #define __SUBJECTOBSERVER_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */   
00023 
00024 #if   !defined(__COMMON_HPP)
00025 #include <corelinux/Common.hpp>
00026 #endif
00027 
00028 #if   !defined(__SUBJECT_HPP)
00029 #include <corelinux/Subject.hpp>
00030 #endif
00031 
00032 #if   !defined(__OBSERVER_HPP)
00033 #include <corelinux/Observer.hpp>
00034 #endif
00035 
00036 #if !defined(__MAP_HPP)
00037 #include <corelinux/Map.hpp>
00038 #endif
00039 
00040 DECLARE_CLASS( SubjectObserver );
00041 
00048 class SubjectObserver : public CORELINUX( Subject ), CORELINUX( Observer )
00049 {
00050    CORELINUX_MULTIMAP
00051       ( 
00052          DwordIdentifier, 
00053          CORELINUX(ObserverPtr), 
00054          less<DwordIdentifier>,
00055          ObserverMap
00056       );
00057 
00058 public:
00059 
00060    //
00061    // Constructors and destructor
00062    //
00063 
00065 
00066                         SubjectObserver( void );
00067 
00069 
00070    virtual              ~SubjectObserver( void );
00071 
00072    //
00073    // Operator overloads
00074    //
00076 
00077             bool  operator=( SubjectObserverCref ) const;
00078             
00079    //
00080    // Mutators
00081    //
00082 
00089    virtual  void  addObserver
00090                ( 
00091                   CORELINUX( ObserverPtr ), 
00092                   CORELINUX( Event<corelinux::Identifier> ) * 
00093                ) 
00094                throw ( CORELINUX( NullPointerException ) ) ;
00095 
00102    virtual  void  removeObserver( CORELINUX( ObserverPtr ) ) 
00103                throw ( CORELINUX( NullPointerException ) ) ;
00104 
00111    virtual  void  removeObserver
00112                ( 
00113                   CORELINUX( ObserverPtr ), 
00114                   CORELINUX( Event<corelinux::Identifier> ) * 
00115                ) 
00116                throw ( CORELINUX( NullPointerException ) ) ;
00117 
00118    //
00119    // Iterator Factory methods
00120    //
00126    virtual  CORELINUX(Iterator< corelinux::ObserverPtr >) 
00127                *createIterator( void );
00128 
00136    virtual  CORELINUX(Iterator< corelinux::ObserverPtr >)  *createIterator
00137                ( 
00138                   CORELINUX( Event<corelinux::Identifier> ) * 
00139                ) 
00140                throw ( CORELINUX( NullPointerException ) ) ;
00141 
00148    virtual  void destroyIterator
00149                ( 
00150                   CORELINUX(Iterator< corelinux::ObserverPtr >) * 
00151                ) 
00152                throw ( CORELINUX( NullPointerException ) ) ;
00153 
00154 protected:
00155 
00157                      
00158                         SubjectObserver( SubjectObserverCref ) 
00159                            throw ( CORELINUX( Assertion ) );
00160 
00162 
00163             SubjectObserverRef operator=( SubjectObserverCref )
00164                throw ( CORELINUX( Assertion ) );
00165 
00166 private:
00168          
00169             ObserverMap        theObserverMap;
00170 
00171 };
00172 
00173 
00174 #endif // if !defined(__SUBJECTOBSERVER_HPP)
00175 
00176 /*
00177    Common rcs information do not modify
00178    $Author: prudhomm $
00179    $Revision: 1.2 $
00180    $Date: 2000/08/31 22:49:01 $
00181    $Locker:  $
00182 */
00183 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium