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

Subject.hpp

00001 #if   !defined(__SUBJECT_HPP)
00002 #define __SUBJECT_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 <Common.hpp>
00026 #endif
00027 
00028 #if   !defined(__EVENT_HPP)
00029 #include <Event.hpp>
00030 #endif
00031 
00032 #if   !defined(__ITERATOR_HPP)
00033 #include <Iterator.hpp>
00034 #endif
00035 
00036 namespace corelinux
00037 {
00038    DECLARE_CLASS( Subject );
00039    DECLARE_CLASS( Observer );
00040 
00046    class Subject
00047    {
00048    public:
00049 
00050       //
00051       // Constructors and destructor
00052       //
00053 
00058                         Subject( void ) ;
00059 
00065                         Subject( SubjectCref );
00066 
00068 
00069       virtual           ~Subject( void );   
00070 
00071       //
00072       // Operator overloads
00073       //
00074 
00076 
00077                SubjectRef   operator=( SubjectCref );
00078 
00080 
00081                bool operator==( SubjectCref ) const;
00082 
00084 
00085                bool operator!=( SubjectCref ) const;
00086       //
00087       // Accessors
00088       //
00089 
00090 
00091       //
00092       // Mutators
00093       //
00094 
00101       virtual  void  addObserver( ObserverPtr, Event<Identifier> * ) 
00102                   throw ( NullPointerException ) = 0 ;
00103 
00110       virtual  void  removeObserver( ObserverPtr ) 
00111                   throw ( NullPointerException ) = 0 ;
00112 
00119       virtual  void  removeObserver( ObserverPtr, Event<Identifier> *  ) 
00120                   throw ( NullPointerException ) = 0 ;
00121 
00122       //
00123       // Iterator Factory methods
00124       //
00130       virtual  Iterator<ObserverPtr> *createIterator( void ) = 0;
00131 
00139       virtual  Iterator<ObserverPtr> *createIterator( Event<Identifier> * ) 
00140                   throw ( NullPointerException ) = 0 ;
00141 
00148       virtual  void destroyIterator( Iterator<ObserverPtr> * ) 
00149                   throw ( NullPointerException ) = 0 ;
00150 
00151    protected:
00152 
00153       //
00154       // Activity
00155       //
00156 
00164       virtual  void  notifyObservers( Event<Identifier> * )
00165                   throw ( NullPointerException ) ;
00166 
00174       virtual  void  notifyAllObservers( Event<Identifier> * )
00175                   throw ( NullPointerException ) ;
00176    private:
00177 
00178    };
00179 }
00180 
00181 #endif // if !defined(__SUBJECT_HPP)
00182 
00183 /*
00184    Common rcs information do not modify
00185    $Author: frankc $
00186    $Revision: 1.1 $
00187    $Date: 2000/05/07 14:53:13 $
00188    $Locker:  $
00189 */
00190 
00191 

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