// -*- C++ -*-

//=============================================================================
/**
 *  @file Notify_Handler.h
 *
 *  Notify_Handler.h,v 1.2 2002/07/03 12:46:57 bala Exp
 *
 *  @author Balchanadran Natarajan <bala@cs.wustl.edu>
 */
//=============================================================================

#ifndef TAO_NOTIFY_HANDLER_H
#define TAO_NOTIFY_HANDLER_H
#include "ace/pre.h"

#include "TAO_Export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/Event_Handler.h"

class TAO_Connection_Handler;
class ACE_Allocator;
/**
 * @class TAO_Notify_Handler
 *
 * @brief Represents the handler used by the notify calls to the
 *  reactor within the ORB.
 *
 * Cluttering the *IOP handlers with the job of handling notify calls
 * introduces problems as mentioned in [BUG 1230]. This special
 * handler can help to avoid that problem by splitting the
 * responsibilities between actual connection handling and notify
 * handling that is done underneath the ORB.
 */
class TAO_Export TAO_Notify_Handler: public ACE_Event_Handler
{
public:

  /// Dtor
  ~TAO_Notify_Handler (void);

  /// Static method to create an instance of this object in the
  /// memory pool
  static TAO_Notify_Handler *create_handler (TAO_Connection_Handler *c,
                                             ACE_Allocator *alloc);

  /// Static method to destroy an instance of this object
  static void destroy_handler (TAO_Notify_Handler *nh);

  /// The standard handle_input method, it just redirects to the
  /// connection handler
  virtual int handle_input (ACE_HANDLE fd);
  virtual int handle_close (ACE_HANDLE fd,
                            ACE_Reactor_Mask close_mask);

protected:

  /// Ctor
  TAO_Notify_Handler (TAO_Connection_Handler *ch,
                      ACE_Allocator *alloc);

private:

  /// Preventing default ctor's.
  ACE_UNIMPLEMENTED_FUNC (TAO_Notify_Handler (void))

private:
  /// Our copy of the connection handler, reference count incremented
  /// and stored.
  TAO_Connection_Handler *ch_;

  /// Our allocator
  ACE_Allocator *allocator_;
};


#include "ace/post.h"
#endif /*TAO_NOTIFY_HANDLER_H*/
