Subject - object with views
Contents
Description
A subject is an object that has one or more views that it wishes to notify when it changes. The
SubjectIteractor class can be used if it is necessary to iterate through the views of a subject
explicitly.
Because subjects are shared, Subject is a subclass of Resource. To allow for the possibility of multiple
inheritance, in which case only a single copy of resource information should be maintained, Resource is a
virtual base class.
Name
Subject - object with views
Public Operations
enumUpdateHint{attaching,detaching,setting,changing}
This type enumerates possible hints when a subject is notifying a view that it has changed. The
attaching hint indicates that a view has attached to the subject. The detaching hint means that
the subject is being deleted and the view should consider itself detached. The setting hint means
that the subject's value has been set, though possibly to the same value as it already has. The
changing hint means that the value is set to something different than it was previously.
virtualvoidattach(View*)
Add a view to the subject's list.
virtualvoiddetach(View*)
Remove a view from the subject's list.
virtualvoidnotify(UpdateHint=changing)
Notify all the views of a subject that it has been updated.
virtualbooleanviewed_by(View*)
Return whether a given view is on the subject's list of views.
virtualvoidAttach(Interactor*)
This function is equivalent to attach and is provided solely for backward compatibility. It will
be removed in a future version.
virtualvoidDetach(Interactor*)
This function is equivalent to detach and is provided solely for backward compatibility. It will
be removed in a future version.
virtualvoidNotify()
This function is equivalent to notify(changing) and is provided solely for backward compatibility.
It will be removed in a future version.
booleanIsView(Interactor*)
This function is equivalent to viewed_by and is provided solely for backward compatibility. It
will be removed in a future version.
See Also
View(3I) InterViews 29 June 1989 Subject(3I)
Subjectiterator Operations
A subject iterator can be used to iterate through the views in a subject.
SubjectIterator(Subject*)
Create a subject iterator for the given subject. The iterator is only valid as long as the
subject exists.
virtualvoidinit()
Reset the iteration to start at the beginning of the list. This operation is called by the
constructor.
virtualbooleanmore()
Return whether there are more views in the list.
virtualView*cur()
Return the current view.
virtualvoidremove()
Remove the current view from the list.
virtualvoidnext()
Move the iteration to the next view in the list.
Synopsis
#include<InterViews/subject.h>
