Subject.hpp
#if !defined(__SUBJECT_HPP)
#define __SUBJECT_HPP
/*
CoreLinux++
Copyright (C) 2000 CoreLinux Consortium
The CoreLinux++ Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The CoreLinux++ Library Library is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#if !defined(__COMMON_HPP)
#include <Common.hpp>
#endif
#if !defined(__EVENT_HPP)
#include <Event.hpp>
#endif
#if !defined(__ITERATOR_HPP)
#include <Iterator.hpp>
#endif
namespace corelinux
{
DECLARE_CLASS( Subject );
DECLARE_CLASS( Observer );
class Subject
{
public:
//
// Constructors and destructor
//
Subject( void ) ;
Subject( SubjectCref );
virtual ~Subject( void );
//
// Operator overloads
//
SubjectRef operator=( SubjectCref );
bool operator==( SubjectCref ) const;
bool operator!=( SubjectCref ) const;
//
// Accessors
//
//
// Mutators
//
virtual void addObserver( ObserverPtr, Event<Identifier> * )
throw ( NullPointerException ) = 0 ;
virtual void removeObserver( ObserverPtr )
throw ( NullPointerException ) = 0 ;
virtual void removeObserver( ObserverPtr, Event<Identifier> * )
throw ( NullPointerException ) = 0 ;
//
// Iterator Factory methods
//
virtual Iterator<ObserverPtr> *createIterator( void ) = 0;
virtual Iterator<ObserverPtr> *createIterator( Event<Identifier> * )
throw ( NullPointerException ) = 0 ;
virtual void destroyIterator( Iterator<ObserverPtr> * )
throw ( NullPointerException ) = 0 ;
protected:
//
// Activity
//
virtual void notifyObservers( Event<Identifier> * )
throw ( NullPointerException ) ;
virtual void notifyAllObservers( Event<Identifier> * )
throw ( NullPointerException ) ;
private:
};
}
#endif // if !defined(__SUBJECT_HPP)
/*
Common rcs information do not modify
$Author: frankc $
$Revision: 1.1 $
$Date: 2000/05/07 14:53:13 $
$Locker: $
*/
corelinux::Subject::Subject
Subject(void)
Default constructor.
Definition: Subject.cpp:39
corelinux::Subject::createIterator
virtual Iterator< ObserverPtr > * createIterator(void)=0
Create a iterator for all observers.
corelinux::Observer
Observer observes Subjets and supports the event interface for recieving subject event notifications...
Definition: Observer.hpp:44
corelinux::Subject::destroyIterator
virtual void destroyIterator(Iterator< ObserverPtr > *)=0
Deletes the iterator instance.
corelinux::Subject::~Subject
virtual ~Subject(void)
Virtual destructor.
Definition: Subject.cpp:57
corelinux::Subject::operator=
SubjectRef operator=(SubjectCref)
Assignment operator.
Definition: Subject.cpp:66
corelinux::Subject::operator==
bool operator==(SubjectCref) const
Equality operator.
Definition: Subject.cpp:75
corelinux
Forward reference the various common classes.
Definition: AbstractAllocator.hpp:32
corelinux::NullPointerException
NullPointerException is the base exception type for NullPointer.
Definition: NullPointerException.hpp:40
corelinux::Subject
Subject knows its Observer objects, communicates with its observers through event notification...
Definition: Subject.hpp:46
corelinux::Subject::notifyAllObservers
virtual void notifyAllObservers(Event< Identifier > *)
Performs the notification of ALL observers for a with a specific event.
Definition: Subject.cpp:121
corelinux::Subject::addObserver
virtual void addObserver(ObserverPtr, Event< Identifier > *)=0
Add an observer for a specific event.
corelinux::Subject::operator!=
bool operator!=(SubjectCref) const
In-Equality operator.
Definition: Subject.cpp:94
corelinux::Iterator
The Iterator provides a way to access the elements of an collection type sequentially without exposin...
Definition: Iterator.hpp:44
corelinux::Subject::removeObserver
virtual void removeObserver(ObserverPtr)=0
Remove an observer from all event notifications.
corelinux::Subject::notifyObservers
virtual void notifyObservers(Event< Identifier > *)
Performs the notification of observers for a specific event.
Definition: Subject.cpp:101
corelinux::Event
Event provides a type basis for event ontologies.
Definition: Event.hpp:35

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