### INotifier

  The INotifier class defines the notification protocol for objects that support observation. Because this class is an abstract base class, you cannot construct objects of this class. It is the responsibility of the derived class to do the actual notifications, even for INotificationId's defined by INotifier. All UI window classes inherit the notification process from INotifier.

  You can implement a notification protocol in the following ways:

  - Derive a class from the IStandardNotifier class, which inherits from INotifier, for a direct implementation of the INotifier protocol
  - Derive from the INotifier class and implement your own notification protocol

  Because IWindow inherits from and implements the INotifier protocol, IWindow provides a visual implementation. IStandardNotifier inherits from INotifier and can be used for any generic notifier, visual or not. You might want to derive your classes from IStandardNotifier if you are providing a nonvisual notifier.

  INotifier objects publish IInterest or INotificationIds for each notification that the derived class provides. You should document the details of these notifications, including if any notifier data is sent with the notification event.

  INotifier objects notify their observers of all events after the observer requests notification by calling IObserver::handleNotificationsFor.

#### OS/2 Considerations

  See Building VisualAge C++ Parts for Fun and Profit for more information on part construction.

### INotifier - Member Functions and Data by Group

### Constructors & Destructor

You cannot construct objects of this class because it is an abstract base class.

~INotifier

      public:
      virtual ~INotifier()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

INotifier

      public:
      INotifier()

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Notification Members

Use these members to affect the ability of INotifier to notify observers of events.

disableNotification

      public:
      virtual INotifier& disableNotification() = 0

  Stops the notifier from sending notifications to its observers.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

enableNotification

      public:
      virtual INotifier&
        enableNotification( bool enable = true ) = 0

  Starts the notifier sending notifications to its observers. This function can be overridden by derived classes to perform customized notification that your application might need. For instance, one of your function methods may require that a database be accessible before processing a retrieve function.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

isEnabledForNotification

      public:
      virtual bool isEnabledForNotification() const = 0

  Returns true if a notifier can send notifications to its observers.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

notifierAddress

      public:
      virtual INotifierAddress notifierAddress() const

  Returns a notifier address used to identify this notifier by observers. INotifier provides the default implementation.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Observer Addition and Removal

IObserver objects use these members to add and remove themselves from the notifier's collection.

addObserver

      protected:
      virtual INotifier&
        addObserver( IObserver& observer,
                     const IInterest& interest )

  Adds an observer to the notifier's list of observers

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeAllObservers

      protected:
      virtual INotifier& removeAllObservers() = 0

  Removes all observers from the notifier's list of observers.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

removeObserver

  Removes an observer from the notifier's list of observers.

  Overload 1

      protected:
      virtual INotifier&
        removeObserver( IObserver& observer,
                        const IInterest& interest )

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      virtual INotifier& removeObserver(IObserver& observer) = 0

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Observer Notification

These members notify observers of a change in a notifier.

notifyObservers

  Notifies all observers interested in a particular notification event. Each observer receives a notification event containing the identity of the notifier, the notification address.
  Note: A public and a protected version of notifyObservers are provided for convenience. The protected version does not require the caller to construct an INotificationEvent to call it. In this case, the construction of the INotificationEvent occurs in the code of the protected notifyObservers function.

  Overload 1

      public:
      virtual INotifier&
        notifyObservers( const INotificationEvent& event ) = 0

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

  Overload 2

      protected:
      virtual INotifier&
        notifyObservers( const INotificationId& id ) = 0

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

notifyObserversAsync

      public:
      virtual INotifier&
        notifyObserversAsync( const INotificationEvent& event )

  Asynchronously notify registered observers that are interested in this notification event. This member function creates a notification request which notifies each registered observer asynchronously in the thread in which the observer was created. The observer thread must be running a processMsgs loop or a ICrossThreadNotificationLoop in order to receive asynchronous events (see Details: Multi-threaded notification).

  The parameters are the following: anEvent - a reference to the INotificationEvent sent to the observers

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Obsolete

These members will soon be obsoleted.

observerList

      protected:
      virtual IObserverList&
        observerList( const IInterest* anInterest = 0 ) const = 0

  Returns the list of observers. If the observer list does not exist, the derived notifier class must create it before calling this member function.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Thread Information

threadId

      public:
      const IThreadId& threadId() const

  Returns the threadId in which this notifier was created.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### Miscellaneous Members

#### OS/2 Considerations

  See Building VisualAge C++ Parts for Fun and Profit for more information on part construction.

deleteId

      public:
      static INotificationId const deleteId

  Notification identifier provided to observers when an object derived from INotifier is deleted. It is the responsibility of the object derived from INotifier to send this notification. The two derived classes which currently send this notification are IWindow and IStandardNotifier.
  Note: IWindow sends this notification from its destructor. This means that the derived portions of the window have already been deleted. You should, therefore, not cast the pointer to the notifier data to an object that is derived from IWindow. In addition, the underlying system window may not be available at this time. Do not call any function that requires the system window unless you verify the system window exists. See This means that the derived portions of the notifier have already been deleted. You should not, therefore, cast the pointer to the notifier data to an object that is derived from IStandardNotifier.

Supported Platforms

  Windows | OS/2 | AIX
  Yes | Yes | Yes

### INotifier - Inherited Member Functions and Data

#### Inherited Public Functions

  - None

#### Inherited Public Data

  INotifier

  -     static INotificationId const allChangesId

#### Inherited Protected Functions

  - None

#### Inherited Protected Data

  - None